Commit 60a6af10 authored by Mikaël Salson's avatar Mikaël Salson

browser/js: Add Clone::isProductive method

See #3483
parent 942645fa
......@@ -932,6 +932,16 @@ Clone.prototype = {
}
return "unknown"
},
/**
* @return true iff the clone is productive, false otherwise.
* Thus the function doesn't differentiate between a non-productive
* clone and a clone for which we don't know. For more information
* see getProductivityName() function.
*/
isProductive: function() {
return this.getProductivityName() == "productive";
},
/* compute clone color
*
......
......@@ -1280,9 +1280,9 @@ genSeq.prototype= {
result = document.createElement('span');
currentSpan = document.createElement('span');
var isProductive = (! this.segmenter.amino &&
this.m.clones.hasOwnProperty(this.segmenter.first_clone) &&
this.m.clones[this.segmenter.first_clone].getProductivityName() == "productive"); // TODO : isProductive method
var canDisplaySynMutations = (! this.segmenter.amino &&
this.m.clones.hasOwnProperty(this.segmenter.first_clone) &&
this.m.clones[this.segmenter.first_clone].isProductive());
var reference_phase = (isProductive) ? (this.m.clones[this.segmenter.first_clone].seg.junction.start - 1) % 3 : undefined;
var mutations = {};
......
......@@ -514,3 +514,22 @@ QUnit.test("changealleleNotation", function(assert) {
m.changeAlleleNotation('never')
assert.equal(c2.getShortName(), "IGHV3-23 6/ACGTG/4 D1-1 5/12/4 J5", "clone2, .getShortName()");
});
QUnit.test("productivity", function(assert) {
var m = new Model();
m.parseJsonData(json_data);
var c1 = new Clone(json_clone1, m, 0);
var c2 = new Clone(json_clone2, m, 1);
var c3 = new Clone(json_clone3, m, 2);
m.initClones();
assert.equal(c1.getProductivityName(), "productive", "clone 1 should be productive");
assert.equal(c1.isProductive(), true, "clone 1 should be productive");
assert.equal(c2.getProductivityName(), "no CDR3 detected", "clone 2 doesn't have information about productivity");
assert.equal(c2.isProductive(), false, "clone 2 doesn't have information about productivity");
assert.equal(c3.getProductivityName(), "not productive", "clone 3 should not be productive");
assert.equal(c3.isProductive(), false, "clone 3 should not be productive");
});
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