From d9e4474edddcda243120cc252f3bbd4b94e93094 Mon Sep 17 00:00:00 2001 From: Mathieu Giraud Date: Thu, 23 Nov 2017 16:40:57 +0100 Subject: [PATCH 1/3] js/clone.js: remove dead code on .shortName This was never used, due to a always false condition in .getCode(). See #2892. --- browser/js/clone.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/browser/js/clone.js b/browser/js/clone.js index 822b6241f..23ea1bc4b 100644 --- a/browser/js/clone.js +++ b/browser/js/clone.js @@ -48,15 +48,7 @@ function Clone(data, model, index, virtual) { } this.seg = this.m.convertSeg(this.seg) - - if (typeof (this.getSequence()) != 'undefined' && typeof (this.name) != 'undefined') { - this.shortName = this.name.replace(new RegExp('IGHV', 'g'), "VH"); - this.shortName = this.shortName.replace(new RegExp('IGHD', 'g'), "DH"); - this.shortName = this.shortName.replace(new RegExp('IGHJ', 'g'), "JH"); - this.shortName = this.shortName.replace(new RegExp('TRG', 'g'), ""); - this.shortName = this.shortName.replace(new RegExp('\\*..', 'g'), ""); - } - + this.m.clusters[index]=[index] this.m.clones[index]=this this.tag = this.getTag(); -- GitLab From f0f8092dad9201ac4011c19d28626ddc526c66e3 Mon Sep 17 00:00:00 2001 From: Mathieu Giraud Date: Thu, 23 Nov 2017 16:48:00 +0100 Subject: [PATCH 2/3] js/clone.js: extract 'computeShortName' from 'getShortName' We do not want to re-compute the clone name at each update. Not directly related to #2892. --- browser/js/clone.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/browser/js/clone.js b/browser/js/clone.js index 23ea1bc4b..eb8decfdd 100644 --- a/browser/js/clone.js +++ b/browser/js/clone.js @@ -55,6 +55,8 @@ function Clone(data, model, index, virtual) { this.computeGCContent() this.computeCoverage() this.computeEValue() + + this.computeShortName() } function nullIfZero(x) { return (x === 0 || x === '0') ? '' : x } @@ -102,7 +104,12 @@ Clone.prototype = { return size; }, - getShortName: function () { + + /** + * Compute a .shortName from .getName() + */ + + computeShortName: function () { name_items = this.getName().split(' ') short_name_items = [] @@ -164,7 +171,11 @@ Clone.prototype = { short_name_items.push(s) } - return short_name_items.join(' ') + this.shortName = short_name_items.join(' ') + }, + + getShortName: function () { + return this.shortName }, /** -- GitLab From 80d43b36acb843e1f3ecf2d01513d852f61cc081 Mon Sep 17 00:00:00 2001 From: Mathieu Giraud Date: Fri, 24 Nov 2017 11:10:00 +0100 Subject: [PATCH 3/3] js/model.js: calls clone.computeShortName() when needed Not directly related to #2892. --- browser/js/model.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/browser/js/model.js b/browser/js/model.js index 3a489a768..b333bcccf 100644 --- a/browser/js/model.js +++ b/browser/js/model.js @@ -297,12 +297,18 @@ Model.prototype = { changeCloneNotation: function(cloneNotationType) { this.cloneNotationType = cloneNotationType; + + for (var i = 0; i < this.clones.length; i++) + this.clone(i).computeShortName() this.update(); }, changeAlleleNotation: function(alleleNotation) { this.alleleNotation = alleleNotation; + + for (var i = 0; i < this.clones.length; i++) + this.clone(i).computeShortName() this.update(); }, -- GitLab