Ensembl / WiggleTools

Basic operations on the space of numerical functions defined on the genome using lazy evaluators for flexibility and efficiency
Apache License 2.0
143 stars 25 forks source link

wiggletools seek combines regions with multiple zero points (undesiderable) #68

Closed SimonaSecomandi closed 3 years ago

SimonaSecomandi commented 3 years ago

Hi,

I'm trying to extract a region from a wiggle file like so:

wiggletools write output.wig seek SUPER_6 53887433 53926022 file.wig

The wig file has base-by-base values and this command tends to combine regions with multiple zero values like so:

.... 0.446000 0.447000 -0.574000 0.447000 0.447000 0.429000 SUPER_6 53889550 53889558 0.000000 fixedStep chrom=SUPER_6 start=53889559 step=1 -0.323000 -0.574000 -1.049000 0.524000 -0.231000 0.447000 0.447000 ...

This is undesideble and the conversion of the wig file in bed format fails due to that lines (e.g. SUPER_6 53889550 53889558 0.000000).

Can this merging be avoided? Many thanks.

dzerbino commented 3 years ago

Dear @SimonaSecomandi ,

I think what you want is the write_bg command that writes straight to bedGraph, as in:

wiggletools write_bg output.wig seek SUPER_6 53887433 53926022 file.wig

Hope this helps,

Daniel

SimonaSecomandi commented 3 years ago

That worked fine to obtain the bed file!!

I was also wondering if there are ways to obtain a correct wig file with wiggletools seek for visualization.

Many thanks

dzerbino commented 3 years ago

Excellent!

The bedGraph format is a valid subset of the wig specification, therefore this output if both a bed and a wig file.