Open SarahIsme opened 4 years ago
It seems bam index was missing, after sorting the bam file, run samtools index sorted.bam
Hi @SarahIsme.
Yes, I would agree with @thanhleviet. It's most likely the missing .bai files which is causing the problem.
I have a similar problem, except I have the sorted and indexed bam-file. The file has been created by bowtie2 (mapping) and samtools (view, sort, index) to get a sorted and indexed file ending with .bam.bai. Still, the concoct_coverage_table.py produces the same error as reported above. Could someone provide the exact code (samtools statements) that takes us from the .sam file to the proper sorted and indexed .bam-file that this python script requires?
What worked for me was moving the sorted .bam file and the indexed .bai file into the same directory and then running the concoct_coverage_table.py script.
I also experience the same issue. I do have the sorted (Sample.sorted.bam) and the indexed bam file (Sample.bam.bai). Both of these are in the same directory, still I run into the error as reported above. What worked for me was renaming the sorted bam file from Sample.sorted.bam to Sample.bam. Then the concoct_coverage_table.py script ran, but still this is quite inconvenient. Could you help with this problem?
thanks @mmaeke, your workaround helped though agree it would have been hard to figure this out by following the tutorial.
@larssnip, here is the code I used for getting my bowtie2 bam files sorted and indexed, which worked with the workaround from mmaeke:
samtools sort -o ${ID}.sorted.bam -@ 20 ${ID}_${ID}.bam
# sorting mapped $ID reads vs $ID assembled contigs with 20 threads
samtools index -@ 20 ${ID}.sorted.bam ${ID}.bam.bai
# index sorted bam with 20 threads
I then renamed the ${ID}.sorted.bam files to ${ID}.bam and reran concoct_coverage_table.py as suggested, which seems to work.
Hello, can anyone help me with this? I keep getting this error: I even redid my index file
concoct_coverage_table.py contigs_10K.bed Sample.sorted.bam* > coverage_table.tsv
[E::hts_hopen] Failed to open file Sample.sorted.bam.bai
[E::hts_open_format] Failed to open file "Sample.sorted.bam.bai" : Exec format error
ERROR: fail to open index BAM file 'Sample.sorted.bam.bai'
Traceback (most recent call last):
File "/opt/software/CONCOCT/1.1.0-foss-2020b-Python-2.7.18/bin/concoct_coverage_table.py", line 91, in
@howla1ke For me, creating the sam files using bwa tools (rather than bowtie) worked. What I did is provided below- Tutorial followed for bwa tools- https://www.youtube.com/watch?v=1wcFavYt6uU&ab_channel=BioinformaticsCoach
I hope it works for you as well. Let me know if any further information is needed.
Hello,
I installed the concoct using
conda create -n concoct_env python=3 concoct
as the manual.The .bam file were generated by samtools 1.9 using
samtools sort -@ 10 -o sorted.bam unsorted.sam
The script
cut_up_fasta.py
worked well.However, when running
concoct_coverage_table.py contigs_10K.bed sorted.bam > coverage_table.tsv
, it showedCould you please solve this problem?
Thanks!