Instantly share code, notes, and snippets.

Embed
What would you like to do?
create dbxref links for jbrowse
fmtDetailValue_Dbxref : function(dbxref) {
if (typeof dbxref != 'string') {
return dbxref;
}
var dbid = dbxref.split(':');
var prefix = '';
switch (dbid[0]) {
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 href=\"'+ prefix + dbid[1] + '\">' + dbxref + '</a>';
}
@sestaton

This comment has been minimized.

Copy link
Owner

sestaton commented May 12, 2016

minified for trackList.json:

"fmtDetailValue_Dbxref" : "function(dbxref) { if (typeof dbxref != 'string') { return dbxref; } var dbid = dbxref.split(':'); var prefix= ''; switch (dbid[0]) { 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 href=\"'+ prefix + dbid[1] + '\">' + dbxref + '</a>'; }"
@cmdcolin

This comment has been minimized.

Copy link

cmdcolin commented Jun 16, 2017

this is great :) exactly the type of thing the (clumsily designed, I can say that since I sort of made it lol) fmtDetailValues thing was intended for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment