Programmatic access to the Genome Browser: Difference between revisions

From genomewiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
The UCSC API for retrieving data and uploading data is RESTful but does not use JSON. Download usually requires client-side C tools that convert to/from binary files, data upload uses custom text files.
The UCSC API for retrieving data and uploading data is RESTful over HTTP but does not use JSON to save computational time on the server. Download of most data formats requires client-side C tools that convert to/from binary files. Data upload uses custom text files.


Here are some common tasks that can be done from scripts with the UCSC Genome Browser, assuming that you know the standard Unix command line tools:
Here are some common tasks that can be done from scripts with the UCSC Genome Browser. It is assumed that the reader knows the standard Unix command line tools.
 
== 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.
* the first column in many tables with genomic coordinates is called "bin" and can be stripped for most applications
* to access the public Mysql server, use a commen like <code>mysql --no-defaults -h genome-mysql.cse.ucsc.edu -u genome -A -e 'select * from pubsBingBlat' -NB > out.txt</code>


== Get the chromosome sequence for a range ==  
== Get the chromosome sequence for a range ==  
Line 11: Line 16:
* Download bigWigToWig from http://hgdownload.cse.ucsc.edu/admin/exe/ as shown above
* Download bigWigToWig from http://hgdownload.cse.ucsc.edu/admin/exe/ as shown above
* run a command like <code>bigWigToWig http://hgdownload.cse.ucsc.edu/gbdb/hg19/bbi/wgEncodeBroadHistoneK562Cbx2Sig.bigWig -chrom=chr21 -start=0 -end=10000000 stdout</code>. You can also replace stdout with a filename of your choice.
* run a command like <code>bigWigToWig http://hgdownload.cse.ucsc.edu/gbdb/hg19/bbi/wgEncodeBroadHistoneK562Cbx2Sig.bigWig -chrom=chr21 -start=0 -end=10000000 stdout</code>. You can also replace stdout with a filename of your choice.
== 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 ==
== Get a copy of the current Genome Browser image from a script ==

Revision as of 13:18, 6 July 2015

The UCSC API for retrieving data and uploading data is RESTful over HTTP but does not use JSON to save computational time on the server. Download of most data formats requires client-side C tools that convert to/from binary files. Data upload uses custom text files.

Here are some common tasks that can be done from scripts with the UCSC Genome Browser. It is assumed that the reader knows the standard Unix command line tools.

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.
  • the first column in many tables with genomic coordinates is called "bin" and can be stripped for most applications
  • to access the public Mysql server, use a commen like mysql --no-defaults -h genome-mysql.cse.ucsc.edu -u genome -A -e 'select * from pubsBingBlat' -NB > out.txt

Get the chromosome sequence for a range

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

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