Skip to main content

Command-line tool to make beautiful and reproducible genome browser snapshots

Project description

PyPI Version bioconda-badge bioconda-badge Build Status on Azure Coverage European Galaxy server

pyGenomeTracks

Standalone program and library to plot beautiful genome browser tracks

pyGenomeTracks aims to produce high-quality genome browser tracks that are highly customizable. Currently, it is possible to plot:

  • bigwig
  • bed/gtf (many options)
  • bedgraph
  • bedgraph matrices (like TAD-separation scores)
  • epilogos
  • narrow peaks
  • links (represented as arcs, triangles or squares)
  • Hi-C matrices (as triangle or squares)
  • fasta
  • maf (multiple alignment format)

Here is a scheme which describe how pyGenomeTracks is working (graphical abstract of Lopez-Delisle et al. 2020):

pyGenomeTracks

pyGenomeTracks can make plots with or without Hi-C data. The following is an example output of pyGenomeTracks from Ramírez et al. 2017

pyGenomeTracks example

Table of content

Installation

pyGenomeTracks works with python >=3.7.

The recommended way to install pyGenomeTracks is via conda

conda create -n pygenometracks -c bioconda -c conda-forge pygenometracks python=3.7

To get a specific version, one can specify it. For example:

conda create -n pygenometracks -c bioconda -c conda-forge pygenometracks=3.5 python=3.7

However, we noticed that conda installation can be quite slow so using mamba can help. You first need to create the environment and install mamba:

conda create -n pygenometracks -c bioconda -c conda-forge mamba python=3.7

Then activate the environment and install pygenometracks with mamba:

conda activate pygenometracks
mamba install -c defaults -c bioconda -c conda-forge pygenometracks

or if you want a specific version:

conda create -n pygenometracks -c bioconda -c conda-forge mamba python=3.7
conda activate pygenometracks
mamba install -c defaults -c bioconda -c conda-forge pygenometracks=3.5

Also, pyGenomeTracks can be installed using pip

pip install pyGenomeTracks

Since version 3.5, pyGenomeTracks uses BEDTools, don't forget to install it or load it into your environment.

Usage

To run pyGenomeTracks a configuration file describing the tracks is required. The easiest way to create this file is using the program make_tracks_file which creates a configuration file with defaults that can be easily changed. The format is:

make_tracks_file --trackFiles <file1.bed> <file2.bw> ... -o tracks.ini

make_tracks_file uses the file ending to guess the file type.

Then, a region can be plotted using:

pyGenomeTracks --tracks tracks.ini --region chr2:10,000,000-11,000,000 --outFileName nice_image.pdf

The ending --outFileName defines the image format. If .pdf is used, then the resulting image is a pdf. The options are pdf, png and svg.

Description of other possible arguments:

optional arguments:
  -h, --help            show this help message and exit
  --tracks TRACKS       File containing the instructions to plot the tracks.
                        The tracks.ini file can be genarated using the
                        `make_tracks_file` program.
  --region REGION       Region to plot, the format is chr:start-end
  --BED BED             Instead of a region, a file containing the regions to
                        plot, in BED format, can be given. If this is the
                        case, multiple files will be created. It will use the
                        value of --outFileName as a template and put the
                        coordinates between the file name and the extension.
  --width WIDTH         figure width in centimeters (default is 40)
  --plotWidth PLOTWIDTH
                        width in centimeters of the plotting (central) part
  --height HEIGHT       Figure height in centimeters. If not given, the figure
                        height is computed based on the heights of the tracks.
                        If given, the track height are proportionally scaled
                        to match the desired figure height.
  --title TITLE, -t TITLE
                        Plot title
  --outFileName OUTFILENAME, -out OUTFILENAME
                        File name to save the image, file prefix in case
                        multiple images are stored
  --fontSize FONTSIZE   Font size for the labels of the plot (default is 0.3 *
                        figure width)
  --dpi DPI             Resolution for the image in case the ouput is a raster
                        graphics image (e.g png, jpg) (default is 72)
  --trackLabelFraction TRACKLABELFRACTION
                        By default the space dedicated to the track labels is
                        0.05 of the plot width. This fraction can be changed
                        with this parameter if needed.
  --trackLabelHAlign {left,right,center}
                        By default, the horizontal alignment of the track
                        labels is left. This alignemnt can be changed to right
                        or center.
  --decreasingXAxis     By default, the x-axis is increasing. Use this option
                        if you want to see all tracks with a decreasing
                        x-axis.
  --version             show program's version number and exit

Citation

If you use pyGenomeTracks in your analysis, you can cite the following papers:

Fidel Ramírez, Vivek Bhardwaj, Laura Arrigoni, Kin Chung Lam, Björn A. Grüning, José Villaveces, Bianca Habermann, Asifa Akhtar & Thomas Manke. High-resolution TADs reveal DNA sequences underlying genome organization in flies. Nature Communications (2018) doi:10.1038/s41467-017-02525-w

Lopez-Delisle L, Rabbani L, Wolff J, Bhardwaj V, Backofen R, Grüning B, Ramírez F, Manke T. pyGenomeTracks: reproducible plots for multivariate genomic data sets. Bioinformatics. 2020 Aug 3:btaa692. doi: 10.1093/bioinformatics/btaa692. Epub ahead of print. PMID: 32745185.

Documentation

Our documentation provide examples, as well as the full list of possible parameters and guidelines for developers who would like to add a new track type.

External users

  • CoolBox is an interactive genomic data explorer for Jupyter Notebooks
  • Galaxy integration offers a graphical user-interface to create PGT plots. It is also possible to include PGT into workflows and automatic pipelines.

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

pyGenomeTracks-3.7.tar.gz (96.5 kB view details)

Uploaded Source

Built Distribution

pyGenomeTracks-3.7-py2.py3-none-any.whl (112.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyGenomeTracks-3.7.tar.gz.

File metadata

  • Download URL: pyGenomeTracks-3.7.tar.gz
  • Upload date:
  • Size: 96.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.13

File hashes

Hashes for pyGenomeTracks-3.7.tar.gz
Algorithm Hash digest
SHA256 600bb836e78a50408d702140ac68248f8442c54201fe07e780e7b6b3e35e62df
MD5 8c19f1b5e38dcc6a43e1da89bb3b80b4
BLAKE2b-256 040c1672a9baec643d53afbdf7ccfb59537c0baac6a0464a2f3eb19dbde7ccb2

See more details on using hashes here.

Provenance

File details

Details for the file pyGenomeTracks-3.7-py2.py3-none-any.whl.

File metadata

  • Download URL: pyGenomeTracks-3.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 112.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.13

File hashes

Hashes for pyGenomeTracks-3.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6374eef5d5b4c7a1ae7b3dbea1b61d67299e3d86f268fab472969b215b1416dc
MD5 5ab672fe42c8c84ba824f1045644f9ea
BLAKE2b-256 b84c6e6d28fb91e3f1055b6cc6b9807f1cbe7b97b947ca117219642bedf4b4a9

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