Question: BigWig library for Java
gravatar for bow
4.7 years ago by
bow790 wrote:

Does anybody have recommended Java or Scala library for writing BigWig / BedGraph files?

I am aware that there is a Java bigwig library that was developed by the IGV team. However, it seems to only provide BigWig / BedGraph reading functions; nothing on writing. After contacting the developers I was told that the library will not be further developed.

I am also aware that there are ways to make Java work with the C library (there are ways to make Java work with the C library). What I am looking for, however, is a pure Java (preferrably Scala) library.

This feels like like something that could have been used by a number of people out there. So before I even attempt to reinvent the wheel, I feel like I should ask :).

bigwig java bedgraph • 1.7k views
ADD COMMENTlink modified 8 months ago by holgerbrandl30 • written 4.7 years ago by bow790
gravatar for holgerbrandl
8 months ago by
holgerbrandl30 wrote:

There is a bigwig library for Kotlin which runs on the JVM. And since kotlin can be used from Java (see it might be an option for you.

ADD COMMENTlink written 8 months ago by holgerbrandl30
gravatar for Brian Bushnell
4.7 years ago by
Walnut Creek, USA
Brian Bushnell16k wrote:

I suggest you avoid Wig and Bed formats; they're poorly designed.  Are you sure you absolutely need them?

ADD COMMENTlink written 4.7 years ago by Brian Bushnell16k

Not wig and bed per se, but yes, I do need them. Unless there is a similar (or better) format that allows me to view tracks without uploading them to the track browser..

ADD REPLYlink written 4.7 years ago by bow790
Can you suggest any replacements for wig and bed?
ADD REPLYlink written 4.7 years ago by Fedor Gusev210

I don't know what IGV specifically requires for a track; personally, I find their coverage plot from bam+bai files to be sufficient for most uses.  What exactly do you need that is not present in the bam files or IGV display of bam files?  I might already be able to generate it.

ADD REPLYlink written 4.7 years ago by Brian Bushnell16k

I need to share data with other people and sometimes load them into the track browser myself. BAM files are not that suitable because wading through multiple BAM files in IGV slows it down quite a lot. This is not the case with BigWig files. It's also easier and more compact to share BigWig files given their size.

ADD REPLYlink written 4.7 years ago by bow790

Other advantages of bigwig/tdf. 1) it keeps mean/median depth for different window lengths. When you zoom out to the entire chromosome, IGV can only display depth with bigwig/tdf. 2) The index of bigwig/tdf is integrated in data and the index can be retrieved partially. This is much more convenient for remote access.

ADD REPLYlink written 4.7 years ago by lh331k
gravatar for dariober
4.7 years ago by
WCIP | Glasgow | UK
dariober10k wrote:

If you want something manageable for IGV look at the TDF format which can be created with igvtools.

If you want to create bigwig from bam you could use bedtools genomeCoverageBed followed by bedGraphToBigWig (from UCSC utilities). So something on these lines:

genomeCoverageBed -bg -ibam aln.bam > tmp.bedGraph &&
bedGraphToBigWig tmp.bedGraph chromInfo.txt &&
rm tmp.bedGraph

This doesn't answer your question for Java libraries but from your comments I thought it could help...

ADD COMMENTlink written 4.7 years ago by dariober10k

Hmm..the TDF format is usable only within IGV it seems?

And yes, I am aware of other ways to create BigWig files from BAM files. This is actually the way we are doing this now in-house. But we're trying to reduce external dependencies (that step, for example, requires 2 executables and 1 extra data file, not to mention unecessary disk space for the intermediate file), since this makes it more difficult to share things (also when we work on different environments). Not a new problem really. So we want to move this into our Scala-based toolkit. All the information to create the BigWig file is already present in the BAM file anyway, so I thought this should be doable via a single step without any extra data files.

ADD REPLYlink modified 4.7 years ago • written 4.7 years ago by bow790

I see... In fact I'm surprised myself that the bam -> bigwig conversion is somewhat clunky at the moment.

ADD REPLYlink written 4.7 years ago by dariober10k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 919 users visited in the last hour