Commit e2cb9928 authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/vidjil/vidjil into antonin-squash

Conflicts:
	browser/css/vidjil.less
	browser/index.html
	browser/js/model.js
	browser/js/scatterPlot.js
parents 55063d74 0ba5c684
......@@ -115,11 +115,14 @@ OnlineFasta::OnlineFasta(const OnlineFasta &of) {
OnlineFasta::~OnlineFasta() {
if (input_allocated)
delete input;
if (current.seq)
delete [] current.seq;
}
void OnlineFasta::init() {
line_nb = 0;
line = getInterestingLine();
current.seq = NULL;
}
size_t OnlineFasta::getLineNb() {
......@@ -142,7 +145,8 @@ void OnlineFasta::next() {
current.label.erase();
current.sequence.erase();
current.quality.erase();
current.seq = NULL;
if (current.seq)
delete [] current.seq;
if (hasNext()) {
switch(line[0]) {
......@@ -201,7 +205,8 @@ void OnlineFasta::next() {
case 'C': B = 1; break;
case 'G': B = 2; break;
case 'T': B = 3; break;
B = 4; break;
default:
B = 4; break;
}
current.seq[i] = B ;
}
......
......@@ -169,6 +169,7 @@ KmerSegmenter::KmerSegmenter(Sequence seq, IKmerStore<KmerAffect> *index,
info = "" ;
info_extra = "seed";
segmented = false;
reversed = false;
Dend=0;
int s = (size_t)index->getS() ;
......
#!/bin/bash
#!/usr/bin/env bash
if [ $# -eq 0 -o "$1" == "-h" -o "$1" == "--help" ]; then
echo "Usage: $0 <file.should_get>
......@@ -74,7 +74,7 @@ TMP_TAP_FILE=$(mktemp tap.XXXX)
{
nb_tests=0
# Count number of tests to be performed
nb_tests=`grep -Pc '^[^$#!]' $BASE`
nb_tests=`grep -Ec '^[^$#!]' $BASE`
echo "1.."$nb_tests
test_nb=1
......@@ -161,7 +161,7 @@ while read line; do
# Replace whitespaces if needed
if [ $IGNORE_WHITESPACES -ne 0 ]; then
pattern=$(sed -r 's/\s+/[[:space:]]+/g' <<< $pattern)
pattern=$(sed -r 's/[[:space:]]+/[[:space:]]+/g' <<< $pattern)
fi
debug "Grepping \"$pattern\" in $FILE_TO_GREP"
......
#!/bin/bash
#!/usr/bin/env bash
# This script also parse a file .should_get
# In the .should_get format, every line starting with a # is a comment
......
......@@ -614,7 +614,7 @@ span .substitution{
left :50%;
font-size: 13px;
padding: 10px;
background:inherit;
background:@background;
display:none;
}
......@@ -718,6 +718,7 @@ span .substitution{
margin-right:5px;
margin-left:5px;
min-width : 16px;
color: @default;
}
.button2 {
......@@ -877,7 +878,7 @@ span.logo
color: grey;
}
.selector, #list_menu, #top-container, .list_clones, .bot-bar, #bot-container, #popup-container, #file_menu, #tagSelector, .closeButton
.selector, #list_menu, #top-container, .list_clones, .bot-bar, #bot-container, #popup-container, #file_menu, #tagSelector, .closeButton, #analysis_menu
{
border-color: @border;
}
......@@ -1089,9 +1090,6 @@ span.logo
overflow-y: auto;
overflow-x: hidden;
max-height: 275px;
border: solid;
border-color: @border;
border-width: 1px;
position: relative;
}
......@@ -1169,3 +1167,8 @@ span.logo
select>option:hover {
background-color: @border;
}
.inactive {
opacity: 0.5;
}
......@@ -64,7 +64,6 @@
<body>
<div id="file_menu" >
<span class="closeButton" onclick="cancel();">X</span>
......@@ -98,19 +97,20 @@
<div class="menu" id="demo_file_menu" onmouseover="showSelector('demoSelector');"> file
<div id="demoSelector" class="selector"><div>
<a class="buttonSelector" onclick="javascript:loadData()">load data/analysis</a></br>
<!--<a class="buttonSelector" onclick="javascript:loadAnalysis()">load analysis</a> -->
<div class="menu_box">
<a class="buttonSelector" onclick="javascript:loadData()">Open </a>
<a class="buttonSelector" onclick="javascript:loadAnalysis()">Open analysis file</a>
</div>
<!--<a class="buttonSelector" onclick="javascript:m.resetAnalysis()">reset analysis</a> -->
<!--<a class="buttonSelector" onclick="javascript:reset()">reset all</a> -->
<div id="upload_list"></br>
<div class="menu_box">
<a class="buttonSelector" onclick="javascript:m.saveAnalysis()">Save analysis file</a>
<a class="buttonSelector" onclick="javascript:new PDF(m, 'visu2_svg')">Save pdf (graph + selected clones)</a>
</div>
<div class="menu_box">
<div id="upload_list">
</div>
</div>
</div></div>
</div>
<div class="menu" onmouseover="showSelector('loadSelector');"> export
<div id="loadSelector" class="selector"><div>
<a class="buttonSelector" onclick="javascript:m.saveAnalysis()">save analysis</a>
<a class="buttonSelector" onclick="javascript:new PDF(m, 'visu2_svg')">export pdf (graph + selected clones)</a>
</div></div>
</div>
......@@ -157,40 +157,37 @@
</div></div>
</div>
<div class="menu" id="display_menu" onmouseover="showSelector('displaySelector');"> display
<div id="displaySelector" class="selector"><div>
<div class="submenu">
<div class="menu_box">
tag visibility</br>
<ul>
</ul>
</div>
<div class="menu" onmouseover="showSelector('filterSelector');" > filter
<div id="filterSelector" class="selector"><div>
<div class="menu_box">
number of clones</br>
<input id="top_slider" type="range" min="5" max="100" step="5" value="10" onchange="m.displayTop(this.value)" />
</div>
<div class="menu_box">
tag visibility</br>
<ul id="tagList">
</ul>
</div>
</div></div>
</div>
<!--
<div class="submenu">
<div class="menu_box">
number of clones</br>
<input id="top_slider" type="range" min="5" max="100" step="5" value="10" onchange="m.displayTop(this.value)" />
</div>
<!--Slider for the variation of the epsilon parameter-->
<div class="menu_box">
<div id="DBSCANEpsSlider">
<input id="changeEps" type="range" min="0" max="40" step="1" value="0" onchange="m.changeEps(this.value)" />
</div>
</div>
<!--Slider for the variation of the min pts parameter-->
<div class="menu_box">
<div id="DBSCANNbrSlider">
<input id="changeNbr" type="range" min="0" max="100" step="1" value="0" onchange="m.changeNbr(this.value)" />
</div>
</div>
<!--Slider for the variation of the max distance-->
<div class="menu_box">
<div id="EditDistanceSlider">
</br>
......@@ -198,35 +195,36 @@
</div>
</div>
<div class="menu_box">
normalization (<span id="normalize_value"> </span>)</br>
<input id="normalize" type="checkbox" name="normalize" onclick="m.normalization_switch(this.checked);">
<span id="normalize_info"></span>
</div>
<div class="menu_box">
size display</br>
<input type="radio" name="notation" value="scientific" onchange="m.notation_switch()">scientific notation</input></br>
<input type="radio" name="notation" value="percent" onchange="m.notation_switch()" checked>percent</input>
</div>
-->
<div class="menu" onmouseover="showSelector('settingsSelector');" > settings
<div id="settingsSelector" class="selector"><div>
<div class="menu_box">
normalization (<span id="normalize_value"> </span>)</br>
<input id="normalize" type="checkbox" name="normalize" onclick="m.normalization_switch(this.checked);">
<span id="normalize_info"></span>
</div>
<div class="menu_box">
point key</br>
<input type="radio" name="time" value="name" onchange="m.time_switch()" checked>name</input>
<input type="radio" name="time" value="sampling_date" onchange="m.time_switch()">sampling date</input></br>
</div>
<div class="menu_box">
size display</br>
<input type="radio" name="notation" value="scientific" onchange="m.notation_switch()">scientific notation</input></br>
<input type="radio" name="notation" value="percent" onchange="m.notation_switch()" checked>percent</input>
</div>
<div class="menu_box">
point key</br>
<input type="radio" name="time" value="name" onchange="m.time_switch()" checked>name</input></br>
<input type="radio" name="time" value="sampling_date" onchange="m.time_switch()">sampling date</input>
</div>
<div class="submenu" id="system_menu" style="display:none">
<div class="menu_box">
germline (for color and scatterplot)</br>
<ul id="germline_list">
</ul>
</div>
</div>
</div></div>
</div>
......
......@@ -278,7 +278,7 @@ Builder.prototype = {
var self = this;
var displaySelector = document.getElementById("displaySelector")
var listTag = displaySelector.getElementsByTagName("ul")[0]
var listTag = document.getElementById("tagList")
var listGermline = document.getElementById("germline_list")
//reset
......
......@@ -38,11 +38,11 @@ Database.prototype = {
$.ajax({
type: "POST",
timeout: 1000,
crossDomain: true,
context: self, //we can't do closure with ajax event handler so we use context to keepref
url: url,
contentType: 'text/plain',
timeout: 1000,
xhrFields: {withCredentials: true},
success: function (result) {
self.display_result(result, url)
......@@ -431,6 +431,16 @@ Database.prototype = {
}, 5000);
},
user_rights: function (value, name, id) {
var arg = {}
arg.value = value
arg.name = name
arg.id = id
this.call('user/rights', arg)
}
}
......@@ -1460,7 +1460,7 @@ Model.prototype = {
this.addClonesSelected(cloneID);
}
}
this.updateElem([cloneID]);
this.updateElemStyle([cloneID]);
this.lastCloneSelected = cloneID;
this.updateElemStyle([cloneID]);
this.updateAlignmentButton();
......
......@@ -274,9 +274,9 @@ PDF.prototype = {
//clone reads (%)
var data = []
for (var i = 0; i < this.m.time.length; i++) {
data[i] = this.m.getSize(cloneID, i)
data[i] = this.m.getStrSize(cloneID, i)
}
this.row('', data, '%')
this.row('', data, 'raw')
this.next_row()
this.sequence(cloneID)
......
......@@ -955,354 +955,334 @@ ScatterPlot.prototype = {
},
/* Fonction permettant d'initialiser les grilles de répartition du ScatterPlot selon le modèle J
* */
initGridModelJ: function () {
//Initialisation des paramètres de l'objet concernant les positions des gènes/allèles J
this.gridModel["allele_j"] = [];
this.gridModel["gene_j"] = [];
//Obtention de toutes les clefs concernant les allèles et gènes J
var jKey = Object.keys(this.m.germline.j);
var jKey2 = Object.keys(this.m.germline.jgene);
//Initialisation d'un pas pour ?????
var stepJ = 1 / (jKey2.length + 1)
//Concerne toutes les allèles J -> Initialisation et calcul de position
for (var i = 0; i < jKey.length; i++) {
var elem = jKey[i].split('*');
/* Fonction permettant d'initialiser les grilles de répartition du ScatterPlot selon le modèle J
* */
initGridModelJ: function () {
var color = this.m.germline.j[jKey[i]].color;
var pos = (this.m.germline.j[jKey[i]].gene) * stepJ +
(this.m.germline.j[jKey[i]].allele + 0.5) * (stepJ / (this.m.germline.jgene[elem[0]].n));
var pos2 = (this.m.germline.j[jKey[i]].gene + 0.5) * stepJ;
//Initialisation des paramètres de l'objet concernant les positions des gènes/allèles J
this.gridModel["allele_j"] = [];
this.gridModel["gene_j"] = [];
this.gridModel["allele_j"].push(this.makeLineModel("subline", pos, "*" + elem[1], color));
//Obtention de toutes les clefs concernant les allèles et gènes J
var jKey = Object.keys(this.m.germline.j);
var jKey2 = Object.keys(this.m.germline.jgene);
//Initialisation d'un pas pour ?????
var stepJ = 1 / (jKey2.length + 1)
this.positionAllele[jKey[i]] = pos;
this.positionGene[jKey[i]] = pos2;
//Concerne toutes les allèles J -> Initialisation et calcul de position
for (var i = 0; i < jKey.length; i++) {
}
var elem = jKey[i].split('*');
//Concerne tous les gènes J -> Initialisation et calcul de position
for (var i = 0; i < jKey2.length; i++) {
var color = this.m.germline.j[jKey[i]].color;
var pos = (this.m.germline.j[jKey[i]].gene) * stepJ +
(this.m.germline.j[jKey[i]].allele + 0.5) * (stepJ / (this.m.germline.jgene[elem[0]].n));
var pos2 = (this.m.germline.j[jKey[i]].gene + 0.5) * stepJ;
var pos = (i + 0.5) * stepJ
var color = this.m.germline.jgene[jKey2[i]].color;
this.gridModel["allele_j"].push(this.makeLineModel("subline", pos, "*" + elem[1], color));
this.gridModel["allele_j"].push(this.makeLineModel("line", pos, jKey2[i], color));
this.gridModel["gene_j"].push(this.makeLineModel("line", pos, jKey2[i], color));
}
this.positionAllele[jKey[i]] = pos;
this.positionGene[jKey[i]] = pos2;
//Gestion de toutes les positions non-définies pour les allèles ou gènes J
var pos = (jKey2.length + 0.5) * stepJ;
this.gridModel["allele_j"].push(this.makeLineModel("line", pos, "?", color));
this.gridModel["gene_j"].push(this.makeLineModel("line", pos, "?", color));
}
this.positionGene["undefined J"] = pos
this.positionAllele["undefined J"] = pos
//Concerne tous les gènes J -> Initialisation et calcul de position
for (var i = 0; i < jKey2.length; i++) {
},
var pos = (i + 0.5) * stepJ
var color = this.m.germline.jgene[jKey2[i]].color;
/* Fonction permettant d'initialiser la taille de la grille, définie selon le modèle
* */
initGridModelSize: function () {
//Déclaration
this.gridModel["Size"] = [];
//Calcul initial
this.sizeScale = d3.scale.log()
.domain([this.m.min_size, 1])
.range([1, 0]);
var height = 1;
//Calcul selon les précisions et le modèle
for (var i = 0; i < this.max_precision; i++) {
var pos = this.sizeScale(height);
var text = this.m.formatSize(height, false)
this.gridModel["Size"].push(this.makeLineModel("line", pos, text));
height = height / 10;
}
},
this.gridModel["allele_j"].push(this.makeLineModel("line", pos, jKey2[i], color));
this.gridModel["gene_j"].push(this.makeLineModel("line", pos, jKey2[i], color));
}
//Fonction permettant d'initialiser la grille de répartition du ScatterPlot selon la répartition n ?????
initGridModelN: function () {
this.gridModel["n"] = [];
//Gestion de toutes les positions non-définies pour les allèles ou gènes J
var pos = (jKey2.length + 0.5) * stepJ;
for (var i = 0; i <= (Math.floor(this.m.n_max / 5)); i++) {
var pos = (1 - ((i * 5) / this.m.n_max));
this.gridModel["n"].push(this.makeLineModel("line", pos, i * 5));
}
},
this.gridModel["allele_j"].push(this.makeLineModel("line", pos, "?", color));
this.gridModel["gene_j"].push(this.makeLineModel("line", pos, "?", color));
//Fonction permettant d'initialiser le 'bar' de la grille
initGridModelBar: function () {
this.gridModel["bar"] = [];
this.positionGene["undefined J"] = pos
this.positionAllele["undefined J"] = pos
for (var i = 0; i < 20; i++) {
var d = {};
d.type = "line";
d.value = i * 5;
this.gridModel["bar"].push(d);
}
},
//Function which allows to initialize the grid, with regards to the Edit Distance visualization
initGridModelEditDistance: function() {
//No X/Y axis
this.axis_x_update([]);
this.axis_y_update([]);
//X/Y axis legends = "graph" (see graph_menu object, in the scatterPlot class)
this.splitX = "graph";
this.splitY = "graph";
},
},
/* Function which allows to add a stroke attribute to all edges
*/
addColor: function() {
this.edgeContainer
.style("stroke", function(d) {return d.color;});
},
/* Fonction permettant d'initialiser la taille de la grille, définie selon le modèle
* */
initGridModelSize: function () {
//Déclaration
this.gridModel["Size"] = [];
//Calcul initial
this.sizeScale = d3.scale.log()
.domain([this.m.min_size, 1])
.range([1, 0]);
var height = 1;
//Calcul selon les précisions et le modèle
for (var i = 0; i < this.max_precision; i++) {
var pos = this.sizeScale(height);
var text = this.m.formatSize(height, false)
this.gridModel["Size"].push(this.makeLineModel("line", pos, text));
height = height / 10;
}
/*Function which permits to compute and add edges positions, according to source and target nodes
*/
addPosition: function() {
var self = this;
//self.marge = margin top and left given in the scatterPlot
this.edgeContainer
//Awarding of the source position
.attr("x1", function(d) {return (d.source.px + self.marge_left);})
.attr("y1", function(d) {return (d.source.py + self.marge_top);})
//Awarding of the target position
.attr("x2", function(d) {return (d.target.px + self.marge_left);})
.attr("y2", function(d) {return (d.target.py + self.marge_top);});
},
},
/* Function which allows to compute a frame
* */
tick: function () {
self = this;
//Fonction permettant d'initialiser la grille de répartition du ScatterPlot selon la répartition n ?????
initGridModelN: function () {
this.gridModel["n"] = [];
var active_node = this.node.select(function(d, i) { return d.r!=0 ? this : null; });
for (var i = 0; i <= (Math.floor(this.m.n_max / 5)); i++) {
var pos = (1 - ((i * 5) / this.m.n_max));
this.gridModel["n"].push(this.makeLineModel("line", pos, i * 5));
}
},
//Update radius
this.node.each(this.updateRadius());
//Fonction permettant d'initialiser le 'bar' de la grille
initGridModelBar: function () {
this.gridModel["bar"] = [];
active_node.each(this.debugNaN())
for (var i = 0; i < 20; i++) {
var d = {};
d.type = "line";
d.value = i * 5;
this.gridModel["bar"].push(d);
}
},
//Function which allows to initialize the grid, with regards to the Edit Distance visualization
initGridModelEditDistance: function() {
//No X/Y axis
this.axis_x_update([]);
this.axis_y_update([]);
//X/Y axis legends = "graph" (see graph_menu object, in the scatterPlot class)
this.splitX = "graph";
this.splitY = "graph";
},
//move node in the direction of his objective
active_node.each(this.move());
/* Function which allows to add a stroke attribute to all edges
*/
addColor: function() {
this.edgeContainer
.style("stroke", function(d) {return d.color;});
},
//collisions resolution
var quad = d3.geom.quadtree(this.nodes)
/*Function which permits to compute and add edges positions, according to source and target nodes
*/
addPosition: function() {
var self = this;
//self.marge = margin top and left given in the scatterPlot
this.edgeContainer
//Awarding of the source position
.attr("x1", function(d) {return (d.source.px + self.marge_left);})
.attr("y1", function(d) {return (d.source.py + self.marge_top);})
//Awarding of the target position
.attr("x2", function(d) {return (d.target.px + self.marge_left);})
.attr("y2", function(d) {return (d.target.py + self.marge_top);});
},
for (var i=0; i<this.nodes.length; i++) {
if (this.nodes[i].r1 !=0){
quad.visit(this.collide2(this.nodes[i]));
}
}
active_node.each(this.debugNaN());
//move all no-clustering nodes in the direction of his initial place
if (self.dbscanActive && (!this.active_move)) self.forceNodesToStayInInitialPosition();
active_node
//Give new positions/sizes
.attr("cx", function (d) {
return (d.x + self.marge_left);