Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit 0c3fab65 authored by Marc Duez's avatar Marc Duez
Browse files

Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/vidjil/vidjil into rbx.vidjil.org

parents 6be0668b 4638ce02
......@@ -364,54 +364,85 @@ Model.prototype = {
for (var key in tmp) {
self.dataCluster.push(tmp[key])
}
// DATA CLUSTER
this.dataCluster.sort(function (a, b) {
return b.cluster[0] - a.cluster[0]
})
for (var i = 0; i < this.dataCluster.length; i++) {
var new_cluster = [];
for (var j = 0; j < this.dataCluster[i].cluster.length; j++) {
new_cluster = new_cluster.concat(this.clones[this.dataCluster[i].cluster[j]].cluster);
this.clones[this.dataCluster[i].cluster[j]].cluster = []
}
this.clones[this.dataCluster[i].cluster[0]].cluster = new_cluster
this.clones[this.dataCluster[i].cluster[0]].name = this.dataCluster[i].name
}
}
return this
},
//temporary keep old parser to make the transition with new '2014.09' version
parseJsonAnalysis: function (analysis) {
var self = this
this.analysis = JSON.parse(analysis);
//samples
var match = 0;
if (self.analysis.samples) {
var s = self.analysis.samples
for (var i=0; i<s.number; i++){
var pos = self.samples.original_names.indexOf(s.original_names[i])
if (pos != -1){
if (s.names[i] != "") self.samples.names[pos] = s.names[i]
match++
if (typeof self.analysis.vidjil_json_version != 'undefined' && self.analysis.vidjil_json_version == "2014.09"){
//samples
var match = 0;
if (self.analysis.samples) {
var s = self.analysis.samples
for (var i=0; i<s.number; i++){
var pos = self.samples.original_names.indexOf(s.original_names[i])
if (pos != -1){
if (s.names[i] != "") self.samples.names[pos] = s.names[i]
match++
}
}
if (match == s.number && match == self.samples.number) self.samples.order = s.order
self.t = self.samples.order[0]
}
if (match == s.number && match == self.samples.number) self.samples.order = s.order
}
//tags
if (self.analysis.tags) {
var s = self.analysis.tags
var keys = Object.keys(s.names);
for (var i=0; i<keys.length; i++){
tagName[parseInt(keys[i])] = s.names[keys[i]]
//tags
if (self.analysis.tags) {
var s = self.analysis.tags
var keys = Object.keys(s.names);
for (var i=0; i<keys.length; i++){
tagName[parseInt(keys[i])] = s.names[keys[i]]
}
for (var i=0; i<s.hide.length; i++){
tagDisplay[s.hide[i]] = 0;
}
}
for (var i=0; i<s.hide.length; i++){
tagDisplay[s.hide[i]] = 0;
if (self.analysis.timestamp2) {
self.timestamp2 = self.analysis.timestamp2;
}
if (self.analysis.patient) {
self.dataFileName = self.analysis.patient;
}
self.initClones();
}else{
//myConsole.flash("invalid json version for analysis file")
//parse old json file temporary
if (self.analysis.time && (self.analysis.time.length == self.samples.names.length)) {
self.samples.names = self.analysis.time;
self.samples.order = self.analysis.time_order;
self.t = self.samples.order[0]
}
if (self.analysis.patient) {
self.dataFileName = self.analysis.patient;
}
self.initClones();
}
if (self.analysis.timestamp2) {
self.timestamp2 = self.analysis.timestamp2;
}
if (self.analysis.patient) {
self.dataFileName = self.analysis.patient;
}
self.initClones();
},
......@@ -719,92 +750,133 @@ Model.prototype = {
*
* */
applyAnalysis: function (analysis) {
var c = analysis.clones
// CUSTOM TAG / NAME
// EXPECTED VALUE
var max = {"id" : -1 , "size" : 0 } //store biggest expected value ( will be used for normalization)
for (var i = 0; i < c.length; i++) {
if (this.analysis.vidjil_json_version != 'undefined' && this.analysis.vidjil_json_version == VIDJIL_JSON_VERSION){
var c = analysis.clones
var id = -1
var f = 1;
//check if we have a clone with a similar window
if (typeof c[i].id != "undefined" && typeof this.mapID[c[i].id] != "undefined") {
id = this.mapID[c[i].id]
}
//check if we have a window who can match the sequence
if (typeof c[i].sequence != "undefined" && id == -1) {
id = this.findWindow(c[i].sequence);
}
if (id != -1){
if (typeof c[i].expected != "undefined") {
this.windows[id].expected = c[i].expected
f = this.getSize(id) / c[i].expected;
if (f < 100 && f > 0.01) {
// CUSTOM TAG / NAME
// EXPECTED VALUE
var max = {"id" : -1 , "size" : 0 } //store biggest expected value ( will be used for normalization)
for (var i = 0; i < c.length; i++) {
var id = -1
var f = 1;
//check if we have a clone with a similar window
if (typeof c[i].id != "undefined" && typeof this.mapID[c[i].id] != "undefined") {
id = this.mapID[c[i].id]
}
//check if we have a window who can match the sequence
if (typeof c[i].sequence != "undefined" && id == -1) {
id = this.findWindow(c[i].sequence);
}
if (id != -1){
if (typeof c[i].expected != "undefined") {
this.windows[id].expected = c[i].expected
f = this.getSize(id) / c[i].expected;
if (f < 100 && f > 0.01) {
if (typeof (c[i].tag) != "undefined") {
this.windows[id].tag = c[i].tag;
}
if (typeof (c[i].name) != "undefined") {
this.windows[id].c_name = c[i].name;
}
if (c[i].expected>max.size){
max.size = c[i].expected
max.id = id
}
}else{
myConsole.log(" apply analysis : windows "+ c[i].window + " > incorrect expected value", 0)
}
}else{
if (typeof (c[i].tag) != "undefined") {
this.windows[id].tag = c[i].tag;
}
if (typeof (c[i].name) != "undefined") {
this.windows[id].c_name = c[i].name;
}
if (c[i].expected>max.size){
max.size = c[i].expected
max.id = id
}
}else{
myConsole.log(" apply analysis : windows "+ c[i].window + " > incorrect expected value", 0)
}
}else{
if (typeof (c[i].tag) != "undefined") {
this.windows[id].tag = c[i].tag;
}
if (typeof (c[i].name) != "undefined") {
this.windows[id].c_name = c[i].name;
}
}
}
}
// default normalization
if (max.id != -1 && this.normalization.B == 0){
this.compute_normalization(max.id, max.size)
}
// DATA CLUSTER
this.dataCluster.sort(function (a, b) {
return b.cluster[0] - a.cluster[0]
})
for (var i = 0; i < this.dataCluster.length; i++) {
var new_cluster = [];
for (var j = 0; j < this.dataCluster[i].cluster.length; j++) {
new_cluster = new_cluster.concat(this.clones[this.dataCluster[i].cluster[j]].cluster);
this.clones[this.dataCluster[i].cluster[j]].cluster = []
}
this.clones[this.dataCluster[i].cluster[0]].cluster = new_cluster
this.clones[this.dataCluster[i].cluster[0]].name = this.dataCluster[i].name
}
// CUSTOM CLUSTER
var cluster = analysis.cluster;
for (var i = 0; i < cluster.length; i++) {
// CUSTOM CLUSTER
var cluster = analysis.cluster;
for (var i = 0; i < cluster.length; i++) {
var new_cluster = [];
var l = self.mapID[cluster[i][0]]
var new_cluster = [];
var l = self.mapID[cluster[i][0]]
for (var j=0; j<cluster[i].length;j++){
var cloneID = self.mapID[cluster[i][j]]
new_cluster = new_cluster.concat(this.clones[cloneID].cluster);
this.clones[cloneID].cluster = [];
}
this.clones[l].cluster = new_cluster;
}
this.init()
for (var j=0; j<cluster[i].length;j++){
var cloneID = self.mapID[cluster[i][j]]
new_cluster = new_cluster.concat(this.clones[cloneID].cluster);
this.clones[cloneID].cluster = [];
}else{
//parse old json file temporary
var c = analysis.custom
// CUSTOM TAG / NAME
// EXPECTED VALUE
if (typeof c != 'undefined'){
for (var i = 0; i < c.length; i++) {
var id = -1
var f = 1;
//check if we have a clone with a similar window
if (typeof c[i].window != "undefined" && typeof this.mapID[c[i].window] != "undefined") {
id = this.mapID[c[i].window]
}
//check if we have a window who can match the sequence
if (typeof c[i].sequence != "undefined" && id == -1) {
id = this.findWindow(c[i].sequence);
}
if (id != -1){
if (typeof c[i].expected != "undefined") {
this.windows[id].expected = c[i].expected
f = this.getSize(id) / c[i].expected;
if (f < 100 && f > 0.01) {
if (typeof (c[i].tag) != "undefined") {
this.windows[id].tag = c[i].tag;
}
if (typeof (c[i].name) != "undefined") {
this.windows[id].c_name = c[i].name;
}
}else{
myConsole.log(" apply analysis : windows "+ c[i].window + " > incorrect expected value", 0)
}
}else{
if (typeof (c[i].tag) != "undefined") {
this.windows[id].tag = c[i].tag;
}
if (typeof (c[i].name) != "undefined") {
this.windows[id].c_name = c[i].name;
}
}
}
}
}
// CUSTOM CLUSTER
var cluster = this.analysis.cluster;
for (var i = 0; i < cluster.length; i++) {
if (typeof self.mapID[cluster[i].l] != "undefined" && typeof self.mapID[cluster[i].f] != "undefined") {
var new_cluster = [];
new_cluster = new_cluster.concat(this.clones[self.mapID[cluster[i].l]].cluster);
new_cluster = new_cluster.concat(this.clones[self.mapID[cluster[i].f]].cluster);
this.clones[self.mapID[cluster[i].l]].cluster = new_cluster;
this.clones[self.mapID[cluster[i].f]].cluster = [];
}
}
this.clones[l].cluster = new_cluster;
this.init()
}
this.init()
},
/*
......
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