Skip to main content

Convert UCSC's ENCODE metadata into pandas DataFrames

Project description

I wanted a better way of exploring and downloading raw data from the ENCODE project.

For example, I’d like to get the BAM files for all ChIP-seq experiments done in uninduced MEL cells (from the mm9 assembly).

One strategy would be to individually go through each track hub (e.g., histone mods from LICR, http://genome.cit.nih.gov/cgi-bin/hgFileUi?db=mm9&g=wgEncodeLicrHistone), filter data, and download files individually.

Another strategy would be to go directly to the download page (http://hgdownload.cse.ucsc.edu/goldenPath/mm9/encodeDCC/wgEncodeLicrHistone/) and extract the files that end in .bam.

This small package takes advantage of the files.txt files (here’s an example) that describe all the metadata on the download page.

The files.txt files are downloaded from each ENCODE track hub in the assembly of interest. Then these files are parsed and concatenated together into one big pandas.DataFrame that can be used to find the data you care about.

Installation

pip install encode-dataframe

Usage

Mirror the files. This may take a minute or so. If you’ve cloned the git repo, you already have a copy of the mm9 files.

>>> import encode_dataframe as edf
>>> edf.mirror_metadata_files('mm9')

Create a large DataFrame:

>>> df = edf.encode_dataframe('mm9')
>>> len(df)
5865

Armed with the dataframe, we can now slice and dice to get the data we care about. Eventually I’d like to run a ChromHMM segmentation on MEL cells, but I need to get the data first …

Choose a cell type

>>> interesting = df.cell == 'MEL'

And only BAM files

>>> interesting &= df.type == 'bam'

And only ChIP- or DNase-seq

>>> interesting &= df.dataType.isin(['ChipSeq', 'DnaseSeq'])

And only untreated (in this case, uninduced) cells:

>>> interesting &= df.treatment != 'DMSO_2.0pct'

And only one replicate (some have 2 or 3)

>>> interesting &= df.replicate == '1'

And only those that don’t have some issue with them (looks like older versions have some text in the objStatus field):

>>> interesting &= df.objStatus.isnull()

How many do we have to work with?

>>> m = df[interesting]
>>> len(m)
60

Some of these are controls (input or IgG), and there are some duplicates (looks like H3K4me3 ChIP-seq uses 2 different controls; CTCF was done by different groups). How many unique antibodies?

>>> len(m.antibody.unique())
46

So here are the files I should download:

>>> urls = m.url.values

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

encode-dataframe-0.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

encode_dataframe-0.1-py2.py3-none-any.whl (5.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file encode-dataframe-0.1.tar.gz.

File metadata

File hashes

Hashes for encode-dataframe-0.1.tar.gz
Algorithm Hash digest
SHA256 5350067688e83d3f093cb3181ab087de720aa43d6086bec3cbedfc0bdc987228
MD5 87d738103c364160648689bfe724b4f9
BLAKE2b-256 d1b4e71596bcddc05ae1cf1dfe6dedc9f15dcb87b08f8a4e7111cdc4497590d3

See more details on using hashes here.

File details

Details for the file encode_dataframe-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for encode_dataframe-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 35531d104c716c6f42f1569dfb2dbc0b79924802a19fe03de36a573d150238aa
MD5 09d15c1f341867d0927284f7fc736e4a
BLAKE2b-256 cc12ba0fd98f1843543812bb49279a1209bb4be9879db6026dd72829ca4d0cbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page