I ran the following the command to extract bam file for specific chromosomal locus.
samtools view -h accepted_hits.bam "EQ963475:334376-335722">AFLA_105440.bam
The result of command was generated with header file
<h6>first few lines output file</h6>@HD VN:1.0 SO:coordinate @SQ SN:EQ963472 LN:4469204 @SQ SN:EQ963473 LN:4149026 @SQ SN:EQ963474 LN:2713190 @SQ SN:EQ963475 LN:2658400 @SQ SN:EQ963476 LN:2555871 @SQ SN:EQ963477 LN:2388123 @SQ SN:EQ963478 LN:2337902
When I ran the below command for conversion of bam to fastq
samtools bam2fq AFLA_105440.bam >AFLA_105440.fq
it showing error like this: [bam_header_read] EOF marker is absent. The input is probably truncated. [bam_header_read] invalid BAM binary header (this is not a BAM file).
Possible reasons - Eof Marker Is Absent When Processing A Bam File
Hello muthubioinfotech!
Questions similar to yours can already be found at:
We have closed your question to allow us to keep similar content in the same thread.
If you disagree with this please tell us why in a reply below. We'll be happy to talk about it.
Cheers!
And it's cross posted see here
see that old post it didn't have any proper or appropriate explanation
The answers in old post were perfect explanation for this problem. Even more you have not provided much details on whether this BAM is downloaded or created on your own. Did you check all the chromosomes are present in BAM (if the data is not for any single chromosome) ?
The explanation was brief, the file is broken, or truncated. It might have been downloaded incompletely or the process terminated prematurely. To be sure try to read the whole file with samtools view. If that does complain too, the file is broken, if not it was this specific command (bam2fastq). If the file is broken, try to download it again and use a tool like wget or curl, and try to get a checksum for the download. If created yourself, check the output, maybe samtools was killed. One of the most common reasons we see for truncated files is simply 'disk full'.
Thanks for reply .I am sorry still I could not able to understand what were mention there.