Commit 5993d6b6 authored by Thonier Florian's avatar Thonier Florian
Browse files

numerical_axis.js : add unit tests on position of labels.

parent 306940db
......@@ -92,8 +92,27 @@ QUnit.test("axis", function(assert) {
assert.equal(axis.pos(m.clone(0)).pos.toPrecision(3), 0.00, "custom : clone 0 (nlength = 0) position -> 0.00")
assert.equal(axis.pos(m.clone(1)).pos.toPrecision(3), 0.257, "custom : clone 1 (nlength = 9) position -> 0.30")
//sequenceLength
axis = new NumericalAxis(m)
axis.init(m.clones,
function(clone) {
return clone.getSequenceLength();
},
undefined,
false)
assert.equal(axis.pos(m.clone(0)).pos.toPrecision(3), 0.0325, "custom 2 : clone 0 (sequenceLength = 21) position -> 0.0325")
assert.equal(axis.pos(m.clone(1)).pos.toPrecision(3), 0.0236, "custom 2 : clone 1 (sequenceLength = 18) position -> 0.0236")
assert.equal(axis.pos(m.clone(3)).pos.toPrecision(3), 0.683, "custom 2 : clone 3 (sequenceLength = 241) position -> 0.683")
assert.equal(axis.label_mapping.hasOwnProperty('0'), false, "axis have not label 0")
assert.equal(axis.label_mapping.hasOwnProperty('10'), true, "axis have label 10")
assert.equal(axis.label_mapping.hasOwnProperty('281'), true, "axis have label 281")
assert.equal(axis.label_mapping['10'].pos.toPrecision(3), 0, "pos of axis.label 10 is 0")
assert.equal(axis.label_mapping['281'].pos.toPrecision(3), 0.8000, "pos of axis.label 281 is 0.8")
assert.equal(axis.labels[0].pos, 1, "pos of axis label 0 ('?' value) is 1")
assert.notEqual(axis.labels[axis.labels.length-1-1].pos, 1, "pos of last axis label is not 1")
//gc
axis = new PercentAxis(m, false, false);
axis.init(m.clones, 'GCContent', undefined, false, 0, 1)
......
......@@ -50,7 +50,13 @@ json_data = {
"3start" : 6,
"5end" : 5,
"cdr3" : {"start": 5, "stop": 6, aa: "AG"}
}
},
"_average_read_length": [
21
],
"_coverage": [
1
]
},
{
"sequence" : "cccccgtcccccccatca",
......@@ -65,7 +71,13 @@ json_data = {
"3start" : 15,
"5end" : 5,
"fr1" : {"start" :2, "stop":5}
}
},
"_average_read_length": [
18
],
"_coverage": [
1
]
},
{
"sequence" : "cccccccccccccccccccc",
......@@ -80,7 +92,13 @@ json_data = {
"3" : "IGHJ6*01",
"3start" : 15,
"5end" : 5
}
},
"_average_read_length": [
20
],
"_coverage": [
1
]
},
{
"id": "id4",
......@@ -184,7 +202,13 @@ json_data = {
"JUNCTION (AA)": "CATWDRLKDWIKTF",
"JUNCTION (AA) (with frameshift)": ""
},
}
},
"_average_read_length": [
241
],
"_coverage": [
1
]
},
{
"sequence" : "catcatcatgatgctacgatcttac",
......@@ -197,7 +221,10 @@ json_data = {
"seg" : {
"f1" : {"start": 4, "stop": 7},
"f2" : {"seq": "tacgat"}, // 15 -> 20
}
},
"_average_read_length": [
undefined
],
}
]
};
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