Commit 94686d8c authored by Mathieu Giraud's avatar Mathieu Giraud

merge -- Foundations for distribution clones, including gray Genescan

Great work by @flothoni, will allow several long-requested features in the coming months.
See !515, #3902, and #1048.
parents b90786ac 77d9ee3f
Pipeline #101741 failed with stages
in 23 minutes and 12 seconds
......@@ -163,7 +163,7 @@
</div>
<div class="menu" id="color_menu" onmouseover="showSelector('colorSelector');" > color by
<div class="div-menu-selector"><select class="menu-selector" onchange="m.changeColorMethod(this.value)">
<div class="div-menu-selector"><select id="color_menu_select" class="menu-selector" onchange="m.changeColorMethod(this.value)">
<option value="Tag">tag</option>
<option value="clone">clone</option>
<option value="cdr3">CDR3</option>
......
......@@ -44,13 +44,15 @@ Axes.prototype = {
label:"V/5' gene",
axis: new GermlineAxis(this.m, false, true,
"5", false),
fct: function(clone) {return clone.getGene("5", false)}
fct: function(clone) {return clone.getGene("5", false)},
set: function(clone, value) { clone.seg["5"] = {"name": value}},
},
"d": {
doc: "D gene, gathering all alleles",
label:"D gene",
axis: new GenericAxis(),
fct: function(clone) {return clone.getGene("4", false)},
set: function(clone, value) { clone.seg["4"] = {"name": value}},
sort: true
},
"j": {
......@@ -58,21 +60,22 @@ Axes.prototype = {
label:"J/3' gene",
axis: new GermlineAxis(this.m, false, true,
"3", false),
fct: function(clone) {return clone.getGene("3", false)}
fct: function(clone) {return clone.getGene("3", false)},
set: function(clone, value) { clone.seg["3"] = {"name": value}}
},
"allele_v": {
doc: "V gene (or 5' segment), with allele",
label:"V allele",
axis: new GermlineAxis(this.m, false, true,
"5", true),
fct: function(clone) {return clone.getGene("5", true)}
fct: function(clone) {return clone.getGene("5", true)},
},
"allele_j": {
doc: "J gene (or 3' segment), with allele",
label:"J allele",
axis: new GermlineAxis(this.m, false, true,
"3", true),
fct: function(clone) {return clone.getGene("3", true)}
fct: function(clone) {return clone.getGene("3", true)},
},
"consensusLength" : {
doc: "length of the consensus sequence",
......@@ -85,14 +88,17 @@ Axes.prototype = {
doc: "average length of the reads belonging to each clone",
label: "clone average read length",
axis: new FloatAxis(this.m),
fct: function(clone) {return clone.getAverageReadLength()},
fct: function(clone, time) {return clone.getAverageReadLength(time)},
set: function(clone, value) {clone._average_read_length = value},
round: function(value) { return Math.round(Number(value)) },
pretty: function(len) { return createClassedSpan('widestBox', (len == 'undefined' ? '?' : len)) }
},
"GCContent" : {
doc: "%GC content of the consensus sequence of each clone",
label: "GC content",
axis: new PercentAxis(this.m),
fct: "GCContent"
fct: "GCContent",
set: function(clone, value) {this.GCContent = value}
},
"nLength": {
doc: "N length, from the end of the V/5' segment to the start of the J/3' segment (excluded)",
......@@ -106,6 +112,11 @@ Axes.prototype = {
label: "CDR3 length (nt)",
axis: new NumericalAxis(this.m),
fct: function(clone) {return clone.getSegLength('cdr3')},
set: function(clone, value) {
if (clone.seg.cdr3== undefined) { clone.seg.cdr3 = {} }
clone.seg.cdr3.start = 0
clone.seg.cdr3.stop = value
},
pretty: function(len) { return createClassedSpan('threeDigits', (len == 'undefined' ? '?' : len)) }
},
"productivity": {
......@@ -164,6 +175,7 @@ Axes.prototype = {
label: "locus",
axis: new GenericAxis(),
fct: function(clone){return clone.germline},
set: function(clone, value){ clone.germline = value},
pretty: function(system) { return self.m.systemBox(system) },
sort: true
},
......
......@@ -333,7 +333,10 @@ Builder.prototype = {
var li = document.createElement('li');
li.appendChild(div)
listTag.appendChild(li);
var listTag = document.getElementById("tagList")
if (listTag != null){
listTag.appendChild(li);
}
},
buildSystemSelector: function (system){
......@@ -357,8 +360,9 @@ Builder.prototype = {
// listGermline.appendChild(li);
},
/*complete displaySelector menu with correct info about current tagname / top
* */
/**
* complete displaySelector menu with correct info about current tagname / top
**/
build_displaySelector: function () {
var self = this;
......@@ -367,7 +371,9 @@ Builder.prototype = {
// var listGermline = document.getElementById("germline_list")
//reset
listTag.removeAllChildren();
if (listTag != null){
listTag.removeAllChildren();
}
// listGermline.removeAllChildren();
//init tag list
......
This diff is collapsed.
......@@ -446,7 +446,7 @@ Report.prototype = {
}
//remove virtual and disabled clones
if (i != norm && (this.m.clone(i).isVirtual() || !this.m.clone(i).isActive())) {
if (i != norm && (this.m.clone(i).isInScatterplot() || !this.m.clone(i).isActive())) {
polyline.parentNode.removeChild(polyline);
}
}
......@@ -524,7 +524,7 @@ Report.prototype = {
circle.setAttribute("stroke", color);
//remove virtual and disabled clones
if (this.m.clone(i).germline != system || this.m.clone(i).isVirtual() || !this.m.clone(i).isActive()) {
if (this.m.clone(i).germline != system || !this.m.clone(i).isInScatterplot() || !this.m.clone(i).isActive()) {
circle.parentNode.removeChild(circle);
}
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -280,7 +280,12 @@ Model_loader.prototype = {
var index = 0
for (var i = 0; i < data.clones.length; i++) {
if (data.clones[i].top <= limit) {
var clone = new Clone(data.clones[i], self, index)
// real
var c_attributes = C_CLUSTERIZABLE
| C_INTERACTABLE
| C_IN_SCATTERPLOT
| C_SIZE_CONSTANT
var clone = new Clone(data.clones[i], self, index, c_attributes)
self.mapID[data.clones[i].id] = index;
index++
}
......@@ -368,13 +373,18 @@ Model_loader.prototype = {
"reads": [],
"germline" : this.system_available[q],
};
new Clone(other, self, index, true);
new Clone(other, self, index, C_SIZE_OTHER);
index++ ;
}
//remove incomplete similarity matrix (TODO: fix fuse.py)
this.similarity = undefined;
this.check_export_monitor()
if (data.distributions != undefined){
this.distributions = data.distributions
this.loadAllDistribClones()
}
return this
}
......
......@@ -84,7 +84,7 @@ NumericalAxis.prototype = Object.create(GenericAxis.prototype);
if (this.ignore(this.values[i]))
continue;
if (! this.values[i].isVirtual()) {
if (!this.values[i].hasSizeOther()) {
var tmp = this.applyConverter(this.values[i]);
if ( typeof tmp != "undefined" && !isNaN(tmp)){
......
......@@ -620,11 +620,21 @@ ScatterPlot.prototype = {
return this;
},
includeBar: function(clone) {
return ((!this.use_system_grid ||
(this.use_system_grid && this.m.germlineV.system == clone.get('germline') )) &&
clone.isActive() &&
!clone.isVirtual());
includeBar: function(clone, log) {
var system_grid = (!this.use_system_grid || (this.use_system_grid && this.m.germlineV.system == clone.get('germline') ))
var showVirtual;
// Set if the clone should be show on is virtual/distrib status
if (clone.isInScatterplot() && clone.axes != undefined){
var axes = [this.splitX, this.splitY]
showVirtual = clone.sameAxesAsScatter(this)
} else if (!clone.isInScatterplot()) {
showVirtual = false
} else {
showVirtual = true
}
var include = (system_grid && (clone.isActive()|| clone.hasSizeDistrib()) && showVirtual)
return include
},
/**
......@@ -638,7 +648,8 @@ ScatterPlot.prototype = {
for (var j in this.axisX.value_mapping[i]) {
var clone = this.axisX.value_mapping[i][j]
if (this.includeBar(clone)){
tmp += clone.getSize();
time = this.m.getTime();
tmp += clone.getSize(time);
}
}
if (tmp > bar_max) bar_max = tmp;
......@@ -673,7 +684,8 @@ ScatterPlot.prototype = {
var clone = this.axisX.value_mapping[i][j]
var cloneID = clone.index;
if (this.includeBar(clone)){
height = clone.getSize()/bar_max;
time = this.m.getTime();
height = clone.getSize(time)/bar_max;
// Minimal height (does not affect y_pos)
var height_for_display = this.heightClone(height)
......@@ -1180,8 +1192,8 @@ ScatterPlot.prototype = {
if (otherSize > size) size = otherSize
}
if ((size == Clone.prototype.NOT_QUANTIFIABLE_SIZE) ||
(size > 0 && size < this.CLONE_MIN_SIZE))
if ( ((size == Clone.prototype.NOT_QUANTIFIABLE_SIZE) ||
(size > 0 && size < this.CLONE_MIN_SIZE)) && !this.m.clone(cloneID).hasSizeDistrib() )
size = this.CLONE_MIN_SIZE
this.nodes[cloneID].s = size
......@@ -1195,13 +1207,23 @@ ScatterPlot.prototype = {
updateClone: function(cloneID) {
// Clone size
var clone = this.m.clone(cloneID)
if (this.m.clone(cloneID)
.isActive()) {
var seqID, size;
if (this.m.clone(cloneID)
.split) {
if (clone.hasSizeDistrib()){
var axes = [this.splitX, this.splitY]
same_axes_as_scatter = clone.sameAxesAsScatter(this)
if (same_axes_as_scatter){
time = this.m.getTime()
size = clone.getReads() / this.m.reads.segmented[time]
} else {
size = 0
}
this.updateCloneSize(cloneID, size)
} else if (clone.split) {
// Display merged sub-clones
for (var i = 0; i < this.m.clusters[cloneID].length; i++) {
seqID = this.m.clusters[cloneID][i]
......@@ -1231,8 +1253,6 @@ ScatterPlot.prototype = {
}
// Clone position
var clone = this.m.clone(cloneID);
var sys = clone.get('germline');
if (this.use_system_grid && this.m.system == "multi" && typeof sys != 'undefined' && sys != this.m.germlineV.system) {
this.nodes[cloneID].x2 = this.systemGrid[sys].x * this.resizeW;
......@@ -1314,6 +1334,7 @@ ScatterPlot.prototype = {
changePreset: function(){
var elem = this.select_preset;
this.changeSplitMethod(this.preset[elem.value].x, this.preset[elem.value].y, this.preset[elem.value].mode);
this.m.update();
},
updatePreset: function(){
......
......@@ -333,6 +333,7 @@ Segment.prototype = {
var focus_selected = document.createElement('a');
focus_selected.appendChild(document.createTextNode("(focus)"))
focus_selected.className = "focus_selected"
focus_selected.id = "focus_selected"
focus_selected.onclick = function () { self.m.focusSelected() }
div_stats.appendChild(focus_selected)
......@@ -341,6 +342,7 @@ Segment.prototype = {
var hide_selected = document.createElement('a');
hide_selected.appendChild(document.createTextNode("(hide)"))
hide_selected.className = "focus_selected"
hide_selected.id = "hide_selected"
hide_selected.onclick = function () { self.m.hideSelected() }
div_stats.appendChild(hide_selected)
......@@ -638,6 +640,10 @@ Segment.prototype = {
* */
addToSegmenter: function (cloneID) {
var self = this;
if ( !this.m.clone(cloneID).hasSequence() ){
// This clone should not be added to the segmenter
return
}
this.aligned = false ;
this.resetAlign()
......@@ -657,14 +663,14 @@ Segment.prototype = {
var spanF = document.createElement('span');
spanF.id = "f" + cloneID;
this.div_elem(spanF, cloneID);
li.appendChild(spanF);
var spanM = document.createElement('span');
spanM.id = "m" + cloneID;
spanM.className = "seq-mobil";
spanM.innerHTML = this.sequence[cloneID].load().toString()
li.appendChild(spanF);
li.appendChild(spanM);
divParent.appendChild(li);
},
......@@ -1056,22 +1062,31 @@ Segment.prototype = {
var sumReads = 0;
var sumRawReads = 0;
var length = 0;
var nb_clones_not_constant = 0;
var lastActiveClone = 0;
//verifier que les points sélectionnés sont dans une germline courante
for (var i = 0; i < list.length ; i++){
if (this.m.clones[list[i]].isActive()) {
lastActiveClone = this.m.clones[list[i]]
length += 1;
sumPercentage += this.m.clone(list[i]).getSize();
sumReads+= this.m.clone(list[i]).getReads();
sumRawReads+= this.m.clone(list[i]).getRawReads();
if (lastActiveClone.hasSizeConstant()) {
length += 1;
} else {
var timepoint = this.m.t
nb_clones_not_constant += lastActiveClone.current_clones[timepoint];
}
sumPercentage += lastActiveClone.getSize();
sumReads+= lastActiveClone.getReads();
sumRawReads+= lastActiveClone.getRawReads();
}
}
var t = ""
if (sumRawReads > 0) {
t += length + " clone" + (length>1 ? "s" : "") + ", "
if (length) t += length ;
if (nb_clones_not_constant) t += '+' + nb_clones_not_constant;
t += " clone" + (length+nb_clones_not_constant>1 ? "s" : "") + ", "
t += this.m.toStringThousands(sumRawReads) + " read" + (sumRawReads>1 ? "s" : "")
......@@ -1081,8 +1096,11 @@ Segment.prototype = {
percentageStr = this.m.getStrAnySize(this.m.t, sumPercentage)
if (percentageStr != "+")
t += " (" + percentageStr + ")"
if (length == 1)
if (length == 1){
extra_info_system = lastActiveClone.getStrAllSystemSize(this.m.t, true)
} else {
extra_info_system = ""
}
t += " "
$(".focus_selected").css("display", "")
}
......@@ -1479,6 +1497,8 @@ Sequence.prototype = Object.create(genSeq.prototype);
var stop = -1;
var clone = this.m.clone(this.id);
if (!clone.hasSequence()) return
if (clone.hasSeg('cdr3')){
if (typeof clone.seg.cdr3.start != "undefined") {
start = this.pos[clone.seg.cdr3.start];
......
......@@ -80,7 +80,7 @@ function processResult(data) {
// Do not select virtual clones
var cloneIds = [];
for (var i = 0; i < model.clones.length; i++) {
if (! model.clones[i].isVirtual()) {
if (model.clones[i].isInteractable()) {
cloneIds.push(i);
}
}
......
......@@ -714,6 +714,39 @@ function openAndFillNewTab (content){
return
}
/**
* Function that allow to make comparison between two arrays.
*/
if(Array.prototype.equals)
console.warn("Overriding existing Array.prototype.equals. Possible causes: New API defines the method, there's a framework conflict or you've got double inclusions in your code.");
// attach the .equals method to Array's prototype to call it on any array
Array.prototype.equals = function (array) {
// if the other array is a falsy value, return
if (!array)
return false;
// compare lengths - can save a lot of time
if (this.length != array.length)
return false;
for (var i = 0, l=this.length; i < l; i++) {
// Check if we have nested arrays
if (this[i] instanceof Array && array[i] instanceof Array) {
// recurse into the nested arrays
if (!this[i].equals(array[i]))
return false;
}
else if (this[i] != array[i]) {
// Warning - two different object instances will never be equal: {x:20} != {x:20}
return false;
}
}
return true;
}
// Hide method from for-in loops
Object.defineProperty(Array.prototype, "equals", {enumerable: false});
/**
* @param {data} a string containing a multi-FASTA
* @param {n} the number of sequences to keep
......@@ -728,3 +761,5 @@ function getNFirstSequences(data, n) {
return data;
}
}
......@@ -112,7 +112,7 @@ Url.prototype= {
var clones = this.url_dict.clone.split(',');
for (var j = 0; j < clones.length; j++) {
var c = this.m.clone(clones[j]);
if (typeof c !== "undefined" && !c.isVirtual()) {
if (typeof c !== "undefined" && c.isInteractable()) {
c.select = true;
}
}
......
......@@ -7,7 +7,7 @@ headless:
HEADLESS=1 $(MAKE) functional
HEADLESS=1 $(MAKE) external
functional: ../../doc/analysis-example1.vidjil
functional: ../../doc/analysis-example1.vidjil ../../tools/tests/data/fused_multiple.vidjil
sh launch_functional_tests $(BROWSERS) functional/test_*rb
external: ../../doc/analysis-example1.vidjil
......
......@@ -127,12 +127,12 @@ QUnit.test("name, informations, getHtmlInfo", function(assert) {
assert.equal(json_clone1.seg.junction.start, 10, "Start junction is 10 in JSON for clone 1");
var m = new Model();
m.parseJsonData(json_data)
var c1 = new Clone(json_clone1, m, 0)
var c1 = new Clone(json_clone1, m, 0, c_attributes)
assert.equal(c1.seg.junction.start, 9, "Start junction is now 9 for clone 1 as positions start at 0 in the code");
var c2 = new Clone(json_clone2, m, 1)
var c3 = new Clone(json_clone3, m, 2)
var c4 = new Clone(json_clone4, m, 3)
var c5 = new Clone(json_clone5, m, 4)
var c2 = new Clone(json_clone2, m, 1, c_attributes)
var c3 = new Clone(json_clone3, m, 2, c_attributes)
var c4 = new Clone(json_clone4, m, 3, c_attributes)
var c5 = new Clone(json_clone5, m, 4, c_attributes)
m.initClones()
assert.equal(c1.getSequenceName(), "hello", "get name clone1 : hello");
......@@ -261,9 +261,9 @@ QUnit.test("name, informations, getHtmlInfo", function(assert) {
QUnit.test('clone: get info from seg', 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)
var c1 = new Clone(json_clone1, m, 0, c_attributes)
var c2 = new Clone(json_clone2, m, 1, c_attributes)
var c3 = new Clone(json_clone3, m, 2, c_attributes)
m.initClones()
assert.ok(c1.hasSeg('cdr3'), "clone1 has CDR3")
......@@ -304,9 +304,9 @@ QUnit.test('clone: get info from seg', function(assert) {
QUnit.test("clone : feature defined by a nucleotide sequence", 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)
var c1 = new Clone(json_clone1, m, 0, c_attributes)
var c2 = new Clone(json_clone2, m, 1, c_attributes)
var c3 = new Clone(json_clone3, m, 2, c_attributes)
m.initClones()
assert.deepEqual(c3.getSegStartStop('somefeature'), null, "start/stop positions are not present")
......@@ -318,9 +318,9 @@ QUnit.test("clone : feature defined by a nucleotide sequence", function(assert)
QUnit.test("getSequence/RevComp", 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)
var c1 = new Clone(json_clone1, m, 0, c_attributes)
var c2 = new Clone(json_clone2, m, 1, c_attributes)
var c3 = new Clone(json_clone3, m, 2, c_attributes)
m.initClones()
//fix test sequence et revcomp
......@@ -335,9 +335,9 @@ QUnit.test("size", 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)
c1 = new Clone(json_clone1, m, 0, c_attributes)
c2 = new Clone(json_clone2, m, 1, c_attributes)
c3 = new Clone(json_clone3, m, 2, c_attributes)
m.initClones()
assert.equal(c1.getSystemSize(), "0.1", "clone c1 system size : 0.1");
......@@ -368,7 +368,7 @@ QUnit.test("system", function(assert) {
var m = new Model();
m.parseJsonData(json_data)
var c3 = new Clone(json_clone3, m, 0)
var c3 = new Clone(json_clone3, m, 0, c_attributes)
m.initClones()
......@@ -387,7 +387,7 @@ QUnit.test("tag / color", function(assert) {
var m = new Model();
m.parseJsonData(json_data)
var c1 = new Clone(json_clone1, m, 0)
var c1 = new Clone(json_clone1, m, 0, c_attributes)
m.initClones()
assert.equal(c1.getTag(), 8, "getTag() >> default tag : 8");
......@@ -408,8 +408,8 @@ QUnit.test("tag / color", function(assert) {
QUnit.test("color by CDR3", 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, 0);
var c1 = new Clone(json_clone1, m, 0, c_attributes);
var c2 = new Clone(json_clone2, m, 0, c_attributes);
m.initClones();
var color = c1.getCDR3Color();
c1.seg.junction.aa = "AZERTY";
......@@ -426,8 +426,8 @@ QUnit.test("export", function(assert) {
var m = new Model();
m.parseJsonData(json_data)
var c3 = new Clone(json_clone3, m, 0)
var c4 = new Clone(json_clone4, m, 1)
var c3 = new Clone(json_clone3, m, 0, c_attributes)
var c4 = new Clone(json_clone4, m, 1, c_attributes)
m.initClones()
assert.equal(c3.getPrintableSegSequence(), "aaaaaa\naaaattttt\ntttt", "c3.getPrintableSegSequence() : Ok");
......@@ -478,9 +478,9 @@ QUnit.test("changeLocus/Segment", 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)
var c1 = new Clone(json_clone1, m, 0, c_attributes)
var c2 = new Clone(json_clone2, m, 1, c_attributes)
var c3 = new Clone(json_clone3, m, 2, c_attributes)
m.initClones()
// Test after germline manual changement
......@@ -505,9 +505,9 @@ QUnit.test("changeLocus/Segment", function(assert) {
QUnit.test("changeNameNotation", 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)
var c1 = new Clone(json_clone1, m, 0, c_attributes)
var c2 = new Clone(json_clone2, m, 1, c_attributes)
var c3 = new Clone(json_clone3, m, 2, c_attributes)
m.initClones()
m.changeCloneNotation('short_sequence')
assert.equal(c2.getShortName(), "IGHV3-23 6/ACGTG/4 D1-1 5/12/4 J5*02", "clone2, .getShortName()");
......@@ -523,10 +523,10 @@ QUnit.test("getLengthDoubleFeature", 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)
var c4 = new Clone(json_clone4, m, 3)
var c1 = new Clone(json_clone1, m, 0, c_attributes)
var c2 = new Clone(json_clone2, m, 1, c_attributes)
var c3 = new Clone(json_clone3, m, 2, c_attributes)
var c4 = new Clone(json_clone4, m, 3, c_attributes)
m.initClones()
assert.equal(c2.getSegLengthDoubleFeature('primer5','primer3'), "undefined", "C2 getSegLengthDoubleFeature('primer5','primer3')");
......@@ -537,9 +537,9 @@ QUnit.test("getLengthDoubleFeature", function(assert) {
QUnit.test("changealleleNotation", 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)
var c1 = new Clone(json_clone1, m, 0, c_attributes)
var c2 = new Clone(json_clone2, m, 1, c_attributes)
var c3 = new Clone(json_clone3, m, 2, c_attributes)
m.initClones()
m.changeAlleleNotation('always')
......@@ -554,9 +554,9 @@ QUnit.test("changealleleNotation", function(assert) {
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);
var c1 = new Clone(json_clone1, m, 0, c_attributes);
var c2 = new Clone(json_clone2, m, 1, c_attributes);
var c3 = new Clone(json_clone3, m, 2, c_attributes);
m.initClones();
assert.equal(c1.getProductivityName(), "productive", "clone 1 should be productive");
......@@ -579,3 +579,32 @@ QUnit.test("productivity", function(assert) {
assert.equal(c3.getPhase(), 'undefined', "No phase for clone 3");
});
QUnit.test("attributes", function(assert) {
var m = new Model();
m.parseJsonData(json_data);
var c1 = new Clone(json_clone1, m, 0, c_attributes);
var c2 = new Clone(json_clone2, m, 1, c_attributes);
var c3 = new Clone(json_clone3, m, 2, c_attributes);
m.initClones();
var clone;
clone = new Clone(json_clone1, m, 0, C_INTERACTABLE)
assert.equal(clone.isInteractable(), true, "clone should be seen as isInteractable");
assert.equal(clone.hasSizeOther(), false, "clone should NOT be seen as hasSizeOther");
clone = new Clone(json_clone1, m, 0, C_SIZE_OTHER)
assert.equal(clone.isInteractable(), false, "clone should NOT be seen as isInteractable");
assert.equal(clone.hasSizeOther(), true, "clone should be seen as hasSizeOther");
clone = new Clone(json_clone1, m, 0, C_INTERACTABLE | C_SIZE_OTHER)
assert.equal(clone.isInteractable(), true, "clone should NOT be seen as isInteractable");
assert.equal(clone.hasSizeOther(), true, "clone should be seen as hasSizeOther");
});
......@@ -108,6 +108,15 @@ QUnit.test("time control", function(assert) {
});