Commit 76e75393 authored by Armand Bour's avatar Armand Bour Committed by Mathieu Giraud
Browse files

Add function to add manually clones in models.js

parent 910aa437
......@@ -125,7 +125,7 @@
<a class="buttonSelector" id="export_monitor_report" onclick="javascript:report.reportHTML()">export report (monitor)</a>
</div>
<div class="menu_box">
<a class="buttonSelector" id ="add_clone" onclick="javascript:addManualClone()">add a clone</a>
<a class="buttonSelector" id ="add_clones" onclick="javascript:showAddManualCloneMenu()">add clones</a>
</div>
<div class="menu_box">
<a class="buttonSelector" id="export_analysis" onclick="javascript:m.saveAnalysis()">export analysis</a>
......
......@@ -27,22 +27,25 @@
* @param {object} data - json style object, come directly from .vidjil file
* @param {Model} model
* @param {integer} index - clone index, it's just the clone position in the model's clone array
* @param {boolean} quantifiable - represents whethere the clone is quantifiable or not.
* */
function Clone(data, model, index, virtual, quantifiable) {
function Clone(data, model, index, virtual) {
this.m = model
this.index = index
this.split = false
this.seg = {};
this.segEdited = false
this.virtual = typeof virtual !== 'undefined' ? virtual : false
this.quantifiable = quantifiable == true;
var key = Object.keys(data)
for (var i=0; i<key.length; i++ ){
this[key[i]]=data[key[i]]
}
if (this.quantifiable == undefined) {
this.quantifiable = true;
}
this.seg = this.m.convertSeg(this.seg)
if (typeof (this.getSequence()) != 'undefined' && typeof (this.name) != 'undefined') {
......
......@@ -3,7 +3,7 @@
* High-throughput Analysis of V(D)J Immune Repertoire.
* Copyright (C) 2013-2017 by Bonsai bioinformatics
* at CRIStAL (UMR CNRS 9189, Université Lille) and Inria Lille
* Contributors:
* Contributors:
* Marc Duez <marc.duez@vidjil.org>
* The Vidjil Team <contact@vidjil.org>
*
......@@ -2304,7 +2304,48 @@ changeCloneNotation: function(cloneNotationType) {
return this.getName(edge.source)+" -- "+this.getName(edge.target)+" == "+edge.len;
},
}; //end prototype Model
DEFAULT_SEGMENTER_URL: "https://dev.vidjil.org/vidjil/segmenter",
/**
* sends an ajax request to manually add special clones
* @param {string} input - the id of the input to extract the sequences from
*/
addManualClones: function(input) {
var url = config && config.segmenter_address ? config.segmenter_address : this.DEFAULT_SEGMENTER_URL;
var inputNode = document.getElementById(input);
if (!inputNode) {
console.log("[model] could not find '" + input + "' input node");
return;
}
if (inputNode) {
var sequences = inputNode.value;
// When empty, show error
if (!sequences) {
showAddManualCloneMenu(true);
} else {
var self = this;
$.ajax(url, {
method: "POST",
data: {
sequences: sequences
},
// dataType: "json",
success: function (data) {
data.clones.forEach(function (clone) {
clone.quantifiable = false;
});
self.parseJsonData(data, 100);
console.log({ msg: "Clone(s) added!", type: "flash", priority: 1 })
},
error: function (xhr, textStatus, errorThrown) {
console.log({ msg: textStatus + " " + errorThrown, type: "flash", priority: 2 });
}
});
}
}
}
}; //end prototype Model
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