/bdgtools

Primary LanguagePythonMIT LicenseMIT

Bedgraph Tools

Pypi Travis ReadTheDocs PyUp

Tools to work efficiently with bedgraph files.

Installation

Use the package manager pip to install foobar.

pip install bdgtools

Usage

Command Line

Create signal plots of tss+-500 :

bdgplot tss CTCF_treat_pileup.bdg genes.bed --rs 1000

or a V-plot over entire gene bodies:

bdgplot v CTCF_treat_pileup.bdg genes.bed

Create average signal plot over peak regions

bdgplot average CTCF_treat_pileup.bdg CTCF_peaks.narrowPeak

or a heatmap over all peak regions

bdgplot average CTCF_treat_pileup.bdg CTCF_peaks.narrowPeak

Save figure to a png file

bdgplot v CTCF_treat_pileup.bdg CTCF_peaks.narrowPeak -o CTCF_vplot.png

or save figure data to pickle

bdgplot v CTCF_treat_pileup.bdg CTCF_peaks.narrowPeak -od CTCF_vplot_data.pkl

Python

Read bedgraph and bedfile from file and show a vplot:

from bdgtools import read_bedgraph, read_bedfile, VPlot, plot
bedgraph = read_bedgraph("CTCF_treat_pileup.bdg")
regions = read_bedfile("CTCF_peaks.narrowPeak")
max_peak_size = max(np.max(r.ends-r.starts) for r in regions)
plotter = VPlot(figure_width=1000)
df = plotter(bedgraph, regions)
plot(df, plotter, show=True)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Credits

This package was created with Cookiecutter_ and the audreyr/cookiecutter-pypackage_ project template.