Question: From BAM to BAI to BIGWIG
0
gravatar for raquelgarza95
4 weeks ago by
raquelgarza9530 wrote:

Hello,

I have indexed my bam files as:

> samtools index -b file.bam

I get as a result a file.bam.bai. But when I try to convert it to BigWig with bamCoverage as:

> bamCoverage -b file.bam.bai -o file.bw

I get the following error:

[E::hts_hopen] fail to open file 'file.bam.bai'
[E::hts_open_format] fail to open file 'file.bam.bai'
The file file.bam.bai does not have BAM format

The error persists if I change the file name to file.bam.bai.

I checked with samtools flagstat, and I get the same error

> samtools flagstat file.bam.bai
[E::hts_hopen] fail to open file 'file.bam.bai'
[E::hts_open_format] fail to open file 'file.bam.bai'
samtools flagstat: Cannot open input file "file.bam.bai": Exec format error

If I dont index the bam file bamCoverage tells me i MUST index it first...

I think I have done this before without any problems and I dont understand why am I getting this error. Could it be that the files are corrupted? Any help is well appreciated!

ADD COMMENTlink modified 4 weeks ago by h.mon24k • written 4 weeks ago by raquelgarza9530
4
gravatar for h.mon
4 weeks ago by
h.mon24k
Brazil
h.mon24k wrote:

The .bai file is just an index, you have to convert the .bam file to bigWig - as shown on the bamCoverage documentation:

bamCoverage -b reads.bam -o coverage.bw
ADD COMMENTlink modified 4 weeks ago • written 4 weeks ago by h.mon24k

Wow, that was simple! Thank you so much! :)

ADD REPLYlink written 4 weeks ago by raquelgarza9530
1

If an answer was helpful, please consider to mark it as accepted.

enter image description here

ADD REPLYlink written 4 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: 1111 users visited in the last hour