Commit f6a2caf3 authored by HERBERT Ryan's avatar HERBERT Ryan

*.js Applying new seg format

the format of seg is being changed to align all elements to the same
standard. Each element will now fall in line with the standard defined
for cdr3 and junction.
parent 1873ea70
......@@ -101,10 +101,11 @@ Axis.prototype = {
var clone = self.m.clone(cloneID)
if (typeof clone.seg != "undefined"
&& typeof clone.seg[type2] != "undefined"
&& typeof gene_list[clone.seg[type2].split("*")[0]] != "undefined")
&& typeof clone.seg[type2]["name"] != 'undefined'
&& typeof gene_list[clone.seg[type2]["name"].split("*")[0]] != "undefined")
{
var allele = clone.seg[type2]
var gene = clone.seg[type2].split("*")[0]
var allele = clone.seg[type2]["name"]
var gene = clone.seg[type2]["name"].split("*")[0]
var pos = ((gene_list[gene].rank+0.5)/(total_gene+1))
if (displayAllele){
......
......@@ -484,11 +484,11 @@ Clone.prototype = {
getGene: function (type, withAllele) {
withAllele = typeof withAllele !== 'undefined' ? withAllele : true;
if (typeof (this.seg) != 'undefined' && typeof (this.seg[type]) != 'undefined') {
if (typeof (this.seg) != 'undefined' && typeof (this.seg[type]) != 'undefined' && typeof this.seg[type]["name"] != 'undefined') {
if (withAllele) {
return this.seg[type];
return this.seg[type]["name"];
}else{
return this.seg[type].split('*')[0];
return this.seg[type]["name"].split('*')[0];
}
}
switch (type) {
......@@ -503,8 +503,8 @@ Clone.prototype = {
},
getNlength: function () {
if (typeof this.seg != 'undefined' && typeof this.seg['3start'] != 'undefined'){
return this.seg['3start']-this.seg['5end']-1
if (typeof this.seg != 'undefined' && typeof this.seg['3'] != 'undefined' && typeof this.seg['5'] != 'undefined'){
return this.seg['3']['start']-this.seg['5']['stop']-1
}else{
return 'undefined'
}
......@@ -539,18 +539,18 @@ Clone.prototype = {
},
getPrintableSegSequence: function () {
if (typeof this.seg == 'undefined' || typeof this.seg['5end'] == 'undefined' || typeof this.seg['3start'] == 'undefined') {
if (typeof this.seg == 'undefined' || typeof this.seg['5'] == 'undefined' || typeof this.seg['3'] == 'undefined') {
return this.getSequence()
}
var s = ''
s += this.sequence.substring(0, this.seg['5end'])
s += this.sequence.substring(0, this.seg['5']['stop'])
s += '\n'
if (this.seg['5end'] < this.seg['3start'] - 1) {
s += this.sequence.substring(this.seg['5end'], this.seg['3start'] - 1)
if (this.seg['5']['stop'] < this.seg['3']['start'] - 1) {
s += this.sequence.substring(this.seg['5']['stop'], this.seg['3']['start'] - 1)
s += '\n'
}
s += this.sequence.substring(this.seg['3start'] - 1)
s += this.sequence.substring(this.seg['3']['start'] - 1)
return s
},
......@@ -780,9 +780,15 @@ Clone.prototype = {
*/
changeSegment: function (formValue, segment) {
// TODO add chgmt of germline in data analysis
this.seg[segment] = formValue
this.seg[segment+"start"] = 0
this.seg[segment+"end"] = 0
delete this.seg[segment];
delete this.seg[segment+"start"]
delete this.seg[segment+"end"]
this.seg[segment] = {}
this.seg[segment]["name"] = formValue
this.seg[segment]["start"] = 0
this.seg[segment]["stop"] = 0
// TODO : insert real value for stats (start, end, evalue, ...)
this.seg["_evalue"] = 0
......@@ -933,7 +939,7 @@ Clone.prototype = {
html += "<tr><td> J gene (or 3') </td><td colspan='" + time_length + "'>" + this.getGene("3") + "<div class='div-menu-selector' id='listJsegment' style='display: none'>" + this.createSegmentList("Jsegment") + "</div></td></tr>"
// Other seg info
var exclude_seg_info = ['affectSigns', 'affectValues']
var exclude_seg_info = ['affectSigns', 'affectValues', '5', '4', '3']
for (var key in this.seg) {
if (exclude_seg_info.indexOf(key) == -1 && this.seg[key] instanceof Object) {
var nt_seq = this.getSegNtSequence(key);
......
......@@ -541,15 +541,15 @@ Report.prototype = {
if (typeof this.m.clone(cloneID).seg != 'undefined'){
var seg = this.m.clone(cloneID).seg
var seq = this.m.clone(cloneID).getSequence()
var seqV = seq.substring(0, seg['5end'] + 1)
var seqN = seq.substring(seg['5end'] + 1, seg['3start'])
var seqJ = seq.substring(seg['3start'])
var seqV = seq.substring(0, seg['5']['stop'] + 1)
var seqN = seq.substring(seg['5']['stop'] + 1, seg['3']['start'])
var seqJ = seq.substring(seg['3']['start'])
$('<span/>', {'class': 'v_gene', 'text': seqV}).appendTo(sequence);
if (this.m.clone(cloneID).getGene("4") != "undefined D"){
var seqN1 = seq.substring(seg['5end'] + 1, seg['4start'])
var seqD = seq.substring(seg['4start'] , seg['4end'] + 1)
var seqN2 = seq.substring(seg['4end'] + 1, seg['3start'])
var seqN1 = seq.substring(seg['5']['stop'] + 1, seg['4']['start'])
var seqD = seq.substring(seg['4']['start'] , seg['4']['stop'] + 1)
var seqN2 = seq.substring(seg['4']['stop'] + 1, seg['3'['start']])
$('<span/>', {'class': 'n_gene', 'text': seqN1}).appendTo(sequence);
$('<span/>', {'class': 'd_gene', 'text': seqD}).appendTo(sequence);
$('<span/>', {'class': 'n_gene', 'text': seqN2}).appendTo(sequence);
......
......@@ -179,9 +179,10 @@ Germline.prototype = {
var g = {}
for (var i=0; i<this.m.clones.length; i++){
if (typeof this.m.clone(i).seg != "undefined" &&
typeof this.m.clone(i).seg[type2] != "undefined" &&
typeof this.m.clone(i).seg[type2] != "undefined"
){
var gene=this.m.clone(i).seg[type2];
var gene=this.m.clone(i).seg[type2]["name"];
if (this.m.system != "multi" || this.m.clone(i).get('germline') == system){
if ( typeof this.allele[gene] != "undefined"){
g[gene] = this.allele[gene]
......
......@@ -258,6 +258,7 @@ Model.prototype = {
var clone = this.clone(i)
clone.colorN = colorGenerator((((clone.getNlength() / n_max) - 1) * (-250)));
clone.tag = this.default_tag;
clone.seg = this.convertSeg(clone.seg);
}
this.applyAnalysis(this.analysis);
......
......@@ -1075,16 +1075,16 @@ Sequence.prototype = {
var vdjArrayRev = {};
// We first put the end positions
vdjArrayRev[vdjArray["5end"]] = {'type':'N', 'color': ""};
vdjArrayRev[vdjArray["3end"]] = {'type':'N', 'color': ""};
if (typeof vdjArray["4start"]!= 'undefined' && typeof clone.seg["4end"] != 'undefined'){
vdjArrayRev[vdjArray["4end"]] = {'type':'N', 'color': ""};
vdjArrayRev[vdjArray["5"]['stop']] = {'type':'N', 'color': ""};
vdjArrayRev[vdjArray["3"]['start']] = {'type':'N', 'color': ""};
if (typeof vdjArray["4"] != 'undefined' && typeof vdjArray["4"]['start']!= 'undefined' && typeof clone.seg["4"]['stop'] != 'undefined'){
vdjArrayRev[vdjArray["4"]['stop']] = {'type':'N', 'color': ""};
// We now put the start positions (that may override previous end positions)
vdjArrayRev[vdjArray["4start"]] = {'type':'D', 'color': ""};
vdjArrayRev[vdjArray["4"]['start']] = {'type':'D', 'color': ""};
}
vdjArrayRev[vdjArray["5start"]] = {'type':'V', 'color': this.m.colorMethod == "V" ? clone.colorV : ""};
vdjArrayRev[vdjArray["3start"]] = {'type':'J', 'color': this.m.colorMethod == "J" ? clone.colorJ : ""};
vdjArrayRev[vdjArray["5"]['start']] = {'type':'V', 'color': this.m.colorMethod == "V" ? clone.colorV : ""};
vdjArrayRev[vdjArray["3"]['start']] = {'type':'J', 'color': this.m.colorMethod == "J" ? clone.colorJ : ""};
}
var window_start = this.pos[clone.sequence.indexOf(clone.id)];
......@@ -1176,14 +1176,15 @@ Sequence.prototype = {
*/
getVdjStartEnd: function (clone) {
var vdjArray ={} ;
vdjArray["5start"] = 0;
vdjArray["5end"] = this.pos[clone.seg["5end"]] + 1;
vdjArray["3start"] = this.pos[clone.seg["3start"]];
vdjArray["3end"] = this.seq.length;
if (typeof clone.seg["4start"] != 'undefined' && typeof clone.seg["4end"] != 'undefined') {
vdjArray["4start"] = this.pos[clone.seg["4start"]];
vdjArray["4end"] = this.pos[clone.seg["4end"]] + 1
var vdjArray ={"5": {}, "3": {}} ;
vdjArray["5"]["start"] = 0;
vdjArray["5"]["stop"] = this.pos[clone.seg["5"]["stop"]] + 1;
vdjArray["3"]["start"] = this.pos[clone.seg["3"]["start"]];
vdjArray["3"]["stop"] = this.seq.length;
if (typeof clone.seg["4"] != 'undefined' && typeof clone.seg["4"]["start"] != 'undefined' && typeof clone.seg["4"]["stop"] != 'undefined') {
vdjArray["4"] = {}
vdjArray["4"]["start"] = this.pos[clone.seg["4"]["start"]];
vdjArray["4"]["stop"] = this.pos[clone.seg["4"]["stop"]] + 1
}
return vdjArray;
},
......
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