Programmatic access to the Genome Browser: Difference between revisions

From genomewiki
Jump to navigationJump to search
No edit summary
Line 17: Line 17:


== Get a copy of the current Genome Browser image from a script ==
== Get a copy of the current Genome Browser image from a script ==
*  use "curl http://genome.ucsc.edu/cgi-bin/hgRenderTracks > test.png". hgRenderTracks understands the same parameters and options as the main hgTracks CGI, e.g. <trackName>=pack.  
*  use <code>curl http://genome.ucsc.edu/cgi-bin/hgRenderTracks > test.png</code>. hgRenderTracks understands the same parameters and options as the main hgTracks CGI, e.g. <trackName>=pack.  
*  to show only a single track with hgRenderTracks, make sure that the first track parameter is hideTracks=1
*  to show only a single track with hgRenderTracks, make sure that the first track parameter is hideTracks=1
* for example, to download the image for a chromosomal location with only the RefSeq transcripts and publications track to "pack" mode, use this command:
* for example, to download the image for a chromosomal location with only the RefSeq transcripts and publications track to "pack" mode, use this command: <code>curl 'http://genome.ucsc.edu/cgi-bin/hgRenderTracks?position=chr17:41570860-41650551&hideTracks=1&refGene=pack&pubs=pack' > temp.png</code>
  <code>curl 'http://genome.ucsc.edu/cgi-bin/hgRenderTracks?position=chr17:41570860-41650551&hideTracks=1&refGene=pack&pubs=pack' > temp.png</code>  


== Upload a custom track and link to the genome browser with the track loaded ==
== Upload a custom track and link to the genome browser with the track loaded ==

Revision as of 09:36, 6 July 2015

The UCSC API for retrieving data and uploading data is not REST driven but revolves around client-side C tools that convert to/from binary files.

Here are some common tasks that can be solved with calls from scripts to the UCSC Genome Browser, assuming that you know the standard Unix command line tools:

Get the chromosome sequence for a range

Get the "wiggle" (x-y-plot) graph data for a chromosome range

Download data stored in a database table

  • use Tools - Table Browser - "Describe schema" to browse the database schema. All fields have a human readable description and the links to other tables are shown.
  • mysql --no-defaults -h genome-mysql.cse.ucsc.edu -u genome -A -e 'select * from pubsBingBlat' -NB > out.txt

Get a copy of the current Genome Browser image from a script

Upload a custom track and link to the genome browser with the track loaded