Skip to main content

A small library to plot Bismark methylation_exctractor reports.

Project description

BismarkPlot

A small library to plot Bismark methylation_extractor reports.

See the docs: https://shitohana.github.io/BismarkPlot

Right now only coverage2cytosine input is supported, but support for bismark2bedGraph will be added soon.

Installation

pip install bismarkplot

Usage

You can use bismarkplot either as python library or directly from console after installing it. To see options:

bismarkplot --help

Examples

Example in command line

bismarkplot --genome path/to/genome.gff --flength 2000 --mlength 4000 --fwindows 500 --gwindows 2000 --line-plot --heat-map --box-plot --bar-plot --labels exp1 exp2 --resolution 100 --format pdf path/to/genomeWide1.txt path/to/genomeWide2.txt

This command will generate line plots and heat maps pdf files for all contexts and box and bar plots.

Example in python script

If using bismarkplot as python library is more suitable for you, you can call bismarkplot methods right from python script.

First we need to initialize genome and BismarkFiles. genome is .gff or .bed file with gene coordinates. BismarkFiles is a class, which calculates data for all plots, so their types need to be specified when it is initialized.

import bismarkplot

file = 'path/to/genome.gff'

genome = bismarkplot.read_genome(
    file,
    flank_length=2000,
    min_length=4000
)

files = ['path/to/genomeWide1.txt', 'path/to/genomeWide2.txt']
bismark = bismarkplot.BismarkFiles(
    files, genome,
    flank_windows=500,
    gene_windows=2000,
    line_plot=True,
    heat_map=True,
    box_plot=True,
    bar_plot=True
)

Let's now draw plots themselves.

For line plots use (or draw_line_plots_all for all contexts)

bismark.draw_line_plots_filtered(
    context='CG',
    strand='+',
    smooth=.05,
    labels = ['exp1', 'exp2'],
    title = 'Plot for CG+'
) 
Plot for CG+

For heat maps use (or draw_heat_maps_all for all contexts)

bismark.draw_heat_maps_filtered(
    context='CG',
    strand='+',
    resolution=100,
    labels = ['exp1', 'exp2'],
    title = 'Heatmap for CG+'
)   
Heatmap for CG+

For box plot or bar plot use

bismark.draw_box_plot(strand_specific=True, labels=['exp1', 'exp2'])
bismark.draw_bar_plot(labels=['exp1', 'exp2'])
box_05_07_23:54.png bar_05_07_23:54.png

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

bismarkplot-1.2.tar.gz (38.7 kB view hashes)

Uploaded Source

Built Distribution

bismarkplot-1.2-py3-none-any.whl (37.3 kB view hashes)

Uploaded Python 3

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