error while reading bigwig files in computeMatrix (deeptools)
1
1
Entering edit mode
5.8 years ago
Lila M ★ 1.3k

Hi everybody, I'm trying to run this pipeline with bigwif files

computeMatrix reference-point --referencePoint TSS --beforeRegionStartLength 30 --afterRegionStartLength 300 -R transcribed_genes_sort.txt -S BJ_rep1_neg_strand.bw BJ_rep1_pos_strand.bw BJ_rep2_neg_strand.bw BJ_rep2_pos_strand.bw -bl DACblacklist.bed.gz --skipZeros -p 1 -o matrix_TSS.gz

and I get this error

[bwHdrRead] There was an error while reading in the header!
Traceback (most recent call last):
  File "/home/projas/.local/bin/computeMatrix", line 11, in <module>
    main(args)
  File "/home/projas/.local/lib/python3.5/site-packages/deeptools/computeMatrix.py", line 414, in main
    hm.computeMatrix(scores_file_list, args.regionsFileName, parameters, blackListFileName=args.blackListFileName, verbose=args.verbose, allArgs=args)
  File "/home/projas/.local/lib/python3.5/site-packages/deeptools/heatmapper.py", line 235, in computeMatrix
    chromSizes, _ = getScorePerBigWigBin.getChromSizes(score_file_list)
  File "/home/projas/.local/lib/python3.5/site-packages/deeptools/getScorePerBigWigBin.py", line 161, in getChromSizes
    fh = pyBigWig.open(fname)
RuntimeError: Received an error during file opening!

However, the header of the bigwig files is something like:

chr1    13264   13314   1.8
chr1    13444   13454   3
chr1    13454   13464   4.6
chr1    13464   13474   8.6

Any ideas? Thanks!

deeptools computeMatrix bigwig coverage • 6.8k views
ADD COMMENT
1
Entering edit mode

Tagging: Devon Ryan

ADD REPLY
1
Entering edit mode

It looks like the bigWig file itself simply got corrupted. Can you recreate or redownload it?

ADD REPLY
0
Entering edit mode

I did but still have the same error :/

ADD REPLY
1
Entering edit mode

This "header" that you showed, how did you obtain this? Is your file truely in bigwig format or is it a bedGraph with a wrong suffix. As always for these kind of questions, please share to full commands for bigwig creation.

ADD REPLY
1
Entering edit mode

what I did was: 1)wig to bigwig:

    wigToBigWig GSM2936611_BJ.c.a_merged_coverage_strand-_scaled_bin10_EXT0.copy2_lane2_rep1.wig.gz -clip  http://hgdownload.cse.ucsc.edu/goldenPath/hg19/bigZips/hg19.chrom.sizes BJ_lane1_rep1.bw

    wigToBigWig GSM2936611_BJ.c.a_merged_coverage_strand-_scaled_bin10_EXT0.copy2_lane2_rep1.wig.gz -clip  http://hgdownload.cse.ucsc.edu/goldenPath/hg19/bigZips/hg19.chrom.sizes BJ_lane2_rep1.bw

1)merge lane1 and lane2:

 bigWigMerge  BJ_lane1_rep1.bw BJ_lane2_rep1.bw BJ_rep1_neg_strand.bw
ADD REPLY
1
Entering edit mode

Can you post the bigWigs somewhere? I can take a look then.

ADD REPLY
0
Entering edit mode

Is there any way to send you the files?

ADD REPLY
0
Entering edit mode

In case this is useful for others, I would just like to mention that I had a similar error while using the Python API of deeptools. In my case the cause was that I passed pathlib.Path objects for the bigwig files. The solution was to transform them into strings using str.

ADD REPLY
1
Entering edit mode
5.8 years ago

For those wondering, the cause of the problem was that the input files were actually bedGraph (text files) rather than bigWigs (binary format). Presumably there was something wrong with the conversion command with UCSC tools.

ADD COMMENT
0
Entering edit mode

So is there other way to transform the files?

ADD REPLY
1
Entering edit mode

What is the file you started with? In your initial question, what you show is bedGraph, so chr-start-end-score. In the comment above, you mention WigToBigWig. If you have a bedGraph, use bedGraphToBigWig, else when having Wig, use WigToBigWig. Please clarify what format you have. All these tools are widely used and tested, so the error is your input format.

ADD REPLY
1
Entering edit mode

The file that I started with is a wig file like this:

GSM2936611_BJ.c.a_merged_coverage_strand-_scaled_bin10_EXT0.copy2_lane2_rep1.wig.gz

track type=wiggle_0 name=BJ.c.a.- description=BJ.c.a.- maxHeightPixels=50:30:11 color=150,50,110 alwaysZero=on
        variableStep chrom=chr1 span=10
        13265   0.9
        13275   0.9
        13285   0.9

Then I used this command line

   `wigToBigWig GSM2936611_BJ.c.a_merged_coverage_strand-_scaled_bin10_EXT0.copy2_lane2_rep1.wig.gz -clip  http://hgdownload.cse.ucsc.edu/goldenPath/hg19/bigZips/hg19.chrom.sizes BJ_lane2_rep1.bw

and I get as an output a bedgraph. So I dond't understand whats going on. PS. I downloaded the original files from here

ADD REPLY
1
Entering edit mode

I get a binary file out of this command, indicating bigwig. I do not know what is wrong in your case.

ADD REPLY
3
Entering edit mode

I find the silly problem, I forgot to transform the bedGraph after merging using bedGraphToBigWig

ADD REPLY
2
Entering edit mode

Good to hear :) For the future, in my experience when using standard tools, it is in like 99.9% always a user problem when things crash (happened to me many times before) so it is best to always script every step you do instead of just running things on the command line without documenting it. Doing so, you can reproduce all steps at any time.

ADD REPLY

Login before adding your answer.

Traffic: 2626 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6