/uta

Universal Transcript Archive: comprehensive genome-transcript alignments; multiple transcript sources, versions, and alignment methods; available as a docker image

Primary LanguagePythonApache License 2.0Apache-2.0

uta -- Universal Transcript Archive

bringing smiles to transcript users since 2013

build_status docker_badge

Note

uta_20150903 is available. It adds NM_000314.5, which is the transcript preferred by HGMD for PTEN. The importance of this gene and the prevalence of HGMD justified this minor release. Otherwise, this release is identical to uta_20150827. The release is available via the postgresql database at uta.biocommons.org, the uta docker image, and dl.biocommons.org postgresql dump.

Overview

The UTA (Universal Transcript Archive) stores transcripts aligned to sequence references (typically genome reference assemblies). It supports aligning the same transcript to multiple references using multiple alignment methods. Specifically, it facilitates the following:

  • querying for multiple transcript sources through a single interface
  • interpretating variants reported in literature against obsolete transcript records
  • identifying regions where transcript and reference genome sequence assemblies disagree
  • comparing transcripts across from distinct sources
  • comparing transcript alignments generated by multiple methods
  • identifying ambiguities in transcript alignments

UTA is used by the hgvs package to map variants between genomic, transcript, and protein coordinates.

This code repository is primarily used for generating the UTA database. The primary interface for the database itself is via direct PostgreSQL access. (A REST interface is planned, but not yet available.)

Accessing the Public UTA Instance

Invitae provides a public instance of UTA. The connection parameters are:

param value
host uta.invitae.com
port 5432 (default)
database uta
login anonymous
password anonymous

For example:

$ PGPASSWORD=anonymous psql -h uta.invitae.com -U anonymous -d uta

Or, in Python:

> import psycopg2, psycopg2.extras
> conn = psycopg2.connect("host=uta.invitae.com dbname=uta user=anonymous password=anonymous")
> cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
> cur.execute("select * from uta_20140210.tx_def_summary_v where hgnc='BRCA1'")
> row = cur.fetchone()
> dict(row)
{
'hgnc': 'BRCA1',
'tx_ac': 'ENST00000586385',
'cds_md5': '5d405c70b9b79add38d28e5011a6ddc0',
'es_fingerprint': '95d60b8d62f5c23cbeff3499eedf5e89',
'cds_start_i': 144,
'cds_end_i': 666,
'starts_i': [0, 148, 226, 267, 351, 406, 480, 541],
'ends_i': [148, 226, 267, 351, 406, 480, 541, 781],
'lengths': [148, 78, 41, 84, 55, 74, 61, 240],
}

Installing UTA Locally

Installing with Docker (preferred)

docker enables the distribution of lightweight, isolated packages that run on essentially any platform. When you use this approach, you will end up with a local UTA installation that runs as a local postgresql process. The only requirement is docker itself -- you will not need to install postgresql or any of its dependencies.

  1. Install docker.

  2. Fetch the uta docker image from docker hub.

    $ docker pull biocommons/uta:uta_20150827
    

    This process will likely take 1-3 minutes.

  3. Run the image

    $ docker run -dit --name uta_20150827 -p 50827:5432 biocommons/uta:uta_20150827
    

    The first time you run this image, it will initialize a postgresql database cluster, then download a database dump and install it. -d starts the container in daemon (background) mode. To see progress:

    $ docker logs -f uta_20150827
    

    You will see messages from several processes running in parallel. Near the end, you'll see:

    == You may now connect to uta.  No password is required.
    

    Hit Ctrl-C to stop watching logs. (The container will still be running.)

  4. Test your installation

    With the test commands below, you should see a table dump with at least 4 lines showing schema_version, create date, license, and uta (code) version used to build the instance.

    Linux

    On Linux, where docker runs natively, -p 50827:5432 option to the docker run command causes localhost:50827 to be mapped to the container port 5432. The following command connects to the UTA instance:

    $ psql -h localhost -p 50827 -U anonymous -d uta -c 'select * from uta_20150827.meta'
    

    With DockerToolbox (Mac and Windows)

    On Mac and Windows, docker runs in a virtual machine using DockerToolbox. The -p 50827:5432 option to the docker run maps VM port 50827 (not that of the host OS). In order to connect to UTA, you must use the IP address of the VM, like this:

    $ psql -h $(docker-machine ip default) -p 50827 -U anonymous -d uta -c 'select * from uta_20150827.meta'
    

Installing from database dumps

Users should prefer the public UTA instance (uta.biocommons.org) or the docker installation wherever possible. When those options are not available, users may wish to create a local postgresql database from database dumps. Users choosing this method of installation should be experienced with PostgreSQL administration.

The public site and docker images are built from exactly the same dumps as provided below. Building a database from these should result in a local database that is essentially identical to those options.

Warning

Due to the heterogeneity of operating systems and PostgreSQL installations, installing from database dumps is unsupported.

The following commands will likely need modification appropriate for the installation environment.

  1. Download an appropriate database dump from dl.biocommons.org.

  2. Create a user and database.

    You may choose any username and database name you like. uta and uta_admin are likely to ease installation.

    $ createuser -U postgres uta_admin
    $ createdb -U postgres -O uta_admin uta
    
  3. Restore the database.

    $ gzip -cdq uta_20150827.pgd.gz | psql -U uta_admin -1 -v ON_ERROR_STOP=1 -d uta -Eae
    

Note

See the hgvs docs for information how to configure hgvs to use this instance.

Development and Testing

To develop UTA, follow these steps.

  1. Setup a virtual environment.

With virtualenvwrapper:

mkvirtualenv uta-ve

Or, with virtualenv:

virtualenv uta-ve
source uta-ve/bin/activate
  1. Clone UTA.:

    hg clone ssh://hg@bitbucket.org/biocommons/uta
    cd uta
    make develop
    
  2. Restore a database or load a new one

    UTA currently expects to have an existing database available. When the loaders are available, instructions will appear here. For now, creating an instance of TranscriptDB without arguments will cause it to connect to a populated Invitae database.