Commit 37c4c527 authored by Thonier Florian's avatar Thonier Florian Committed by Mathieu Giraud
Browse files

scatterplot & axes.js : add preset to get barplot of deletions for segments V/5and J/3

link to #2507
parent 8cbe8385
......@@ -246,6 +246,16 @@ Axes.prototype = {
"primers": {
label: "interpolated length, between BIOMED2 primers (inclusive)",
fct: function(cloneID) {return self.m.clone(cloneID).getSegLengthDoubleFeature('primer5', 'primer3')}
},
"delRight": {
label: "number of deletions for the segment V/5 in 3",
axis: new NumericalAxis(this.m),
fct: function(clone) { return clone.getDeletion('5', 'delRight') }
},
"delLeft": {
label: "number of deletions for the segment J/3 in 5",
axis: new NumericalAxis(this.m),
fct: function(clone) {return clone.getDeletion('3', 'delLeft')}
},
};
}
......
......@@ -793,8 +793,27 @@ Clone.prototype = {
},
/**
* Give th length of the deletion if clone have segment and corresponding deletion
*/
getDeletion: function(field_name, deletion_name)
{
if (this.hasSeg(field_name) ) {
if ( typeof this.seg[field_name][deletion_name] !== 'undefined' )
{
console.log("got it ! ", this.seg[field_name][deletion_name] )
return this.seg[field_name][deletion_name]
} else {
// has segment, but no deletion field
return -1
}
} else {
// haven't the segment
return -1
}
},
/* give a new custom tag to a clone
*
* */
......
......@@ -138,6 +138,8 @@ function ScatterPlot(id, model, database) {
"clone consensus coverage / GC content " : { "mode": this.MODE_GRID, "x": "coverage", "y" : "GCContent"},
"number of samples sharing each clone" : { "mode": this.MODE_GRID, "x": "nbSamples", "y" : "locus"},
// "interpolated length between BIOMED2 primers (inclusive)" : { "mode": this.MODE_BAR, "x": "primers", "y" : "Size"},
"number of deletions for the segment V/5 in 3" : { "mode": this.MODE_BAR, "x": "delRight", "y" : "Size"},
"number of deletions for the segment J/3 in 5" : { "mode": this.MODE_BAR, "x": "delLeft", "y" : "Size"},
};
this.default_preset = 1
......
......@@ -38,7 +38,7 @@ QUnit.module("Clone", {
"germline" : "TRG",
"seg" : {
"5" : {'start': 2, 'stop': 6}, // 1-based (current format)
"5" : {'start': 2, 'stop': 6, 'delRight': 18}, // 1-based (current format)
}
}
......@@ -259,6 +259,9 @@ QUnit.test('clone: get info from seg', function(assert) {
assert.equal(c1.getSegNtSequence('junction'), 'aat', 'junction c1')
assert.equal(c1.getSegAASequence('junction'), '', 'no AA junction for c1')
assert.equal(c1.getSegAASequence('cdr3'), 'ABCDE', 'AA CDR3 for c1')
assert.equal(c1.getDeletion('5', 'delRight'), -1, 'return -1, no deletion informed for c1')
assert.equal(c2.getDeletion('5', 'delRight'), 18, 'return length of the deletion for c2')
});
QUnit.test("clone : feature defined by a nucleotide sequence", function(assert) {
......
......@@ -25,7 +25,7 @@ QUnit.test("convert", function(assert) {
assert.deepEqual(m.convertSeg(seg), {"3": {"name": "J", "start": 3}, "4": {"name": "D", "start": 1, "stop": 2}, "5": {"name": "V", "stop": 0}, "score": {"val": 42}, "cdr3": {"start": 0, "stop": 3}, "foo": {"start": 17, "stop": 42}}, "convertSeg: Ok");
assert.deepEqual(m.convertSeg(json_clone1.seg)['5'], {"start": 1, "stop": 5}, "convertSeg on old 0-based 5/4/3 fields");
assert.deepEqual(m.convertSeg(json_clone2.seg)['5'], {"start": 1, "stop": 5}, "convertSeg on current 1-based fields");
assert.deepEqual(m.convertSeg(json_clone2.seg)['5'], {"start": 1, "stop": 5, 'delRight':18}, "convertSeg on current 1-based fields");
});
QUnit.test("load", function(assert) {
......
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