Commit ce69f30b authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'feature-c/3913-vquest-api-change' into 'dev'

V-QUEST API change

Closes #3913

See merge request !472
parents c3117006 c3f93d8e
Pipeline #91339 passed with stages
in 6 minutes and 8 seconds
...@@ -12,59 +12,40 @@ function setCrossDomainModel(model) { ...@@ -12,59 +12,40 @@ function setCrossDomainModel(model) {
//parametre IMGT par defaut //parametre IMGT par defaut
function initImgtInput(species) { function initImgtInput(species) {
var imgtInput = {}; var imgtInput = {};
imgtInput.callback = "jQuery17106713638880755752_1378825832820"; imgtInput.species = getSpeciesCommonName(species);
imgtInput.livret = "1"; imgtInput.receptorOrLocusType = "TR";
imgtInput.Session = "<session code=¤0¤ appliName=¤IMGTvquest¤ time=¤3625396897¤/>"; imgtInput.inputType = "inline";
imgtInput.l01p01c02 = species; imgtInput.resultType = "synthesis";
imgtInput.l01p01c04 = "TR"; imgtInput.outputType = "html";
imgtInput.l01p01c03 = "inline"; imgtInput.nbNtPerLine = "60";
imgtInput.l01p01c10 = ""; imgtInput.sv_V_GENEordertable = "1";
imgtInput.l01p01c07 = "2. Synthesis"; imgtInput.sv_V_GENEalignment = "true";
imgtInput.l01p01c05 = "HTML"; imgtInput.sv_V_REGIONalignment = "true";
imgtInput.l01p01c09 = "60"; imgtInput.sv_V_REGIONtranslation = "true";
imgtInput.l01p01c60 = "5"; imgtInput.sv_V_REGIONprotdisplay = "true";
imgtInput.l01p01c12 = "Y"; imgtInput.sv_V_REGIONprotdisplay2 = "true";
imgtInput.l01p01c13 = "Y"; imgtInput.sv_V_REGIONprotdisplay3 = "true";
imgtInput.l01p01c06 = "Y"; imgtInput.sv_V_REGIONfrequentAA = "true";
imgtInput.l01p01c24 = "N"; imgtInput.sv_IMGTjctaResults = "true";
imgtInput.l01p01c14 = "Y";
imgtInput.l01p01c15 = "Y"; // part for the version where we asynchronously get results from V-QUEST
imgtInput.l01p01c16 = "Y"; imgtInput.xv_IMGTgappedNt = "false";
imgtInput.l01p01c41 = "Y"; imgtInput.xv_summary = "false";
imgtInput.l01p01c22 = "Y"; imgtInput.xv_ntseq = "true"; // nt-sequences
imgtInput.l01p01c17 = "Y"; imgtInput.xv_IMGTgappedAA = "false";
imgtInput.l01p01c23 = "Y"; imgtInput.xv_AAseq = "false";
imgtInput.l01p01c19 = "Y"; imgtInput.xv_JUNCTION = "false"; // Junction
imgtInput.l01p01c18 = "Y"; imgtInput.xv_V_REGIONmuttable = "false";
imgtInput.l01p01c20 = "Y"; imgtInput.xv_V_REGIONmutstatsNt = "false";
imgtInput.l01p01c27 = "Y"; imgtInput.xv_V_REGIONmutstatsAA = "false";
imgtInput.l01p01c28 = "Y"; imgtInput.xv_V_REGIONhotspots = "false";
imgtInput.l01p01c29 = "Y"; // end of part
imgtInput.l01p01c30 = "Y";
imgtInput.l01p01c31 = "Y"; imgtInput.IMGTrefdirSet = "1"; // "F+ORF+ in-frame P";
imgtInput.l01p01c32 = "Y"; imgtInput.IMGTrefdirAlleles = "true";
imgtInput.l01p01c33 = "Y"; imgtInput.V_REGIONsearchIndel = "true";
imgtInput.l01p01c34 = "Y"; imgtInput.nbD_GENE = ""; // Default value: 1 for IGH, 1 for TRB, 3 for TRD
imgtInput.l01p01c46 = "N"; imgtInput.sequences = "";
imgtInput.l01p01c47 = "Y"; // nt-sequences
imgtInput.l01p01c48 = "N";
imgtInput.l01p01c49 = "N";
imgtInput.l01p01c50 = "N"; // Junction
imgtInput.l01p01c51 = "N";
imgtInput.l01p01c52 = "N";
imgtInput.l01p01c53 = "N";
imgtInput.l01p01c54 = "N";
imgtInput.l01p01c55 = "NO";
imgtInput.l01p01c35 = "F+ORF+ in-frame P";
imgtInput.l01p01c36 = "0";
imgtInput.l01p01c40 = "1";
imgtInput.l01p01c25 = "default";
imgtInput.l01p01c37 = "default";
imgtInput.l01p01c38 = "default";
imgtInput.l01p01c39 = "default";
imgtInput.l01p01c08 = "";
imgtInput.l01p01c26 = "";
imgtInput.l01p01c10 = ">a\nATGCGCAGATGC\n";
return imgtInput; return imgtInput;
} }
...@@ -101,17 +82,17 @@ function initIgBlastInput() { ...@@ -101,17 +82,17 @@ function initIgBlastInput() {
function imgtPost(species, data, system) { function imgtPost(species, data, system) {
var imgtInput = initImgtInput(species); var imgtInput = initImgtInput(species);
imgtInput.l01p01c10 = data; imgtInput.sequences = data;
if (system[0] == "I") { if (system[0] == "I") {
imgtInput.l01p01c04 = "IG"; imgtInput.receptorOrLocusType = "IG";
} }
if (system[0] == "T") { if (system[0] == "T") {
imgtInput.l01p01c04 = "TR"; imgtInput.receptorOrLocusType = "TR";
} }
var form = document.getElementById("form"); var form = document.getElementById("form");
form.removeAllChildren(); form.removeAllChildren();
form.target = "_blank"; form.target = "_blank";
form.action = "http://www.imgt.org/IMGT_vquest/vquest"; form.action = "http://www.imgt.org/IMGT_vquest/analysis";
form.method = "POST"; form.method = "POST";
for (var k in imgtInput) { for (var k in imgtInput) {
...@@ -167,15 +148,15 @@ function imgtPostForSegmenter(species, data, system, segmenter, override_imgt_op ...@@ -167,15 +148,15 @@ function imgtPostForSegmenter(species, data, system, segmenter, override_imgt_op
}); });
} }
imgtInput.l01p01c07 = "3. Excel"; imgtInput.resultType = "excel";
imgtInput.l01p01c10 = data; imgtInput.sequences = data;
imgtInput.l01p01c62 = 2; imgtInput.xv_outputtype = 2;
if (system[0] == "I") { if (system[0] == "I") {
imgtInput.l01p01c04 = "IG"; imgtInput.receptorOrLocusType = "IG";
} }
if (system[0] == "T") { if (system[0] == "T") {
imgtInput.l01p01c04 = "TR"; imgtInput.receptorOrLocusType = "TR";
} }
var form = document.getElementById("form"); var form = document.getElementById("form");
form.removeAllChildren(); form.removeAllChildren();
......
...@@ -889,8 +889,8 @@ Segment.prototype = { ...@@ -889,8 +889,8 @@ Segment.prototype = {
} }
if (address == 'IMGTSeg') { if (address == 'IMGTSeg') {
imgtPostForSegmenter(this.m.species, request, system, this); imgtPostForSegmenter(this.m.species, request, system, this);
var change_options = {'l01p01c47' : 'N', // Deactivate default output var change_options = {'xv_ntseq' : 'false', // Deactivate default output
'l01p01c45' : 'Y'}; // Activate Summary output 'xv_summary' : 'true'}; // Activate Summary output
imgtPostForSegmenter(this.m.species, request, system, this, change_options); imgtPostForSegmenter(this.m.species, request, system, this, change_options);
} }
if (address == 'ARResT') arrestPost(request, system); if (address == 'ARResT') arrestPost(request, system);
......
...@@ -134,6 +134,25 @@ function get_mutations(ref, seq, frame, with_end_codon) { ...@@ -134,6 +134,25 @@ function get_mutations(ref, seq, frame, with_end_codon) {
return mutations; return mutations;
} }
/**
* @return the common name of a species. Or the original name if the common
* name has not been set. The common names are given so that they are
* compatible with IMGT/V-QUEST®
*/
function getSpeciesCommonName(species) {
var lower_species = species.toLowerCase();
switch(lower_species) {
case "homo sapiens":
return "human";
case "mus musculus":
return "house mouse";
case "gallus gallus":
return "chicken";
default:
return species;
}
}
/** /**
* Find the position of the nth occurence of needle * Find the position of the nth occurence of needle
* *
......
...@@ -139,6 +139,13 @@ QUnit.test("test nth_ocurrence", function(assert) { ...@@ -139,6 +139,13 @@ QUnit.test("test nth_ocurrence", function(assert) {
} }
); );
QUnit.test("test getSpeciesCommonName", function(assert) {
assert.equal(getSpeciesCommonName("homo sapiens"), "human");
assert.equal(getSpeciesCommonName("Homo sapiens"), "human");
assert.equal(getSpeciesCommonName("mus musculus"), "house mouse");
assert.equal(getSpeciesCommonName("gallus gallus"), "chicken");
});
QUnit.test("test tsvToArray", function(assert) { QUnit.test("test tsvToArray", function(assert) {
var tabstring = "head1\thead2\thead3\thead4\nLine 1 data1\tLine 1 data2\tLine 1 data3\tLine 1 data4\n"; var tabstring = "head1\thead2\thead3\thead4\nLine 1 data1\tLine 1 data2\tLine 1 data3\tLine 1 data4\n";
tabstring += "Line 2 data1\tLine 2 data2\tLine 2 data3\tLine 2 data4"; tabstring += "Line 2 data1\tLine 2 data2\tLine 2 data3\tLine 2 data4";
......
...@@ -10,7 +10,7 @@ class VidjilBrowser < Watir::Browser ...@@ -10,7 +10,7 @@ class VidjilBrowser < Watir::Browser
Selenium::WebDriver::Chrome.path = ENV['WATIR_BROWSER_PATH'] Selenium::WebDriver::Chrome.path = ENV['WATIR_BROWSER_PATH']
end end
# :chrome or :safari # :chrome or :safari
if ENV['WATIR_CHROME'] or ENV['WATIR_BROWSER_PATH'].include? "chrom" if ENV['WATIR_CHROME'] or (ENV['WATIR_BROWSER_PATH'] and ENV['WATIR_BROWSER_PATH'].include? "chrom")
super :chrome super :chrome
elsif ENV['WATIR_MARIONETTE'] elsif ENV['WATIR_MARIONETTE']
super :firefox super :firefox
......
...@@ -16,7 +16,7 @@ def imgt(): ...@@ -16,7 +16,7 @@ def imgt():
if 'Session' in payload.keys(): if 'Session' in payload.keys():
del payload['Session'] del payload['Session']
response = requests.post("http://www.imgt.org/IMGT_vquest/vquest", data=payload) response = requests.post("http://www.imgt.org/IMGT_vquest/analysis", data=payload)
if response.status_code == requests.codes.ok: if response.status_code == requests.codes.ok:
return response return response
return gluon.contrib.simplejson.dumps("the site returned an invalid response") return gluon.contrib.simplejson.dumps("the site returned an invalid response")
......
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