Skip to content

Instantly share code, notes, and snippets.

@radusuciu
Created January 18, 2013 20:31
Show Gist options
  • Save radusuciu/4568280 to your computer and use it in GitHub Desktop.
Save radusuciu/4568280 to your computer and use it in GitHub Desktop.
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