Commit 8d2b1212 authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

merge -- smart name of clones, including sequences of short N regions

A nice feature by @aurelBZH: In the list of clones, the sequence of N regions
is displayed when they are short. This behaviour can be tuned in the 'settings' menu (#1765).
parents f509c115 b284bbfa
......@@ -185,12 +185,18 @@
</div>
<div class="menu_box">
point key</br>
sample key</br>
<div class="buttonSelector" onclick="m.changeTimeFormat('name', true)"><input type="radio" name="time" value="name" checked>name</input></div>
<div class="buttonSelector" onclick="m.changeTimeFormat('short_name', true)"><input type="radio" name="time" value="short_name" checked>name (short)</input></div>
<div class="buttonSelector" onclick="m.changeTimeFormat('sampling_date', true)"><input type="radio" name="time" value="sampling_date" >sampling date</input></div>
<div class="buttonSelector" onclick="m.changeTimeFormat('delta_date', true)"><input type="radio" name="time" value="delta_date">day after first sample</input></div>
</div>
<div class="menu_box">
N regions in clone names</br>
<div class="buttonSelector" onclick="m.changeCloneNotation('nucleotide_number', true)"><input type="radio" name="show_name" value="nucleotide_number">length</input></div>
<div class="buttonSelector" onclick="m.changeCloneNotation('short_sequence', true)"><input type="radio" name="show_name" value="short_sequence" checked>sequence (when short)</input></div>
<div class="buttonSelector" onclick="m.changeCloneNotation('full_sequence', true)"><input type="radio" name="show_name" value="full_sequence" >sequence (always)</input></div>
</div>
<!--
<div class="submenu" id="system_menu" style="display:none">
......
......@@ -120,7 +120,20 @@ Clone.prototype = {
z = s.match(this.REGEX_N);
if (z)
{
short_name_items.push(Math.abs(z[1]) + '/' + nullIfZero(z[2].length) + '/' + Math.abs(z[3]))
if (this.m.cloneNotationType == 'nucleotide_number'){
short_name_items.push(Math.abs(z[1]) + '/' + nullIfZero(z[2].length) + '/' + Math.abs(z[3]));
}
else if(this.m.cloneNotationType == 'short_sequence'){
if (z[2].length <= 6){
short_name_items.push(s);
} else{
short_name_items.push(Math.abs(z[1]) + '/' + nullIfZero(z[2].length) + '/' + Math.abs(z[3]));
}
}
else{
short_name_items.push(s);
}
continue
}
......
......@@ -165,7 +165,8 @@ Model.prototype = {
this.dataFileName = '';
this.analysisFileName = '';
this.db_key = "" //for file who came from the database
this.cloneNotationType="short_sequence";
this.norm = false;
this.normalization = {
"method" : "constant",
......@@ -275,6 +276,12 @@ Model.prototype = {
this.applyAnalysis(this.analysis);
this.initData();
}, //end initClones
changeCloneNotation: function(cloneNotationType) {
this.cloneNotationType = cloneNotationType;
this.update();
},
/**
* compute data_info who contain some meta-data for each "data"
......@@ -1879,7 +1886,7 @@ Model.prototype = {
this.notation_type = notation
if (update) this.update()
var radio = document.getElementsByName("notation");
var radio = document.getElementsByName("show_name");
for(var elem in radio){
if(radio[elem].value == notation) radio[elem].checked=true;
}
......
......@@ -25,7 +25,7 @@
}
}
var some_name = "IGHV3-23*01 6//4 IGHD1-1*01 5/CCCACGTGGGGG/4 IGHJ5*02"
var some_name = "IGHV3-23*01 6/ACGTG/4 IGHD1-1*01 5/CCCACGTGGGGG/4 IGHJ5*02"
var json_clone2 = {
"sequence" : "AACGTACCAGG",
......@@ -90,7 +90,7 @@ test("clone : name, informations, getHtmlInfo", function() {
equal(c2.getSequenceName(), some_name, "clone2, .getSequenceName()");
equal(c2.getCode(), some_name, "clone2, .getCode()");
equal(c2.getName(), some_name, "clone2, .getName()");
equal(c2.getShortName(), "IGHV3-23 6//4 D1-1 5/12/4 J5", "clone2, .getShortName()");
equal(c2.getShortName(), "IGHV3-23 6/5/4 D1-1 5/12/4 J5", "clone2, .getShortName()");
equal(c3.getSequenceName(), "custom name", "get name clone3 : custom name");
equal(c3.getCode(), "id3", "get code clone3 : id3");
......@@ -342,3 +342,19 @@ test("clone : changeLocus/Segment", function() {
// TODO tests : reads, system_available,
});
test("clone : changeNameNotation", function() {
var m = new Model();
m.parseJsonData(json_data)
var c1 = new Clone(json_clone1, m, 0)
var c2 = new Clone(json_clone2, m, 1)
var c3 = new Clone(json_clone3, m, 2)
m.initClones()
m.changeCloneNotation('short_sequence')
equal(c2.getShortName(), "IGHV3-23 6/ACGTG/4 D1-1 5/12/4 J5", "clone2, .getShortName()");
m.changeCloneNotation('full_sequence')
equal(c2.getShortName(), "IGHV3-23 6/ACGTG/4 D1-1 5/CCCACGTGGGGG/4 J5", "clone2, .getShortName()");
m.changeCloneNotation('nucleotide_number')
equal(c2.getShortName(), "IGHV3-23 6/5/4 D1-1 5/12/4 J5", "clone2, .getShortName()");
});
\ No newline at end of file
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