Created
January 18, 2013 20:31
-
-
Save radusuciu/4568280 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var baseUrl = 'http://blast.ncbi.nlm.nih.gov/Blast.cgi', | |
program, | |
blastPrograms; | |
switch (App.blast.context) | |
{ | |
case 'rna-sequence' : | |
case 'mrna-transcript' : | |
program = blastPrograms = 'tblastx'; | |
break; | |
case 'protein-sequence' : | |
case 'mrna-protein' : | |
program = blastPrograms = 'blastp'; | |
break; | |
case 'dna-sequence' : | |
program = 'blastn'; | |
blastPrograms = 'megaBlast'; | |
break; | |
} | |
// to specify species use 'EQ_MENU' in post | |
var params = { | |
'PAGE_TYPE' : 'BlastSearch', | |
'SHOW_DEFAULTS' : 'on', | |
'LINK_LOC' : 'blasthome', | |
'PROGRAM' : program, | |
'BLAST_PROGRAMS' : blastPrograms, | |
'QUERY' : App.blast.query | |
}; | |
// form is used to POST data to get around GET request character limit | |
$tempForm = $('<form>').attr({ | |
'method' : 'post', | |
'action' : baseUrl, | |
'target' : '_blank' | |
}); | |
for (var i in params) { | |
if (params.hasOwnProperty(i)) { | |
$('<input>').attr({ | |
'type' : 'hidden', | |
'name' : i, | |
'value' : params[i] | |
}).appendTo($tempForm); | |
} | |
} | |
$tempForm.submit().remove(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment