In this example, we plot genomic tracks using the plotGenomeTrack function.
from pkg_resources import resource_filename
from janggu.data import Cover
from janggu.data import HeatTrack
from janggu.data import LineTrack
from janggu.data import plotGenomeTrack
Using TensorFlow backend.
First we load some sample data in bed and bigwig format.
roi = resource_filename('janggu',
'resources/sample.bed')
bw_file = resource_filename('janggu',
'resources/sample.bw')
cover = Cover.create_from_bigwig('coverage1',
bigwigfiles=[bw_file] * 2,
conditions=['rep1', 'rep2'],
roi=roi,
binsize=200,
stepsize=200,
resolution=50)
cover2 = Cover.create_from_bigwig('coverage2',
bigwigfiles=bw_file,
roi=roi,
binsize=200,
stepsize=200,
resolution=50)
We can provide a list of the Cover objects directly that should be inspected along with the genomic coordinates.
plotGenomeTrack([cover, cover2],
'chr1', 16000, 18000)
/mnt/storage/wolfgang/wolfgang/src/janggu/src/janggu/data/coverage.py:1602: FutureWarning: Convert the Dataset object to proper Track objects. In the future, only Track objects will be supported. FutureWarning) /mnt/storage/wolfgang/wolfgang/src/janggu/src/janggu/data/coverage.py:1626: FutureWarning: Convert the Dataset object to proper Track objects. In the future, only Track objects will be supported. FutureWarning)
While the above expression plots the coverage tracks with default settings, the Track classes provide additional flexibility.
plotGenomeTrack([HeatTrack(cover), LineTrack(cover2, marker=0, color='r')],
'chr1', 16000, 18000)
If necessary, it is also possible to derive custom Track classes for plotting genome tracks.