GangCaoLab / CoolBox

Jupyter notebook based genomic data visualization toolkit.
https://gangcaolab.github.io/CoolBox/index.html
GNU General Public License v3.0
224 stars 37 forks source link

Couldn't change bin width of histgram #65

Closed zhouzhendiao closed 2 years ago

zhouzhendiao commented 2 years ago

I have a bed with overlap regions, when I transfer bed file to bedgraph , bigwig format and plot by BED(), BedGraph(), BigWig

frame = XAxis() + \
        BED(probe_file, display='stacked') + \
        BedGraph(bg) + \
        BigWig(bwfile, min_value=0) + \

frame.plot(reg)

image

I want those histograms with bin width = 1. However, I couldn't find the corresponding parameters.

By the way, there are 4 bed records in this region, but only 3 ploted.

Nanguage commented 2 years ago

What means "bin width = 1"? And can you provide your bed file?

zhouzhendiao commented 2 years ago

What means "bin width = 1"? And can you provide your bed file?

I want to plot the histogram with 1 bp resolution.

For example, in seaborn.histplot

sns.histplot(data=penguins, x="flipper_length_mm", binwidth=3)

histplot_5_0

zhouzhendiao commented 2 years ago

What means "bin width = 1"? And can you provide your bed file?

my bed:

1       11854395        11854494
1       11854420        11854519
1       11854445        11854544
1       11854470        11854569
1       11856297        11856396
1       11856322        11856421
1       11856347        11856446
1       11856372        11856471

bedgraph:

1       11854395        11854420        1
1       11854420        11854445        2
1       11854445        11854470        3
1       11854470        11854494        4
1       11854494        11854519        3
1       11854519        11854544        2
1       11854544        11854569        1
1       11856297        11856322        1
1       11856322        11856347        2
1       11856347        11856372        3

The bigwig were transferreded from bedgraph by bedGraphToBigWig.

Nanguage commented 2 years ago

The min resolution of BedGraph and BigWig is depend on your input file, in this case, your input resolution is large than 1bp.

zhouzhendiao commented 2 years ago

Thanks, but why BedGraph and BigWig plot different ways? I just transferred the file from BedGraph to Bigwig .

Nanguage commented 2 years ago

It's due to some historical problems, but these two different style has same information. We will set another parameter to control this in future.

zhouzhendiao commented 2 years ago

It's due to some historical problems, but these two different style has same information. We will set another parameter to control this in future.

OK, thanks!