Programmatic access to the Genome Browser: Difference between revisions

From genomewiki
Jump to navigationJump to search
Line 6: Line 6:
* Download the tool twoBitToFa from http://hgdownload.cse.ucsc.edu/admin/exe/ e.g. with <code>curl http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/twoBitToFa > twoBitToFa; chmod a+x twoBitToFa</code>. For OSX, please adapt the download location to http://hgdownload.cse.ucsc.edu/admin/exe/macOSX.x86_64/
* Download the tool twoBitToFa from http://hgdownload.cse.ucsc.edu/admin/exe/ e.g. with <code>curl http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/twoBitToFa > twoBitToFa; chmod a+x twoBitToFa</code>. For OSX, please adapt the download location to http://hgdownload.cse.ucsc.edu/admin/exe/macOSX.x86_64/
* To get the DNA sequence from e.g. the human genome hg19, run a command like <code>twoBitToFa http://hgdownload.cse.ucsc.edu/gbdb/hg19/hg19.2bit stdout -seq=chr21 -start=1 -end=10000</code>. You can replace stdout with a filename of your choice.
* To get the DNA sequence from e.g. the human genome hg19, run a command like <code>twoBitToFa http://hgdownload.cse.ucsc.edu/gbdb/hg19/hg19.2bit stdout -seq=chr21 -start=1 -end=10000</code>. You can replace stdout with a filename of your choice.
* for best performance, download the 2bit file for your genome from http://hgdownload.cse.ucsc.edu/gbdb/databaseId to local disk
* for best performance, download the 2bit file for your genome from http://hgdownload.cse.ucsc.edu/gbdb/ to local disk


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

Revision as of 09:44, 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