Commit b2b22602 authored by Mathieu Giraud's avatar Mathieu Giraud Committed by Vidjil Team
Browse files

js/axis.js, js/scatterPlot.js: axis 'clone length'

parent 4468c3f2
......@@ -140,6 +140,39 @@ Axis.prototype = {
},
/*
*
* */
useSequenceLength: function () {
this.init()
var self = this;
var n_min = 9999;
var n_max = 1;
for (var i=0; i<this.m.clones.length; i++){
var n = this.m.clone(i).getSequenceLength();
if (n && n < n_min) n_min = n;
if (n > n_max) n_max = n;
}
this.sizeScale = d3.scale.linear()
.domain([n_min-1, n_max+1])
.range([0, 1]);
//clone position
this.pos = function(cloneID) {
return 1 - self.sizeScale(self.m.clone(cloneID).getSequenceLength())
}
//labels
var h = Math.ceil(n_max/5)
for (var i = 0; i < 5; i++) {
var pos = 1-this.sizeScale(h*i);
var text = h*i
this.labels.push(this.label("line", pos, text));
}
},
/*
*
* */
......
......@@ -105,6 +105,7 @@ function ScatterPlot(id, model) {
["allele_v", "allele V"],
["allele_j", "allele J"],
["Size", "abundance"],
["sequenceLength", "clone length"],
["n", "N length"]
];
......@@ -1620,6 +1621,9 @@ ScatterPlot.prototype = {
if (splitMethod == "Size") {
axis.useSize()
}
if (splitMethod == "sequenceLength") {
axis.useSequenceLength()
}
if (splitMethod == "n") {
axis.useNlength()
}
......
Markdown is supported
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