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)
......
This diff is collapsed.
......@@ -226,9 +226,19 @@ Segment.prototype = {
if (document.getElementById("seq" + list[i])) {
var spanF = document.getElementById("f" + list[i]);
this.div_elem(spanF, list[i]);
} else {
this.addToSegmenter(list[i]);
this.show();
}
} else {
if (document.getElementById("seq" + list[i])) {
var element = document.getElementById("seq" + list[i]);
element.parentNode.removeChild(element);
}
}
}
},
/* genere le code HTML des infos d'un clone
......
# coding: utf8
import gluon.contrib.simplejson
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
def index():
import gluon.contrib.simplejson
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
if not auth.user :
res = {"redirect" : "default/user/login"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -16,22 +14,11 @@ def index():
def add():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('add config'))
#TODO check data
def add_form():
import gluon.contrib.simplejson, shutil, os.path
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
error =""
if request.vars['config_name'] == "" :
......@@ -61,19 +48,11 @@ def add_form():
def edit():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('edit config'))
def edit_form():
import gluon.contrib.simplejson, shutil, os.path
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
import shutil, os.path
error =""
......@@ -103,18 +82,10 @@ def edit_form():
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def confirm():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('confirm config deletion'))
def delete():
import gluon.contrib.simplejson, shutil, os.path
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
import shutil, os.path
#delete data_file using this config
db(db.data_file.config_id==request.vars["id"]).delete()
......
......@@ -9,11 +9,13 @@
## - call exposes all registered services (none by default)
#########################################################################
import gluon.contrib.simplejson
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
def index():
"""
example action using the internationalization operator T and flash
......@@ -31,8 +33,6 @@ def help():
## add a scheduller task to run vidjil on a specific sequence file
def run_request():
import gluon.contrib.simplejson
error = ""
##TODO check
......@@ -40,7 +40,12 @@ def run_request():
error += "id sequence file needed, "
if not "config_id" in request.vars:
error += "id config needed, "
id_patient = db.sequence_file[request.vars["sequence_file_id"]].patient_id
if not auth.has_permission('admin', 'patient', id_patient) :
error += "you don't have permission to run request for this patient ("+str(id_patient)+")"
row2 = db( ( db.scheduler_task.args == '["'+request.vars["sequence_file_id"]+'", "'+request.vars["config_id"]+'"]' )
& ( db.scheduler_task.status != "FAILED" )
& ( db.scheduler_task.status != "EXPIRED" )
......@@ -68,7 +73,6 @@ def run_request():
)
## create or update fuse file state
id_patient = db.sequence_file[request.vars["sequence_file_id"]].patient_id
row = db( ( db.fused_file.config_id == request.vars["config_id"] ) &
( db.fused_file.patient_id == id_patient )
).select()
......@@ -90,14 +94,14 @@ def run_request():
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"success" : "false", "msg" : error}
res = {"success" : "false",
"message" : error}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def get_data():
import time
import gluon.contrib.simplejson
from subprocess import Popen, PIPE, STDOUT
error = ""
......@@ -106,7 +110,10 @@ def get_data():
error += "id patient file needed, "
if not "config_id" in request.vars:
error += "id config needed, "
if not auth.has_permission('admin', 'patient', request.vars["patient_id"]) and \
not auth.has_permission('read', 'patient', request.vars["patient_id"]):
error += "you don't have permission to consult this patient ("+id_patient+")"
query = db( ( db.fused_file.patient_id == request.vars["patient_id"] )
& ( db.fused_file.config_id == request.vars["config_id"] )
).select()
......@@ -126,8 +133,6 @@ def get_data():
def get_analysis():
import gluon.contrib.simplejson
error = ""
if not "patient_id" in request.vars :
......@@ -178,8 +183,6 @@ def get_analysis():
def save_analysis():
import gluon.contrib.simplejson
error = ""
if not "patient_id" in request.vars :
......@@ -220,7 +223,7 @@ def download():
allows downloading of uploaded files
http://..../[app]/default/download/[filename]
"""
return response.download(request, db)
return response.download(request, db, download_filename=request.vars.filename)
def call():
......@@ -272,7 +275,7 @@ def add_membership():
return dict(form=form)
def upload_file():
import gluon.contrib.simplejson, shutil, os.path
import shutil, os.path
try:
# Get the file from the form
......
# coding: utf8
import gluon.contrib.simplejson
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
def add():
import gluon.contrib.simplejson
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
if auth.has_permission('admin', 'patient', request.vars['id'], auth.user_id):
return dict(message=T('add file'))
else :
......@@ -15,12 +16,7 @@ def add():
#TODO check data
def add_form():
import gluon.contrib.simplejson, shutil, os.path, datetime
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
import shutil, os.path, datetime
error = ""
if request.vars['sampling_date'] != None :
......@@ -32,6 +28,9 @@ def add_form():
if error=="" :
id = db.sequence_file.insert(sampling_date=request.vars['sampling_date'],
info=request.vars['file_info'],
pcr=request.vars['pcr'],
sequencer=request.vars['sequencer'],
producer=request.vars['producer'],
patient_id=request.vars['patient_id'])
res = {"file_id" : id,
......@@ -47,21 +46,12 @@ def add_form():
def edit():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('edit file'))
#TODO check data
def edit_form():
import gluon.contrib.simplejson, shutil, os.path, datetime
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
import shutil, os.path, datetime
error = ""
if request.vars['id'] == None :
......@@ -70,29 +60,23 @@ def edit_form():
if error=="" :
mes = "file " + request.vars['id'] + " : "