Skip to content

Instantly share code, notes, and snippets.

@nathanhaigh
Last active July 4, 2018 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanhaigh/e7a6cca1bb38704059493359e055c91b to your computer and use it in GitHub Desktop.
Save nathanhaigh/e7a6cca1bb38704059493359e055c91b to your computer and use it in GitHub Desktop.
Callbacks to generate links for Dbxref and Ontology_term entries in JBrowse GFF tracks
"fmtDetailValue_Dbxref" : "function(dbxref){if(typeof dbxref!='string'){return dbxref}var dbid=dbxref.split(':');var prefix='';switch(dbid[0].toLowerCase()){case 'interpro':prefix='http://www.ebi.ac.uk/interpro/entry/';break;case 'pfam':prefix='http://pfam.sanger.ac.uk/family/';break;case 'reactome':prefix='http://www.reactome.org/content/detail/';break;case 'unipathway':prefix='http://www.grenoble.prabi.fr/obiwarehouse/unipathway/upa?upid=';break;case 'kegg':prefix='http://www.genome.jp/kegg-bin/show_pathway?ec';break;case 'prositepatterns':prefix='http://prosite.expasy.org/';break;case 'prositeprofiles':prefix='http://prosite.expasy.org/cgi-bin/prosite/PSView.cgi?ac=';break;case 'smart':prefix='http://smart.embl-heidelberg.de/smart/do_annotation.pl?BLAST=DUMMY&DOMAIN=';break;case 'superfamily':prefix='http://supfam.org/SUPERFAMILY/cgi-bin/scop.cgi?sunid=';dbid[1]=dbid[1].replace('SSF','');break;case 'gene3d':prefix='http://www.cathdb.info/version/latest/superfamily/';dbid[1]=dbid[2];break;case 'pirsf':prefix='http://pir.georgetown.edu/cgi-bin/ipcSF?id=';break;case 'prodom':prefix='http://prodom.prabi.fr/prodom/current/cgi-bin/request.pl?question=DBEN&query=';break;case 'tigrfam':prefix='http://www.jcvi.org/cgi-bin/tigrfams/HmmReportPage.cgi?acc=';break;default:return dbxref};return'<a target=\"_blank\" href=\"'+prefix+dbid[1]+'\">'+dbxref+'</a>'}",
"fmtDetailValue_Ontology_term": "function(ontology_term){if(typeof ontology_term!='string'){return ontology_term}var id=ontology_term.split(':');var prefix='';switch(id[0].toLowerCase()){case 'go':prefix='https://www.ebi.ac.uk/QuickGO/GTerm?id=GO:';break;case 'so':prefix='http://www.sequenceontology.org/browser/current_svn/term/SO:';break;default:return ontology_term};return'<a target=\"_blank\" href=\"'+prefix+id[1]+'\">'+ontology_term+'</a>'}"
// Inspired/stolen from https://gist.github.com/sestaton/ff9424f28b165e761e934f078f07249f
fmtDetailValue_Dbxref = function(dbxref) {
if (typeof dbxref != 'string') {
return dbxref;
}
var dbid = dbxref.split(':');
var prefix = '';
switch (dbid[0].toLowerCase()) {
case 'interpro':
prefix = 'http://www.ebi.ac.uk/interpro/entry/';
break;
case 'pfam':
prefix = 'http://pfam.xfam.org/family/';
break;
case 'reactome':
prefix = 'http://www.reactome.org/content/detail/';
break;
case 'unipathway':
prefix = 'http://www.grenoble.prabi.fr/obiwarehouse/unipathway/upa?upid=';
break;
case 'kegg':
prefix = 'http://www.genome.jp/kegg-bin/show_pathway?ec';
break;
case 'prositepatterns':
prefix = 'http://prosite.expasy.org/';
break;
case 'prositeprofiles':
prefix = 'http://prosite.expasy.org/cgi-bin/prosite/PSView.cgi?ac=';
break;
case 'smart':
prefix = 'http://smart.embl-heidelberg.de/smart/do_annotation.pl?BLAST=DUMMY&DOMAIN=';
break;
case 'superfamily':
prefix ='http://supfam.org/SUPERFAMILY/cgi-bin/scop.cgi?sunid=';
dbid[1] = dbid[1].replace('SSF', '');
break;
case 'gene3d':
prefix ='http://www.cathdb.info/version/latest/superfamily/';
dbid[1] = dbid[2];
break;
case 'pirsf':
prefix = 'http://pir.georgetown.edu/cgi-bin/ipcSF?id=';
break;
case 'prodom':
prefix = 'http://prodom.prabi.fr/prodom/current/cgi-bin/request.pl?question=DBEN&query=';
break;
case 'tigrfam':
prefix = 'http://www.jcvi.org/cgi-bin/tigrfams/HmmReportPage.cgi?acc=';
break;
default:
return dbxref;
};
return '<a target=\"_blank\" href=\"'+ prefix + dbid[1] + '\">' + dbxref + '</a>';
}
fmtDetailValue_Ontology_term = function(ontology_term) {
if (typeof ontology_term != 'string') {
return ontology_term;
}
var id = ontology_term.split(':');
var prefix = '';
switch (id[0].toLowerCase()) {
case 'go':
prefix = 'https://www.ebi.ac.uk/QuickGO/GTerm?id=GO:';
break;
case 'so':
prefix = 'http://www.sequenceontology.org/browser/current_svn/term/SO:';
break;
default:
return ontology_term;
};
return '<a target=\"_blank\" href=\"'+ prefix + id[1] + '\">' + ontology_term + '</a>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment