BGI-shenzhen / BamDeal

BamDeal: a comprehensive toolkit for bam manipulation
MIT License
52 stars 20 forks source link

cannot index extracted contigs #4

Open JWDebler opened 3 years ago

JWDebler commented 3 years ago

Hi,

I extracted individual contigs from a bam file using:

BamDeal_Linux modify bamSplit -r -i me14.sorted.again.bam and BamDeal_Linux modify bamSplit -i me14.sorted.again.bam

However, when I try to index the extracted contigs with samtools (1.13) I get this error:

samtools index ArME14_ctg_01.bam
[W::bam_hdr_read] EOF marker is absent. The input is probably truncated
[E::bgzf_read_block] Failed to read BGZF block data at offset 1146092758 expected 7118 bytes; hread returned 792
[E::bgzf_read] Read block operation failed with error 4 after 0 of 4 bytes
samtools index: failed to create index for "ArME14_ctg_01.bam": No such file or directory

Trying to index the original bam file me14.sorted.again.bam works just fine. Any idea what is going on?

I am using BamDeal 0.25

Cheers, Johannes

JWDebler commented 3 years ago

It looks like the problem was that I tried to index the bam files before bamSplit was finished.

hewm2008 commented 3 years ago

Dear @JWDebler

EOF marker is absent. The input is probably truncated
This error is just because your bam file is incomplete, so you need to regenerate this file

Linux generally cannot open too many files at the same time. I guess you have too many chr names, that is, an error occurs when you open too many files at the same time. I suggest that you can generate those scaf (contig) into the same bam. you can use _BamDealLinux modify bamAssign and see the help first _BamDealLinux modify bamAssign -h