Commit ee7e0c6d authored by Mikaël Salson's avatar Mikaël Salson

Merge branch...

Merge branch 'feature-c/3488-decalage-de-la-sequence-du-cdr3-et-de-la-jonction-dans-la-fenetre-info' into 'dev'

Resolve "Décalage de la séquence du CDR3 et de la jonction dans la fenêtre info"

Closes #3488

See merge request !471
parents e5952d44 ea52b71f
Pipeline #79826 passed with stages
in 8 minutes and 3 seconds
......@@ -234,6 +234,7 @@ Clone.prototype = {
/**
* Compute feature positions (start/stop) from its sequence, unless they are already present
* Computed positions are converted to start from 0 and can be used without manipualtions
*/
computeSegFeatureFromSeq: function(field_name)
{
......@@ -251,8 +252,8 @@ Clone.prototype = {
// No feature here
return;
this.seg[field_name].start = pos + 1
this.seg[field_name].stop = pos + seq.length
this.seg[field_name].start = pos
this.seg[field_name].stop = pos + seq.length -1
},
......@@ -273,7 +274,7 @@ Clone.prototype = {
getSegNtSequence: function(field_name) {
positions = this.getSegStartStop(field_name)
if (positions !== null) {
return this.sequence.substr(positions.start-1, positions.stop - positions.start+1)
return this.sequence.substr(positions.start, positions.stop - positions.start+1)
}
return '';
},
......@@ -311,6 +312,7 @@ Clone.prototype = {
/**
* Get the start and stop position of a given field (e.g. cdr3)
* Getted positions are 0 based.
* If it does not exist return null
*/
getSegStartStop: function(field_name) {
......
......@@ -15,7 +15,7 @@ QUnit.module("Clone", {
"3start" : 15,
"5" : {'start': 1, 'end': 5}, // 0-based (old format, with 'end')
"cdr3": {
"start": 11,
"start": 8,
"stop": 16,
"aa": "ABCDE"
},
......@@ -248,10 +248,10 @@ QUnit.test("name, informations, getHtmlInfo", function(assert) {
"getHtmlInfo: segmentation information (V gene) after changment");
// Test junction in html export
assert.includes(html, "<tr><td>junction</td><td colspan='4'>aat</td></tr>",
assert.includes(html, "<tr><td>junction</td><td colspan='4'>att</td></tr>",
"getHtmlInfo c1: junction info for productive clone");
html = c3.getHtmlInfo();
assert.includes(html, "<tr><td>junction</td><td colspan='4'>aaaaaaaaattt</td></tr>",
assert.includes(html, "<tr><td>junction</td><td colspan='4'>aaaaaaaatttt</td></tr>",
"getHtmlInfo c3: junction info for non productive clone");
assert.includes(html, "<tr><td>junction (AA seq)</td><td colspan='4'>WKIC</td></tr>",
"getHtmlInfo c3: junction (AAseq) info for non productive clone");
......@@ -272,10 +272,10 @@ QUnit.test('clone: get info from seg', function(assert) {
assert.notOk(c1.hasSeg('toto'), "clone1 doesn't have toto")
assert.notOk(c1.hasSeg('junction', 'toto'), "clone1 has junction but doesn't have toto")
assert.equal(c1.getSegLength('cdr3'), 6, "CDR3 length");
assert.equal(c1.getSegLength('cdr3'), 9, "CDR3 length");
assert.equal(c2.getSegLength('cdr3'), 'undefined', "no cdr3 in c2");
var pos_cdr3 = c1.getSegStartStop('cdr3')
assert.equal(pos_cdr3['start'], 10, "CDR3 length")
assert.equal(pos_cdr3['start'], 7, "CDR3 length")
assert.equal(pos_cdr3['stop'], 15, "CDR3 length")
assert.equal(c1.getSegStartStop('toto'), null, "no toto record")
var pos_junction = c3.getSegStartStop('junction')
......@@ -292,7 +292,8 @@ QUnit.test('clone: get info from seg', function(assert) {
c1.computeEValue()
assert.equal(c1.eValue, 1e-2, 'Recomputing e-value should not change its value')
assert.equal(c1.getSegNtSequence('junction'), 'aat', 'junction c1')
assert.equal(c1.getSegNtSequence('junction'), 'att', 'junction c1')
assert.equal(c1.getSegNtSequence('cdr3'), 'aaatttttt', 'sequence cdr3 c1 (by getSegNtSequence)')
assert.equal(c1.getSegAASequence('junction'), '', 'no AA junction for c1')
assert.equal(c1.getSegAASequence('cdr3'), 'ABCDE', 'AA CDR3 for c1')
......@@ -310,7 +311,7 @@ QUnit.test("clone : feature defined by a nucleotide sequence", function(assert)
assert.deepEqual(c3.getSegStartStop('somefeature'), null, "start/stop positions are not present")
c3.computeSegFeatureFromSeq('somefeature')
assert.deepEqual(c3.getSegStartStop('somefeature'), {"start": 7, "stop": 13}, "start/stop positions, computed from sequence")
assert.deepEqual(c3.getSegStartStop('somefeature'), {"start": 6, "stop": 12}, "start/stop positions, computed from sequence")
assert.equal(c3.getSegLength('somefeature'), 7, "length of the feature");
});
......@@ -439,7 +440,7 @@ QUnit.test("export", function(assert) {
"TRG", "-/-",
"undefined V", "IGHD2*03", "IGHV4*01",
"not productive",
"aaaaaaaaattt",
"aaaaaaaatttt",
"WKIC",
"AAAAAAAAAATTTTTTTTT",
10, 10, 15, 15,
......
......@@ -349,8 +349,8 @@ QUnit.test("model: primer detection", function(assert) {
// primer found inside clones
assert.equal(typeof m.clones[2]["seg"]["primer5"], "undefined", "Control neg primer 5 not in sequence")
assert.equal(typeof m.clones[2]["seg"]["primer3"], "undefined", "Control neg primer 3 not in sequence")
assert.deepEqual(m.clones[3]["seg"]["primer5"], { seq: "GGAAGGCCCCACAGCG", start: 1, stop: 16 }, "Found primer 5")
assert.deepEqual(m.clones[3]["seg"]["primer3"], { seq: "AACTTCGCCTGGTAA", start: 227, stop: 241 }, "Found primer 3")
assert.deepEqual(m.clones[3]["seg"]["primer5"], { seq: "GGAAGGCCCCACAGCG", start: 0, stop: 15 }, "Found primer 5")
assert.deepEqual(m.clones[3]["seg"]["primer3"], { seq: "AACTTCGCCTGGTAA", start: 226, stop: 240 }, "Found primer 3")
m.cleanPreviousFeature("primer3")
......
......@@ -111,8 +111,8 @@ QUnit.test("sequence", function(assert) {
assert.equal(h.stop, 6, '"f1" feature, stop')
h = seq1.get_positionned_highlight('f2', '')
assert.equal(h.start, 15, '"f2" feature, start')
assert.equal(h.stop, 20, '"f2" feature, stop')
assert.equal(h.start, 14, '"f2" feature, start')
assert.equal(h.stop, 19, '"f2" feature, stop')
segment.updateElemStyle([4]) /* Will remove sequence 4 from the segmenter
* as it is not really selected
......@@ -138,11 +138,11 @@ QUnit.test("segt", function (assert) {
assert.equal(m.clone(3).getSequence(),"GGAAGGCCCCACAGCGTCTTCTGTACTATGACGTCTCCACCGCAAGGGATGTGTTGGAATCAGGACTCAGTCCAGGAAAGTATTATACTCATACACCCAGGAGGTGGAGCTGGATATTGAGACTGCAAAATCTAATTGAAAATGATTCTGGGGTCTATTACTGTGCCACCTGGGACAGGCTGAAGGATTGGATCAAGACGTTTGCAAAAGGGACTAGGCTCATAGTAACTTCGCCTGGTAA","sequence")
m.clone(3).addSegFeatureFromSeq('test_feature','CACCCAGGAGGTGGAGCTGGATATTGAGACT');
f1 = segment.sequence[3].get_positionned_highlight('test_feature','');
assert.equal(f1.start, 94 , "feature start");
assert.equal(f1.stop, 124, "feature stop");
assert.equal(f1.start, 93 , "feature start");
assert.equal(f1.stop, 123, "feature stop");
assert.equal(f1.seq,'CACCCAGGAGGTGGAGCTGGATATTGAGACT', "feature sequence");
assert.equal(m.clone(3).getSegNtSequence("test_feature"), "CACCCAGGAGGTGGAGCTGGATATTGAGACT", "feature sequence 3");
assert.deepEqual(m.clone(3).getSegFeature("test_feature"),{"seq": "CACCCAGGAGGTGGAGCTGGATATTGAGACT", "start": 94, "stop": 124}, "feature sequence 4");
assert.deepEqual(m.clone(3).getSegFeature("test_feature"),{"seq": "CACCCAGGAGGTGGAGCTGGATATTGAGACT", "start": 93, "stop": 123}, "feature sequence 4");
// segment.sequence[3].computeAAseq()
// assert.equal(m.clone(3).getSegAASequence("cdr3"),"AKDILKSLKQQLATPNWFDP","feature sequence 2")
......@@ -156,7 +156,7 @@ QUnit.test("segt", function (assert) {
var h = segment.sequence[3].get_positionned_highlight('f1','');
assert.equal(h.start,-1, " start feature value");
assert.equal(h.stop, -1, "stop feature value");
assert.deepEqual(segment.sequence[3].get_positionned_highlight("test_feature",""),{"color": "", "css": "highlight_seq", "seq": "CACCCAGGAGGTGGAGCTGGATATTGAGACT", "start": 94, "stop": 124, "tooltip": ""}, "test feature value")
assert.deepEqual(segment.sequence[3].get_positionned_highlight("test_feature",""),{"color": "", "css": "highlight_seq", "seq": "CACCCAGGAGGTGGAGCTGGATATTGAGACT", "start": 93, "stop": 123, "tooltip": ""}, "test feature value")
assert.equal(m.clone(3).getSegLength('test_feature'),31, "feature length");
m.unselectAll();
assert.equal(segment.toFasta(), "");
......
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