Error: Empty BAM file in DANPOS3
1
0
Entering edit mode
3.7 years ago
sshibin • 0

Hi everyone, I am currently trying to run the command in DANPOS3 - which is a software to analyse nucleosome positions and call peaks. This is the command

$python3 danpos.py dpos <filename.bam> [optional parameters]

The bam file I am using was created using Galaxy. So the reads were aligned using Bowtie2 and then using "samtools view" I obtained only chromosome 5 reads. I validated this file for any errors using "Validatesamfiles" which assess SAM/BAM files, I was able to conclude that there are no errors.

However, after running the above the command, I get the following error

ERROR: empty BAM file

Is something wrong with the header file? It looks like this with the @SQ for all chromosomes

@HD VN:1.0 SO:coordinate @SQ SN:chr10 LN:129993255`
@PG ID:bowtie2 PN:bowtie2 VN:2.3.4.1 CL:"/cvmfs/main.galaxyproject.org/deps/_conda/envs/mulled-v1-5bee08a20f60a5597c4ecd54735d608dc6a44caf6f433cd52f23c80aa5a38d02/bin/bowtie2-align-s --wrapper basic-0 -p 10 -x /cvmfs/data.galaxyproject.org/byhand/mm9/mm9full/bowtie2_index/mm9full -U input_f.fastq.gz"`

If there is no error in the BAM file when I validate, why would I get empty BAM file when I run the first mentioned command?? I am so new to this analysis of nucleosome positions, any insights into this will help!!

Thanks in advance

sequence nucleosome danpos galaxy • 1.7k views
ADD COMMENT
0
Entering edit mode

Hey, this is juste a hypothesis, but coud it be that DANPOS is checking if there are reads assigned to every chromosome listed in the bam header ? When it finds 0 reads for chromosome1, then it gets confused and say that the bam file is empty ? Perhaps you could try to remove the @SQ line for the "empty" chrosome (keep only chr5) or try to feed DANPOS with the full bam.

ADD REPLY
0
Entering edit mode

Given the horrible implementation of DANPOS I wouldn't be surprised if that was actually the case..

ADD REPLY
0
Entering edit mode

I'd post DANPOS3 issues directly to the dev's github: https://github.com/sklasfeld/DANPOS3/issues. DANPOS3 is a Python3 port of DANPOS/2, but from a 3rd party dev. The port has/used to have some issues, maybe this is one of them.

ADD REPLY
0
Entering edit mode

Hi, I got the same error for empty bam file. My bam files have been indexed and headers are kept. Do you figure it out? Appreciate it if you know any way to fix it. Thanks, shue

ADD REPLY
0
Entering edit mode
23 months ago

I've got the same error message, and it was a possible typo in the code. In "reads.py" around line 623,

num=0
    sam_reader = pysam.AlignmentFile(file, "rb")
    for sam in sam_reader.fetch():
        try:
            # skip unmapped reads
            if sam.isunmapped:continue

It seems " .isunmapped" is not a function of pysam.AlignmentFile. I changed the line to 'if sam.is_unmapped:continue' and it worked. Hope this helps.

ADD COMMENT

Login before adding your answer.

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