From: Ian H. <ih...@be...> - 2009-08-18 17:25:06
|
Hi Andrew, > Is there an easy way to deep link to a specific view in JBrowse? For > example, on your hg19 jbrowse demo, is there a way to link to exactly > this view (genomic position and selection of tracks)? > > I was hoping for something like > http://www.jbrowse.org/ucsc/hg19/?coordinates=chr1:119777910-120173410&track=RefSeqGenes&track=CpGIslands&track=ORFeomeClones. > Possible? Currently the way to do this is via the Javascript API. If you look at the source for the hg19 demo, you'll see a <script> block like this: <script type="text/javascript"> /* <![CDATA[ */ var b = new Browser({ containerID: "GenomeBrowser", refSeqs: refSeqs, trackData: trackInfo }); b.showTracks("DNA,gene,mRNA,noncodingRNA"); /* ]]> */ </script> The two relevant methods of the Browser object are showTracks and navigateTo. (Note that this example already has a call to showTracks, but not navigateTo.) You probably want something like this after the call to the Browser constructor: b.showTracks("RefSeqGenes,CpGIslands,ORFeomeClones"); b.navigateTo("chr1:119777910..120173410"); You can also pass these strings into the Browser constructor as defaults (see the Javascript code for documentation of this). Although it isn't too hard to extract these strings from the URL (as in your permalinking example), we have avoided having the Browser object look directly at the URL, as it would be bad for embedding (one cannot know ahead of time which CGI parameters are used by the embedding application, and there is a possibility of a namespace clash). Therefore, we currently leave this to the user to set up. We could use a tutorial explaining this. For an example of both kinds of deep-linking, see the TWiki plugin, which allows deep-linking to specific features via the URL *or* a TWiki shortcut syntax. Best wishes, Ian |