Skip to main content

The Python GTF toolkit (pygtftk) package: easy handling of GTF files

Project description

Pip package

pippackage

Bioconda package

bioconda

License

license

Platforms

platform

Languages

lang

Build status

build

Repository size

size

Latest conda

latestconda

Downloads

downloads

Codacy

codacy

Contribution

contrib

Issues

issues

Citing pygtftk

citing_pygtftk

Citing OLOGRAM

citing_ologram

Documentation

documentation

Python GTF toolkit (pygtftk)

The Python GTF toolkit (pygtftk) package is intended to ease handling of GTF/GFF2.0 files (Gene Transfer Format). It currently does not support GFF3 file format. The pygtftk package is compatible with Python >=3.8,<3.9 and relies on libgtftk, a library of functions written in C.

The package comes with a set of UNIX commands that can be accessed through the gtftk program. The gtftk program proposes several atomic tools to filter, convert, or extract data from GTF files.

The newly released command, OLOGRAM (OverLap Of Genomic Regions Analysis using Monte Carlo) may be used to compute overlap statistics between user supplied regions (BED format) and annotation derived from :

  • Gene centric features enclosed in a GTF (e.g. exons, promoters, terminators…).

  • Regions in a GTFs flagged with built-in keys/values (e.g. check the ‘gene_biotype’ as provided by ensembl GTFs of the regions in which peaks fall).

  • Same with custom keys/values through the gtftk CLI (e.g. adding a numeric value to a gene and discretizing this value to create gene classes).

  • User supplied BED files.

With the most recent update, OLOGRAM is now also capable of computing the enrichment of n-wise combinations (ie. A+B, A+B+C, etc.) to find correlation groups of regions. Please see the documentation page of OLOGRAM for more details.

The gtftk set of Unix commands can be easily extended using a basic plugin architecture.

All these aspects are covered in the help sections ; please see the documentation.

While the gtftk Unix program comes with hundreds of unitary and functional tests, it is still in active development and may thus suffer from bugs that remain to be discovered. Feel free to post any problem or required enhancement in the issue section of the GitHub repository.

Documentation

Documentation about the latest release is available as a github page.

Documentation about OLOGRAM (OverLap Of Genomic Regions Analysis using Monte Carlo) can be found in the ‘ologram’ section of the documentation.

NB: The readthedoc version won’t be maintained and will be closed in the near future. This choice was motivated by the impossibility to maintain a dynamic documentation (using sphinx/sphinxcontrib-programoutput) given the computing time provided by readthedoc server.

Note that example dataset are available to test the various subcommands (see documentation page).

gtftk get_example -h # E.g. to get all file from the ‘simple’ dataset gtftk get_example -d simple -f “*”

System requirements

Depending on the size of the GTF file, pygtftk and gtftk may require lot of memory to perform selected tasks. A computer with 16Go is recommended in order to be able to pipe several commands when working with human annotations from ensembl release (e.g. 91). When working with a cluster think about reserving sufficient memory.

At the moment, the gtftk program has been tested on:

  • Linux (Ubuntu 12.04 and 18.04)

  • OSX (Yosemite, El Capitan, Mojave).

Installation

Installation through conda package building

Installation through conda should be the preferred install solution. The pygtftk package and gtftk command line tool require external dependencies (bedtools “>v2.23.1”, graphviz, unzip) with some version constrains.

If conda is not available on your system, first install miniconda from the official web site and make sure you have bioconda and conda-forge channels set up in the order below.

conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge

Then you can simply install pygtftk in its own isolated environment and activate it.

conda create -n pygtftk pygtftk
conda activate pygtftk

Installation through setup.py

This is not the preferred way for installation. Choose conda whenever possible. We have observed several issues with dependencies that still need to be fixed.

git clone http://git@github.com:dputhier/pygtftk.git pygtftk
cd pygtftk
# Check your Python version (>=3.8,<3.9)
pip install -r requirements.txt
python setup.py install

Installation through pip

Prerequisites

Again, this is not the preferred way for installation. Please choose conda whenever possible. We have observed several issues with dependencies that still need to be fixed.

Running pip

Installation through pip can be done as follow.

pip install -r requirements.txt
pip install pygtftk
# It is important to call gtftk -h
# to look for plugins and their
# CLI in ~/.gtftk
# before going further
gtftk -h

Testing

Running functional tests

A lot of functional tests have been developed to ensure consistency with expected results. This does not rule out that bugs may hide throughout the code… In order to check that installation is functional you may be interested in running functional tests. The definition of all functional tests declared in gtftk commands is accessible using the -p/–plugin-tests argument:

gtftk -p

To run the tests, you will need to install bats (Bash Automated Testing System). Once bats is installed run the following commands:

# The tests should be run in the pygtftk git
# directory because several tests contains references (relative path)
# to file enclosed in pygtftk/data directory.
gtftk -p > gtftk_test.bats
bats gtftk_test.bats

Note, alternatively you may directly call the tests using the Makefile.

make clean
make test

Or run tests in parallel using:

make clean
make test_para -j 10 # Using 10 cores

Running unitary tests

Several unitary tests have been implemented using doctests. You can run them using nose through the following command line:

make nose

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pygtftk-1.6.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (19.5 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

pygtftk-1.6.2-cp39-cp39-macosx_10_9_x86_64.whl (18.6 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pygtftk-1.6.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

  • Download URL: pygtftk-1.6.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
  • Upload date:
  • Size: 19.5 MB
  • Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for pygtftk-1.6.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e0e01236ea1648c04f69e9f312c945479401dd5d49c60ccfe9f2ec431fdb833f
MD5 0cff097fdab72d4a0a06636b20ceeda1
BLAKE2b-256 879d217f1394a1051cb25d0329922b6aab2c184dc93a0d2e5bcb788c42c92180

See more details on using hashes here.

File details

Details for the file pygtftk-1.6.2-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pygtftk-1.6.2-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 18.6 MB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for pygtftk-1.6.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 46e423479f89007940a49ede6ce409d8d9b23a763461d6837b05ee28865e1200
MD5 d0aad76ef69f234b7006d27e81c437a9
BLAKE2b-256 bec69791cb2bf6b351a8d667e179c723e3ec0bc46a3f4e6d7f31ce32bf6446d9

See more details on using hashes here.

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