bamCoverage ZeroDivisionError
1
0
Entering edit mode
22 months ago
Luca ▴ 20

Hello,

I'm trying to create some bigwig files from a set of bams using bamCoverage. These bams were generated using Rsubread, in a paired end setting, (from RNA-seq) with a mapping rate of about 75% on average. Whenever I try to run bamCoverage on any of them I get this error, with the following traceback:

WARNING! 'P45F2H_S93_L003.fastq.gz.subread.BAM' does not have any mapped reads. Please check that the file is properly indexed and that it contains mapped reads.
WARNING! 'P45F2H_S93_L003.fastq.gz.subread.BAM' does not have any mapped reads. Please check that the file is properly indexed and that it contains mapped reads.
Traceback (most recent call last):
  File "/usr/bin/bamCoverage", line 12, in <module>
    main(args)
  File "/usr/lib/python3/dist-packages/deeptools/bamCoverage.py", line 256, in main
    wr.run(writeBedGraph.scaleCoverage, func_args, args.outFileName,
  File "/usr/lib/python3/dist-packages/deeptools/writeBedGraph.py", line 131, in run
    genome_chunk_length = getGenomeChunkLength(bam_handles, self.binLength, self.mappedList)
  File "/usr/lib/python3/dist-packages/deeptools/writeBedGraph.py", line 337, in getGenomeChunkLength
    genomeChunkLength = int(min(5e6, int(2e6 / (max_reads_per_bp * len(bamHandles)))))
ZeroDivisionError: float division by zero

I noticed the warning prior to the error, however, these bams contain mapped reads as I've used them in downstream differential expression analysis. Additionally, all indexed .bai files are in the same folder and follow the .bam.bai convention. Really confused here, any help is appreciated.

Thanks

samtools featureCounts bamCoverage Rsubread • 880 views
ADD COMMENT
0
Entering edit mode
22 months ago
Luca ▴ 20

I solved it. Can't explain why this would be the case, perhaps someone more familiar with the inner workings of Rsubread could explain but here it goes:

Rsubread indexed my files automatically for me in the *.bam.bai format. It was these files that were not being read properly by bamCoverage. Running samtools index on the bam created a new .bam.bai file (of note, roughly 2x the size as the one created by Rsubread) and using that index file instead of the Rsubread one allowed bamCoverage to work.

ADD COMMENT

Login before adding your answer.

Traffic: 1595 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