Skip to content
Snippets Groups Projects
Commit b81d3288 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Add colors to boxplots

parent 7f2d935d
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,8 @@ with open(rscript_name, "w") as rscript:
columns = []
columns_goods = []
columns_bads = []
rscript.write("colors <- colorRampPalette(c(\"#ff0000\", \"#e6e600\", \"#00ff00\"));\n"
"colors <- colors(101);\n")
for indiv in range(1, args.nb_inds+1):
columns.append("gt_qual[,\"{0}__INDIV_{1}\"]".format(tool, indiv))
columns_goods.append("gt_qual_goods[,\"{0}__INDIV_{1}\"]".format(tool, indiv))
......@@ -54,21 +56,28 @@ with open(rscript_name, "w") as rscript:
"\t}}\n" +
"}}\n").format(tool, indiv))
colors = ["colors[round(mean(" + x + ", na.rm = T))+1]" for x in columns]
colors_goods = ["colors[round(mean(" + x + ", na.rm = T))+1]" for x in columns_goods]
colors_bads = ["colors[round(mean(" + x + ", na.rm = T))+1]" for x in columns_bads]
# All
rscript.write("pdf(\"gt_quality_" + tool + ".pdf\", width=9, height=3);\n")
rscript.write("par(mfrow=c(1,3));\n")
rscript.write("boxplot({0}, main=\"{1}\", xlab=\"individuals\", ylab=\"quality (%)\", ylim=c(0,100));\n".
format(", ".join(columns), tool.title() + " [ALL]"))
rscript.write(
"boxplot({0}, main=\"{1}\", xlab=\"individuals\", ylab=\"quality (%)\", ylim=c(0,100), border=c({2}));\n".
format(", ".join(columns), tool.title() + " [ALL]", ",".join(colors)))
rscript.write("axis(side=1, seq(1,{0}));\n".format(args.nb_inds))
# Goods
rscript.write("boxplot({0}, main=\"{1}\", xlab=\"individuals\", ylab=\"quality (%)\", ylim=c(0,100));\n".
format(", ".join(columns_goods), tool.title() + " [GOODS]"))
rscript.write(
"boxplot({0}, main=\"{1}\", xlab=\"individuals\", ylab=\"quality (%)\", ylim=c(0,100), border=c({2}));\n".
format(", ".join(columns_goods), tool.title() + " [GOODS]", ",".join(colors_goods)))
rscript.write("axis(side=1, seq(1,{0}));\n".format(args.nb_inds))
# Bads
rscript.write("boxplot({0}, main=\"{1}\", xlab=\"individuals\", ylab=\"quality (%)\", ylim=c(0,100));\n".
format(", ".join(columns_bads), tool.title() + " [BADS]"))
rscript.write(
"boxplot({0}, main=\"{1}\", xlab=\"individuals\", ylab=\"quality (%)\", ylim=c(0,100), border=c({2}));\n".
format(", ".join(columns_bads), tool.title() + " [BADS]", ",".join(colors_bads)))
rscript.write("axis(side=1, seq(1,{0}));\n".format(args.nb_inds))
sv_file_io = open(svs_file, "r")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment