Commit 50111d63 authored by Marc Duez's avatar Marc Duez
Browse files

segment.js : fin_subseq

-take a field name in input and output an object with the start/stop positions of the wanted element (cdr3/primer ...)
-the function will seek information about the sought element in the clone info (clone.xxx or clone.seg.xxx) and model(model.xxx) to compute the position
parent e7d6665c
......@@ -612,6 +612,37 @@ Sequence.prototype = {
return marge + result
},
find_subseq : function (field, color) {
var clone = this.m.clone(this.id);
var p;
console.log(field)
if (typeof clone[field] != 'undefined'){
p = clone[field]; //check clone meta-data
}else if (typeof clone[field] != 'undefined'){
p = clone.seg[field]; //check clone seg data
}else if (typeof this.m[field] != 'undefined'){
p = this.m[field]; //check model
}else{
return {'start' : -1, 'stop' : -1, 'color' : color};
}
console.log(p)
if (p.constructor === Array ){
p = p[this.m.t];
}
console.log(">>"+p)
if (p.constructor === String){
var start = this.pos[clone.sequence.indexOf(p)]
var stop = this.pos[clone.sequence.indexOf(p)+p.length]
return {'start' : start, 'stop' : stop, 'color' : color};
}else if (p.constructor === Object & typeof p.start != 'undefined'){
return {'start' : this.pos[p.start], 'stop' : this.pos[p.stop], 'color' : color};
}else{
return {'start' : -1, 'stop' : -1, 'color' : color};
}
}
}
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