Commit f55f3a99 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Change limits and refactor code for make it more easily

parent e683dc7e
...@@ -30,11 +30,12 @@ d3.boxplot.scale = 1000; ...@@ -30,11 +30,12 @@ d3.boxplot.scale = 1000;
d3.boxplot.content_lines_width = d3.boxplot.scale / 600; d3.boxplot.content_lines_width = d3.boxplot.scale / 600;
d3.boxplot.break_lines_width = d3.boxplot.scale / 400; d3.boxplot.break_lines_width = d3.boxplot.scale / 400;
d3.boxplot.color_idy = { d3.boxplot.color_idy = {
"0.3": "#063806", "pos+": "#063806",
"0": "#43a743", "pos-": "#99d78d",
"-0.3": "#a55353", "neg+": "#d69185",
"-1": "#540404" "neg-": "#540404"
}; };
d3.boxplot.limit_idy = null;
//Filter sizes: //Filter sizes:
d3.boxplot.min_sizes = [0, 0.01, 0.02, 0.03, 0.05, 1, 2]; d3.boxplot.min_sizes = [0, 0.01, 0.02, 0.03, 0.05, 1, 2];
...@@ -62,6 +63,7 @@ d3.boxplot.init = function (id) { ...@@ -62,6 +63,7 @@ d3.boxplot.init = function (id) {
d3.boxplot.y_len = res["y_len"]; d3.boxplot.y_len = res["y_len"];
d3.boxplot.min_idy = res["min_idy"]; d3.boxplot.min_idy = res["min_idy"];
d3.boxplot.max_idy = res["max_idy"]; d3.boxplot.max_idy = res["max_idy"];
d3.boxplot.limit_idy = res["limit_idy"];
d3.boxplot.draw(res["x_contigs"], res["x_order"], res["y_contigs"], res["y_order"]); d3.boxplot.draw(res["x_contigs"], res["x_order"], res["y_contigs"], res["y_order"]);
$("div#draw").resizable({ $("div#draw").resizable({
aspectRatio: true aspectRatio: true
...@@ -519,7 +521,8 @@ d3.boxplot._sort_color_idy = function(a, b) { ...@@ -519,7 +521,8 @@ d3.boxplot._sort_color_idy = function(a, b) {
d3.boxplot.draw_legend = function () { d3.boxplot.draw_legend = function () {
let color_idy = d3.boxplot.color_idy; let color_idy = d3.boxplot.color_idy;
let color_idy_len = Object.keys(color_idy).length; let color_idy_len = Object.keys(color_idy).length;
let color_idy_order = Object.keys(color_idy).sort(d3.boxplot._sort_color_idy); let color_idy_order = ["pos+", "pos-", "neg+", "neg-"];
let color_idy_labels = [d3.boxplot.limit_idy.toString(), "0", (-d3.boxplot.limit_idy).toString(), "-1"];
let svgcontainer = d3.select("#legend .draw").append("svg:svg") let svgcontainer = d3.select("#legend .draw").append("svg:svg")
.attr("width", "100%") .attr("width", "100%")
.attr("height", "100%"); .attr("height", "100%");
...@@ -542,7 +545,7 @@ d3.boxplot.draw_legend = function () { ...@@ -542,7 +545,7 @@ d3.boxplot.draw_legend = function () {
.attr("text-anchor", "end") .attr("text-anchor", "end")
.attr("font-family", "sans-serif") .attr("font-family", "sans-serif")
.attr("font-size", "10pt") .attr("font-size", "10pt")
.text(color_idy_order[i]); .text(color_idy_labels[i]);
} }
container.append("text") container.append("text")
.attr("x", "45%") .attr("x", "45%")
......
#!/usr/bin/env python3 #!/usr/bin/env python3
limit_idy = 0.4
def parse_paf(paf, idx1, idx2): def parse_paf(paf, idx1, idx2):
...@@ -38,11 +39,11 @@ def parse_paf(paf, idx1, idx2): ...@@ -38,11 +39,11 @@ def parse_paf(paf, idx1, idx2):
x2 = int(parts[3]) x2 = int(parts[3])
y1 = int(parts[7 if strand == 1 else 8]) y1 = int(parts[7 if strand == 1 else 8])
y2 = int(parts[8 if strand == 1 else 7]) y2 = int(parts[8 if strand == 1 else 7])
if idy < -0.3: if idy < -limit_idy:
class_idy = "neg-" class_idy = "neg-"
elif idy < 0: elif idy < 0:
class_idy = "neg+" class_idy = "neg+"
elif idy < 0.3: elif idy < limit_idy:
class_idy = "pos-" class_idy = "pos-"
else: else:
class_idy = "pos+" class_idy = "pos+"
...@@ -87,5 +88,6 @@ def parse_paf(paf, idx1, idx2): ...@@ -87,5 +88,6 @@ def parse_paf(paf, idx1, idx2):
'y_contigs': y_contigs, 'y_contigs': y_contigs,
'y_order': y_order, 'y_order': y_order,
'name_x': first_sample, 'name_x': first_sample,
'name_y': second_sample 'name_y': second_sample,
'limit_idy': limit_idy
} }
...@@ -14,7 +14,7 @@ app_data = "/home/fcabanettes/public_html/test" ...@@ -14,7 +14,7 @@ app_data = "/home/fcabanettes/public_html/test"
# Root path # Root path
@app.route("/result/<id_res>", methods=['GET']) @app.route("/result/<id_res>", methods=['GET'])
def hello(id_res): def result(id_res):
title = "IGenoComp - An Interactive Genome Comparator" title = "IGenoComp - An Interactive Genome Comparator"
return render_template("index.html", title=title, id=id_res) return render_template("index.html", title=title, id=id_res)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment