Commit 283d6275 authored by Thonier Florian's avatar Thonier Florian
Browse files

clone; add a new axis segment ratio and his method inside clone.js

Return the percentage value of germline sequence covered by clonotype sequence
Exclusion of CDR3 junction deletion
parent 6b147952
Pipeline #739721 failed with stages
in 19 minutes and 28 seconds
......@@ -78,6 +78,9 @@ AXIS_SCATTERPLOT = ["V/5' gene",
"J/3' del'",
"V/5' length",
"J/3' length",
"V/5' ratio",
"D/4' ratio",
"J/3' ratio",
"[cloneDB] Hits (sample)",
"[cloneDB] Hits (set)",
"Main sample"
......@@ -196,6 +199,28 @@ AXIS_DEFAULT = {
sort : "alphanumerical",
autofill: false
},
"V/5' ratio": {
doc: "Proportion of V/5' germline sequence covered by clonotype sequencing (exclude CDR3 deletion)",
fct: function(clone) {
return clone.getGermlineRatio('5')
// var feature = clone.getSegFeature('5')
},
autofill: true
},
"D/4' ratio": {
doc: "Proportion of D/4' germline sequence covered by clonotype sequencing (exclude CDR3 deletion)",
fct: function(clone) {
return clone.getGermlineRatio('4')
},
autofill: true
},
"J/3' ratio": {
doc: "Proportion of J/3' germline sequence covered by clonotype sequencing (exclude CDR3 deletion)",
fct: function(clone) {
return clone.getGermlineRatio('3')
},
autofill: true
},
"Sequence length" : {
doc: "length of the consensus sequence of the clonotype",
fct: function(clone) {return clone.getSequenceLength()},
......
......@@ -1000,6 +1000,39 @@ Clone.prototype = {
return fasta
},
/**
* Return the percentage of germline gene covered by the segment
* TODO: See if we should take into account deletion and how. (my recommandation is to don't include deletion in value)
* TODO: controle case with up/down sequence ?
* @param {string} gene_way
* @returns undefined if not segment, percentage of covered sequence
*/
getGermlineRatio: function(gene_way) {
var gene = this.getGene(gene_way);
var germName = this.germline.substring(0, 3);
if (this.germline != undefined) {
seq_germ = this.m.findGermlineFromGene(gene)
seq_germ = (seq_germ != undefined) ? seq_germ.replaceAll(".","") : undefined
}
if (!this.hasSeg('3', '5')) {
return undefined
}
if (gene_way == "5") {
seq_clone = this.sequence.substring(this.seg['5'].start != undefined ? this.seg['5'].start : 0, this.seg['5'].stop+1)
seq_germ_length = seq_germ.length - this.seg['5'].delRight
} else if (gene_way == '4' && this.seg['4']){
seq_clone = this.sequence.substring(this.seg['4'].start, this.seg['4'].stop)
seq_germ_length = seq_germ.length - this.seg['4'].delLeft - this.seg['4'].delRight
} else if (gene_way == '3'){
seq_clone = this.sequence.substring(this.seg['3'].start, this.seg['3'].stop? this.seg['3'].stop+1 : this.sequence.length)
seq_germ_length = seq_germ.length - this.seg['3'].delLeft
}
return (seq_clone.length / seq_germ_length)*100
},
/**
* compute the clone size (**only the main sequence, without merging**) at a given time
* @param {integer} time - tracking point (default value : current tracking point)
......
Supports Markdown
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