Question: From BAM to BAI to BIGWIG
0
gravatar for compuTE
19 months ago by
compuTE50
compuTE50 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 19 months ago by h.mon31k • written 19 months ago by compuTE50
7
gravatar for h.mon
19 months ago by
h.mon31k
Brazil
h.mon31k 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 19 months ago • written 19 months ago by h.mon31k

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

ADD REPLYlink written 19 months ago by compuTE50
1

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

enter image description here

ADD REPLYlink written 19 months ago by ATpoint38k

Hi,

I run the command line "bamCoverage -b reads.bam -o coverage.bw" in order to convert bam RNA-seq data to .bw files and I get error "command not found". Please advise what is wrong there. Thank you

ADD REPLYlink written 5 months ago by kri.bio0
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: 1566 users visited in the last hour