Commit 8aab651c authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'feature-c/2876-export-align' into 'dev'

Export align in segmenter

See merge request !135
parents 9b086ba2 043cb97e
Pipeline #11585 passed with stages
in 19 seconds
......@@ -925,15 +925,18 @@ Segment.prototype = {
var result = "";
for (var i = 0; i < selected.length; i++) {
if (typeof this.m.clone(selected[i])!="undefined" && typeof (this.m.clone(selected[i]).sequence) != 'undefined' && this.m.clone(selected[i]).sequence !== 0 && this.m.clone(selected[i]).isSelected()){
result += "> " + this.m.clone(selected[i]).getName() + " // " + this.m.clone(selected[i]).getStrSize() + "\n";
result += this.m.clone(selected[i]).sequence + "\n";
if (typeof this.sequence[selected[i]] !== "undefined" &&
typeof this.sequence[selected[i]].seq !== "undefined") {
var seq = this.sequence[selected[i]];
if (seq.is_clone) {
result +="> " + this.m.clone(selected[i]).getName() + " // " + this.m.clone(selected[i]).getStrSize() + "\n";
} else {
result += "> " + selected[i];
}
result += this.sequence[selected[i]].seq.join('') + "\n";
}
else if(typeof this.germline[this.sequence[selected[i]].locus]!="undefined"){
result+= ">" + selected[i] + "\n" + this.germline[this.sequence[selected[i]].locus][selected[i]] + "\n";
}
}
return result
return result;
},
......@@ -1194,6 +1197,7 @@ function genSeq(id, locus, model, segmenter) {
this.pos = [];
this.locus = locus
this.use_marge = true;
this.is_clone = false;
}
genSeq.prototype= {
......@@ -1338,6 +1342,7 @@ function Sequence(id, model, segmenter) {
this.seq = [];
this.pos = [];
this.use_marge = true;
this.is_clone = true;
this.locus = this.m.clone(id).germline;
}
......
......@@ -100,8 +100,8 @@ QUnit.test("segt", function (assert) {
m.initClones();
var segment = new Segment("segment",m)
segment.init();
segment.addToSegmenter(3);
segment.addToSegmenter(1);
m.select(3);
m.select(1);
assert.equal(m.clone(3).getSequenceName(), "test4", "clone");
assert.equal(m.clone(3).getSequence(),"GGAAGGCCCCACAGCGTCTTCTGTACTATGACGTCTCCACCGCAAGGGATGTGTTGGAATCAGGACTCAGTCCAGGAAAGTATTATACTCATACACCCAGGAGGTGGAGCTGGATATTGAGACTGCAAAATCTAATTGAAAATGATTCTGGGGTCTATTACTGTGCCACCTGGGACAGGCTGAAGGATTGGATCAAGACGTTTGCAAAAGGGACTAGGCTCATAGTAACTTCGCCTGGTAA","sequence")
m.clone(3).addSegFeatureFromSeq('test_feature','CACCCAGGAGGTGGAGCTGGATATTGAGACT');
......@@ -117,6 +117,8 @@ QUnit.test("segt", function (assert) {
// assert.deepEqual(m.clone(3).getSegFeature("cdr3"),{"seq": "CACCCAGGAGGTGGAGCTGGATATTGAGACT", "start": 94, "stop": 124}, "feature sequence 4")
assert.notEqual(segment.sequence[3].toString(),"ATCCT", "unsegmented sequence");
assert.equal(segment.sequence[3].toString().indexOf(">cattcta<"),-1, "part of segmented seq");
assert.equal(segment.sequence[3].is_clone, true);
assert.equal(segment.sequence[1].is_clone, true);
var clone3 = m.clone(3);
assert.deepEqual(segment.sequence[3].getVdjStartEnd(clone3), {"3": {"start": 183,"stop": 241}, "4": {}, "4a": {}, "4b": {}, "5": {"start": 0, "stop": 179}}, "vdj start end");
var h = segment.sequence[3].get_positionned_highlight('f1','');
......@@ -125,7 +127,7 @@ QUnit.test("segt", function (assert) {
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.equal(m.clone(3).getSegLength('test_feature'),31, "feature length");
m.unselectAll();
segment.updateElem([])
assert.equal(segment.toFasta(), "");
m.select(3);
assert.equal(segment.toFasta(), "> test4 // 2.500%\nGGAAGGCCCCACAGCGTCTTCTGTACTATGACGTCTCCACCGCAAGGGATGTGTTGGAATCAGGACTCAGTCCAGGAAAGTATTATACTCATACACCCAGGAGGTGGAGCTGGATATTGAGACTGCAAAATCTAATTGAAAATGATTCTGGGGTCTATTACTGTGCCACCTGGGACAGGCTGAAGGATTGGATCAAGACGTTTGCAAAAGGGACTAGGCTCATAGTAACTTCGCCTGGTAA\n", "fasta seq ")
assert.ok(segment.isDNA('CACCCAGGAGGTGGAGCTGGATATTGAGACT'), "test dna")
......@@ -143,6 +145,7 @@ QUnit.test("segt", function (assert) {
segment.init();
segment.addGermlineToSegmenter("IGHD1-1*01","IGH");
assert.equal(segment.sequence["IGHD1-1*01"].seq.join(""), "GGGCGCCGGGGCAGATTCTGAACAGCCCCGAGTCACGGTGGGTACAACTGGAACGAC")
assert.equal(segment.sequence["IGHD1-1*01"].is_clone, false);
m.select(2)
segment.addToSegmenter(2);
segment.add_all_germline_to_segmenter();
......@@ -154,4 +157,5 @@ QUnit.test("segt", function (assert) {
segment.addSequenceTosegmenter("test","igh", "accccccgtgtagtagtcc")
assert.equal(segment.sequence["test"].seq.join(""),"accccccgtgtagtagtcc"," test sequence ")
})
\ No newline at end of file
assert.equal(segment.sequence["test"].is_clone, false);
})
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