deeptools / pyGenomeTracks

python module to plot beautiful and highly customizable genome browser tracks
GNU General Public License v3.0
758 stars 111 forks source link

Bigwig display at base pair zoom level #452

Closed antunderwood closed 1 year ago

antunderwood commented 1 year ago

Welcome to the pyGenomeTracks GitHub repository! Before opening the issue please check that the following requirements are met :

INFO:pygenometracks.tracksClass:initialize 1. [bigwig file test] INFO:pygenometracks.tracksClass:initialize 2. [sequence] INFO:pygenometracks.tracksClass:initialize 3. [x-axis] INFO:pygenometracks.tracksClass:time initializing track(s): INFO:pygenometracks.tracksClass:0.12220454216003418 DEBUG:pygenometracks.tracksClass:Figure size in cm is 40 x 6.781914893617022. Dpi is set to 72

INFO:pygenometracks.tracksClass:plotting 1. [bigwig file test] INFO:pygenometracks.tracksClass:plotting 2. [sequence] INFO:pygenometracks.tracksClass:plotting 3. [x-axis]

I used the following ini file

[bigwig file test]
file = bigwig.bw
# height of the track in cm (optional value)
height = 4
title = breaks
min_value = 0
max_value = 5
alpha = 1
# type = line:5
type = fill
summary_method = mean
number_of_bins = 300
file_type = bigwig
[sequence]
file = /shared/home/anthony/s3-mounts/accessory_files/bwa_indices/hg19/refseq/hg19.fasta
file_type = fasta
[x-axis]

I want to display bigwig files at base zoom level along with the sequence. However the bars appear faint at this zoom level. Can you suggest an alternative format or command so that I can have a bar per base. Thanks

image

lldelisle commented 1 year ago

Hi, I think there are 2 options:

  1. Use the same number of bins as the number of bases.
  2. Convert your bigwig to bedgraph so you can see a 'barplot'. The output will be different so I suggest you to test both. If you need help for one or the other, tell me.
antunderwood commented 1 year ago

Many thanks for the quick reply. If I have this ini

[bigwig file test]
file = bigwig.bw
# height of the track in cm (optional value)
height = 4
title = breaks
min_value = 0
max_value = 5
alpha = 1
number_of_bins = 100
file_type = bigwig
[sequence]
file = /shared/home/anthony/s3-mounts/accessory_files/bwa_indices/hg19/refseq/hg19.fasta
file_type = fasta
[x-axis]

with this command pyGenomeTracks --tracks bigwig_track.ini --region X:2,601,100-2,601,199 -o bigwig.png

I get this which is better but does not show histograms image

Using a bedgraph format (I dodn't know you could index them with tabix before!). I can get a nice output. Thanks image

antunderwood commented 1 year ago

A quick Q - is it possible to call the functions from within other python code using imports?

lldelisle commented 1 year ago

Hi, Yes it is possible but we do not document it because our 'API' is not fixed yet. See https://github.com/deeptools/pyGenomeTracks/issues/20 and https://github.com/deeptools/pyGenomeTracks/issues/445 for examples.