Skip to main content

Python package wrapping some of the encode project APIs.

Project description

Travis CI build SonarCloud Quality SonarCloud Maintainability Codacy Maintainability Maintainability Pypi project Pypi total project downloads

Python package wrapping some of the encode project APIs.

How do I install this package?

As usual, just download it using pip:

pip install encodeproject

Tests Coverage

Since some software handling coverages sometimes get slightly different results, here’s three of them:

Coveralls Coverage SonarCloud Coverage Code Climate Coverate

Usage Examples

The package contains both methods to run queries on the Encode Project APIs and methods to filter the responses. Every available method has a comprehensive docstring attached to it, so I welcome you to read the source code.

Queries

The library currently offers to query methods that already integrate some filtering properties: one for the experiments and one for the biosamples.

For querying the experiments you can run the following:

from encodeproject import experiment

my_experiment_query_response = experiment(
    assembly="hg19", # The assembly label, for instance "hg19".
    status="released", # The release status, can be either "released", "archived" or "revoked".
    cell_line="HepG2", # The label for the chosen cell line for instance "HepG2".
    target="ARID3A", # The target name, for instance "ARID3A".
    parameters = {} # Additional query parameters
)

All parameters are optional, they just act as additional filters.

For querying the biosamples you can run the following:

from encodeproject import biosample

my_biosample_query_response = biosample(
    accession="ENCSR000EDP", # The accession code for the desired biosample
)

Filters

Since the response files can get quite big and hard to read, I’ve prepared also a couple filter functions.

For filtering the accessions codes from an experiment response you can use:

from encodeproject import accessions

codes = accessions(my_experiment_query_response)

For filtering the download URLs from a biosample response you can use:

from encodeproject import download_urls

codes = download_urls(my_biosample_query_response)

Utilities

Download utility

I’ve added also a method to download from a given URL, showing a loading bar, based on this answer from StackOverflow.

from encodeproject import download

download("https://encode-public.s3.amazonaws.com/2012/07/01/074e1b37-2be1-4f6a-aa42-6c512fd1834b/ENCFF000XOW.bigWig")

Sample to DataFrame instruction

Utility to convert a sample to a relatively simple pandas DataFrame.

from encodeproject import sample_to_dataframe

df = sample_to_dataframe(my_biosample_query_response)

Issues and Feature Requests

This library started out of necessity to script some queries on the encodeproject. If you need some specific feature that isn’t currently already offered by the library, please do proceed with a pull request (quickest way: add the feature yourself and push it on the library) or alternatively you can open an issue and when I’ll get the time I’ll see to it.

Project details


Download files

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

Source Distribution

encodeproject-1.0.13.tar.gz (6.0 kB view details)

Uploaded Source

File details

Details for the file encodeproject-1.0.13.tar.gz.

File metadata

  • Download URL: encodeproject-1.0.13.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for encodeproject-1.0.13.tar.gz
Algorithm Hash digest
SHA256 781c8e91c2b986f6cf0d31b5c04309c65e069e8306597625e065ff14c6a22415
MD5 ad85a3686562f683152bd14bfd892af7
BLAKE2b-256 e3851aa60e3826aed40dff9e9341488a7ead99227df8fc41915787ed9c062d69

See more details on using hashes here.

Provenance

Supported by

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