Commit b54073ef authored by Mathieu Giraud's avatar Mathieu Giraud

js/germline_axis.js, js/axes.js: use in GermlineAxis the same init() mechanism than in GenericAxis

See #2641.
parent 8512d50f
......@@ -42,7 +42,9 @@ Axes.prototype = {
"v": {
doc: "V gene (or 5' segment), gathering all alleles",
label:"V/5' gene",
axis: new GermlineAxis(this.m, false, true)
axis: new GermlineAxis(this.m, false, true,
"5", false),
fct: function(clone) {return clone.getGene("5", false)}
},
"d": {
doc: "D gene, gathering all alleles",
......@@ -54,17 +56,23 @@ Axes.prototype = {
"j": {
doc: "J gene (or 3' segment), gathering all alleles",
label:"J/3' gene",
axis: new GermlineAxis(this.m, false, true)
axis: new GermlineAxis(this.m, false, true,
"3", false),
fct: function(clone) {return clone.getGene("3", false)}
},
"allele_v": {
doc: "V gene (or 5' segment), with allele",
label:"V allele",
axis: new GermlineAxis(this.m, false, true)
axis: new GermlineAxis(this.m, false, true,
"5", true),
fct: function(clone) {return clone.getGene("5", true)}
},
"allele_j": {
doc: "J gene (or 3' segment), with allele",
label:"J allele",
axis: new GermlineAxis(this.m, false, true)
axis: new GermlineAxis(this.m, false, true,
"3", true),
fct: function(clone) {return clone.getGene("3", true)}
},
"consensusLength" : {
doc: "length of the consensus sequence",
......
......@@ -29,28 +29,32 @@
* @constructor
* @param {Model} model
* @reverse {boolean} reverse - by default axis go from low to high but can be revsersed
* @param {string} geneType - "5" or "3"
* @param {boolean} displayAllele - (show/hide allele)
* */
function GermlineAxis (model, reverse, can_undefined) {
function GermlineAxis (model, reverse, can_undefined,
geneType, displayAllele) {
this.m = model
this.labels = [];
this.label_mapping = {};
this.values = [];
this.value_mapping = {};
GenericAxis.call(this, reverse, can_undefined);
this.geneType = geneType
this.displayAllele = displayAllele
}
GermlineAxis.prototype = Object.create(GenericAxis.prototype);
/**
* init axis with a germline object
* @param {Germline} germline
* @param {string} genetype - "V" "D" or "J"
* @param {boolean} displayAllele - (show/hide allele)
* */
GermlineAxis.prototype.init = function (germline, geneType, displayAllele) {
GermlineAxis.prototype.init = function (values, fct) {
this.reset()
this.values = this.m.clones;
this.germline = germline;
this.converter = fct
this.values = values
this.germline = this.geneType == "5" ? this.m.germlineV : this.m.germlineJ
var gene_list = this.germline.gene
var allele_list = this.germline.allele
......@@ -63,7 +67,7 @@ GermlineAxis.prototype = Object.create(GenericAxis.prototype);
this.addLabel("line", key, pos, key, this.germline.gene[key].color);
}
if (displayAllele){
if (this.displayAllele){
for (var al in allele_list){
var gene = al.split("*")[0]
var allele = al.split("*")[1]
......@@ -83,7 +87,6 @@ GermlineAxis.prototype = Object.create(GenericAxis.prototype);
this.gene_list = gene_list;
this.allele_list = allele_list;
this.total_gene = total_gene;
this.displayAllele = displayAllele;
}
/**
......
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