Skip to content

Instantly share code, notes, and snippets.

@wwood
Created November 5, 2009 05:05
Show Gist options
  • Save wwood/226784 to your computer and use it in GitHub Desktop.
Save wwood/226784 to your computer and use it in GitHub Desktop.
Local Mozilla Ubiquity commands
CmdUtils.CreateCommand({
names: ["genbank blast"],
arguments: [{role: 'object', nountype: noun_arb_text, label: 'genbank id'},
{role: 'goal', nountype: noun_arb_text, label: 'blast database'},
{role: 'instrument', nountype: noun_arb_text, label: 'blast program'},
{role: 'location', nountype: noun_arb_text, label: 'taxa'}],
homepage: "http://gist.github.com/73638",
help: 'genbank_blast <b>entrez_id</b> [with <b>blast_program</b>] [to <b>blast_database_name</b>]',
author: { name: "Ben J. Woodcroft", email: "b.woodcroft@pgrad.unimelb.edu.au"},
contributors: ["Ben J. Woodcroft"],
license: "GPL3",
execute: function execute(args) {
var urlStringStart = "http://apiloc.bio21.unimelb.edu.au/apiloc/blasts/blast_genbank?id="
var urlStringEnd = ""
genbankString = args.object.text;
genbank_array = genbankString.split(",")
modtext = args.instrument.text
if (modtext.length == undefined){;}
else{
urlStringEnd = urlStringEnd + "&program="+modtext;
}
modtext = args.goal.text
if (modtext.length == undefined){;}
else{
urlStringEnd = urlStringEnd + "&database="+modtext;
}
modtext = args.location.text
if (modtext.length == undefined){;}
else{
urlStringEnd = urlStringEnd + "&taxa="+modtext;
}
for(i=0; i<genbank_array.length; i = i+1){
Utils.openUrlInBrowser(urlStringStart+genbank_array[i]+urlStringEnd);
}
}
})
CmdUtils.CreateCommand({
names: ["apiloc"],
icon: "http://www.mozilla.com/favicon.ico",
description: "apiloc.",
help: "How to use your command.",
author: {name: "Your Name", email: "you@mozilla.com"},
license: "GPL",
homepage: "http://apiloc.bio21.unimelb.edu.au/",
arguments: [{role: 'object', nountype: noun_arb_text}],
preview: function preview(pblock, args) {
pblock.innerHTML = "Your input is <b>" + args.object.html + "</b>.";
},
execute: function execute(args) {
geneString = args.object.text;
gene_array = geneString.split(" ")
for(i=0; i<gene_array.length; i = i+1){
var urlString = "http://apiloc.bio21.unimelb.edu.au/apiloc/apiloc/gene/"+gene_array[i];
Utils.openUrlInBrowser(urlString);
}
}
});
CmdUtils.CreateCommand({
names: ["sequence blast"],
arguments: [{label: "sequence", nountype: noun_arb_text, role: 'object'},
{role: 'goal', nountype: noun_arb_text, label: 'blast database'},
{role: 'instrument', nountype: noun_arb_text, label: 'blast program'},
{role: 'location', nountype: noun_arb_text, label: 'taxa'}],
homepage: "apiloc.bio21.unimelb.edu.au",
author: { name: "Ben J. Woodcroft", email: "b.woodcroft@pgrad.unimelb.edu.au"},
contributors: ["Ben J. Woodcroft"],
license: "GPL3",
description: "BLAST quicklier than PlasmoDB/ToxoDB.",
preview: "BLAST quicklier than PlasmoDB/ToxoDB",
execute: function(args) {
var urlStringStart = "http://apiloc.bio21.unimelb.edu.au/apiloc/blasts/blast?sequence=";
var urlStringEnd = "";
genbankString = args.object.text;
genbank_array = genbankString.split(",")
modtext = args.instrument.text
if (modtext.length == undefined){;}
else{
urlStringEnd = urlStringEnd + "&program="+modtext;
}
modtext = args.goal.text
if (modtext.length == undefined){;}
else{
urlStringEnd = urlStringEnd + "&database="+modtext;
}
modtext = args.location.text
if (modtext.length == undefined){;}
else{
urlStringEnd = urlStringEnd + "&taxa="+modtext;
}
for(i=0; i<genbank_array.length; i = i+1){
Utils.openUrlInBrowser(urlStringStart+genbank_array[i]+urlStringEnd);
}
}
});
CmdUtils.CreateCommand({
names: ["papiloc"],
icon: "http://www.mozilla.com/favicon.ico",
description: "apiloc.",
help: "How to use your command.",
author: {name: "Your Name", email: "you@mozilla.com"},
license: "GPL",
homepage: "http://reefedge.sols.uq.edu.au:3000/",
arguments: [{role: 'object', nountype: noun_arb_text}],
preview: function preview(pblock, args) {
pblock.innerHTML = "Your input is <b>" + args.object.html + "</b>.";
},
execute: function execute(args) {
var urlString = "http://reefedge.sols.uq.edu.au:3000/apiloc/publication/"+args.object.text;
Utils.openUrlInBrowser(urlString);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment