Question: error while reading bigwig files in computeMatrix (deeptools)
0
gravatar for Lila M
8 weeks ago by
Lila M 460
UK
Lila M 460 wrote:

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!

ADD COMMENTlink modified 7 weeks ago by Devon Ryan88k • written 8 weeks ago by Lila M 460

Tagging: Devon Ryan

ADD REPLYlink written 8 weeks ago by genomax64k

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

ADD REPLYlink written 8 weeks ago by Devon Ryan88k

I did but still have the same error :/

ADD REPLYlink written 8 weeks ago by Lila M 460

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 REPLYlink written 8 weeks ago by ATpoint14k

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 REPLYlink modified 8 weeks ago • written 8 weeks ago by Lila M 460

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

ADD REPLYlink written 8 weeks ago by Devon Ryan88k

Is there any way to send you the files?

ADD REPLYlink written 8 weeks ago by Lila M 460
0
gravatar for Devon Ryan
7 weeks ago by
Devon Ryan88k
Freiburg, Germany
Devon Ryan88k wrote:

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 COMMENTlink written 7 weeks ago by Devon Ryan88k

So is there other way to transform the files?

ADD REPLYlink written 7 weeks ago by Lila M 460

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 REPLYlink written 7 weeks ago by ATpoint14k

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 REPLYlink modified 7 weeks ago • written 7 weeks ago by Lila M 460

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

ADD REPLYlink written 7 weeks ago by ATpoint14k
2

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

ADD REPLYlink written 7 weeks ago by Lila M 460
1

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 REPLYlink modified 7 weeks ago • written 7 weeks ago by ATpoint14k
Please log in to add an answer.

Help
Access

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