Skip to main content

Plot genome track data

Project description

gtracks

Plot genome track data from bigWig files. Powered by pyGenomeTracks.

Installation

pip install gtracks

or

pip install --user gtracks

Examples

An example bigwig file with ATAC-seq data from the insulin region is included. You can generate a test plot like this:

gtracks INS-IGF2 test.png

test plot

You can plot your own tracks over other genomic regions by providing more positional arguments: a region or gene name and paths to one or more bigWig files. The file type of the plot will be determined by the output file extension.

gtracks chr11:2150341-2182439 track1.bw track2.bw output.pdf
gtracks INS track1.bw track2.bw output.svg

Modifying the gene annotations track

GRCh37/hg19 gene annotations are used by default, but you can plot GRCh38/hg38 genes by adding --genes GRCh38 or --genes hg38. You can use your own gene annotations file (BED or BED12 format) by providing --genes <path/to/genes.bed.gz>.

You may want to add more rows to the genes track. You can do this using the --genes-height and --gene-rows options.

gtracks INS test-genes.png --genes-height 6 --gene-rows 6

test plot with more gene rows

Changing the color palette

You can change the color palette for bigWig tracks using the --color-palette option.

gtracks INS track1.bw track2.bw track3.bw output.pdf --color-palette "#color1" "#color2" "#color3"

Setting y-axis height

By default, tracks have different y-axis heights depending on signal height. You can set a uniform y-axis height for all tracks using the --max option.

gtracks INS track1.bw track2.bw track3.bw output.pdf --max 400

For more command-line options, see the usage page below.

Example with non-human data and BED track

This example command uses data from S. polyrhiza and includes a BED track.

gtracks --genes Sp9512 7:6975000-6989000 sp9512_frond_example.bw sp9512_turion_example.bw sp9512_frond_turion_dmr.bed test-non-human.png

test plot non human

Environment variables

If you want to use your own bigWig files but don't want to write out their paths every time you run gtracks, you can set your own default tracks using the environment variable GTRACKS_TRACKS.

export GTRACKS_TRACKS=track1.bw,track2.bw,track3.bw
gtracks output.pdf

You can also change the default gene annotations file and color palette using environment variables GTRACKS_GENES_PATH and GTRACKS_COLOR_PALETTE.

export GTRACKS_GENES_PATH=path/to/genes.bed.gz
export GTRACKS_COLOR_PALETTE="#color1,#color2,#color3"
gtracks output.pdf

Should your genomic coordinates take a different form from the included default regex, you may set a different default regex using GTRACKS_COORD_REGEX:

export GTRACKS_COORD_REGEX='[\s\S]+:[0-9]+-[0-9]+$'

Usage

usage: gtracks [-h] [--genes <{path/to/genes.bed.gz,GRCh37,GRCh38,hg19,hg38,Sp9512}>]
               [--color-palette <#color> [<#color> ...]] [--max <float>] [--tmp-dir <temp/file/dir>] [--width <int>]
               [--genes-height <int>] [--gene-rows <int>] [--x-axis {top,bottom,none}]
               [--vlines-bed <path/to/vlines.bed>] [--bed-labels]
               <{chr:start-end,GENE}> [<track.{bw,bed}> [<track.{bw,bed}> ...]] <path/to/output.{pdf,png,svg}>

Plot bigWig signal tracks and gene annotations in a genomic region

positional arguments:
  <{chr:start-end,GENE}>
                        coordinates or gene name to plot
  <track.{bw,bed}>      bigWig or bed files containing tracks
  <path/to/output.{pdf,png,svg}>
                        path to output file

optional arguments:
  -h, --help            show this help message and exit
  --genes <{path/to/genes.bed.gz,GRCh37,GRCh38,hg19,hg38,Sp9512}>
                        compressed 6-column BED file or 12-column BED12 file containing gene annotations. Alternatively,
                        providing a genome identifier will use one of the included gene tracks. (default: GRCh37)
  --color-palette <#color> [<#color> ...]
                        color pallete for tracks
  --max <float>         max value of y-axis
  --tmp-dir <temp/file/dir>
                        directory for temporary files
  --width <int>         width of plot in cm (default: 40)
  --genes-height <int>  height of genes track (default: 2)
  --gene-rows <int>     number of gene rows (default: 1)
  --x-axis {top,bottom,none}
                        where to draw the x-axis (default: top)
  --vlines-bed <path/to/vlines.bed>
                        BED file defining vertical lines
  --bed-labels          include labels on BED tracks
  --coord-regex <regex>
                        regular expression indicating the format for coordinates (default: ([Cc]hr)?[0-9XY]+:[0-9]+-[0-9]+$)

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

gtracks-1.10.0.tar.gz (8.4 MB view details)

Uploaded Source

Built Distribution

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

gtracks-1.10.0-py3-none-any.whl (8.4 MB view details)

Uploaded Python 3

File details

Details for the file gtracks-1.10.0.tar.gz.

File metadata

  • Download URL: gtracks-1.10.0.tar.gz
  • Upload date:
  • Size: 8.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/0.0.0 pkginfo/1.8.2 readme-renderer/27.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.4.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for gtracks-1.10.0.tar.gz
Algorithm Hash digest
SHA256 748c767665b2a3212479acf30f24e06ad4833a9f44902b77acb02eafc76fecf6
MD5 0a25ac10752d0da94fefb51c4c338258
BLAKE2b-256 0626c8f8253c2a637f37839310f5c9831af5ab0d77d4dc19c623ce35513b74ca

See more details on using hashes here.

File details

Details for the file gtracks-1.10.0-py3-none-any.whl.

File metadata

  • Download URL: gtracks-1.10.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/0.0.0 pkginfo/1.8.2 readme-renderer/27.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.4.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for gtracks-1.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b9f93e81a2679bae4f5b5775054ec778807d38936bf7d0de8f1a0a67d6eb329
MD5 ce59c64e07ce5ae462a84bbf75fdc888
BLAKE2b-256 61b441d3c459966bd4f0ff3c61e1cf8cd9f53c8b5a74012f40839ac5ed0fce97

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