Exec format error in unmapped bam file
1
0
Entering edit mode
3.2 years ago
priya.bmg ▴ 60

Hello

I created unmapped bam file from fastq file (sample 1). When I tried to search the bam file using query name, I got the 'Exec format error'

Code:

samtools view 1_ucheck.bam | grep 'A00684:110:H2TYCDMXY:1:1101:2790:1000'

1_ucheck.bam: unmapped bam file from Sample 1 fastq file

Error:

[E::hts_hopen] Failed to open file 1_ucheck.bam
[E::hts_open_format] Failed to open file "1_ucheck.bam" : Exec format error
samtools view: failed to open "1_ucheck.bam" for reading: Exec format error

I am not sure about this error. Because from the same fastq file (sample 1), could also align with reference sequence and convert it into a bam file. When I tried to search using queryname in this bam file, it did not show any error. It would be helpful, if someone could help to understand the error in the unmapped bam file. Thanks

code:

samtools view alignedsample1.bam | grep 'A00684:110:H2TYCDMXY:1:1101:2790:1000'

alignedsample1.bam: mapped bam file from sample1 fastq file

output:

A00684:110:H2TYCDMXY:1:1101:2790:1000 99 NC_000012.12 10166659 60 101M = 10166871 313 TGATTGGACAGAAAGCTTCCACTATGTCTCCTTACCCACCCTTCTCCCAATACCTGAACAATTTGCTACTCTCTTCAGTGTTTCTTGGAGATTCAGATTCT FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:FFFFFFFFFFFFFFFFF:FFFFFFFF:FFFFFFFFFF:: NM:i:0 MD:Z:101 MC:Z:101M AS:i:101 XS:i:0
A00684:110:H2TYCDMXY:1:1101:2790:1000 147 NC_000012.12 10166871 60 101M = 10166659 -313 GCCGGGCTGAGATCTGTCCCTCCAGTTTCTTTTTCTGGTGAGTTAGGTTTGCTTGCTCTTGTGTTAGGAGGTCAGACACCTGGGATACTGAATCACAGTTG FFFFFFFFFFFFFFFFFFFFFFF:FFFFF,FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NM:i:0 MD:Z:101 MC:Z:101M AS:i:101 XS:i:20
bam samtools • 2.5k views
ADD COMMENT
0
Entering edit mode

what is your shell ? what is the output of which samtools ? what is the output of file 1_ucheck.bam ?

ADD REPLY
0
Entering edit mode

I am using SAMtools 1.12. There is no output for 1_ucheck.bam file (please find the error given above) and the file size of this unmapped bam file is 9228.78 Mb. I run the scripts in bash shell and schedule the jobs in slurm

ADD REPLY
0
Entering edit mode

Thank you for everyone's input

ADD REPLY
0
Entering edit mode
3.2 years ago

Exec format error from samtools means that the file was not in a format that samtools was able to process in this context. For samtools view 1_ucheck.bam with samtools 1.12, this means that the input file is not SAM/BAM/CRAM; in this case, that 1_ucheck.bam is really not a BAM file.

What commands did you use to create this file? What is actually in it? You can find out by using the file command as Pierre suggested, or the htsfile command, or by examining it directly (carefully, as it's likely not to be text):

file 1_ucheck.bam
…or…
htsfile 1_ucheck.bam
…or…
head 1_ucheck.bam | od -c

(The results might be different in samtools 1.13, which gained the ability to read FASTQ directly, reading it as unmapped SAM. I suspect this is what your 1_ucheck.bam file really contains.)

ADD COMMENT
0
Entering edit mode
 ![file 1_ucheck.bam
1_ucheck.bam: data][1]
ADD REPLY
0
Entering edit mode

So it is probably not text. What do the other two commands say?

ADD REPLY
0
Entering edit mode

I run validatesam (https://gatk.broadinstitute.org/hc/en-us/articles/360036854731-ValidateSamFile-Picard-) file command and there seems to java execution problem. I set the memory limit higher and converted the fastq to unmapped bam file and now it works without any error

ADD REPLY
0
Entering edit mode

I run validatesam (https://gatk.broadinstitute.org/hc/en-us/articles/360036854731-ValidateSamFile-Picard-) file command and there seems to java execution problem. I set the memory limit higher and converted the fastq to unmapped bam file and now it works without any error

ADD REPLY
0
Entering edit mode

Thank you

ADD REPLY

Login before adding your answer.

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