wwood / CoverM

Read coverage calculator for metagenomics
GNU General Public License v3.0
273 stars 30 forks source link

bam_generator] Failed to correctly find or parse BAM file at "/tmp/coverm_fifo.wyqhN9T2ujOl/foo.pipe" #126

Open Hollyhlp opened 1 year ago

Hollyhlp commented 1 year ago

When using coverM, I met the following problem. May I know how to solve it? Thank you.

2022-08-02T06:51:55Z INFO coverm::mapping_index_maintenance] Generating BWA_MEM index for /tmp/.tmpzfBZeD .. [2022-08-02T07:14:01Z INFO coverm::mapping_index_maintenance] Finished generating BWA_MEM index. [2022-08-02T07:14:03Z ERROR coverm::bam_generator] Failed to correctly find or parse BAM file at "/tmp/coverm_fifo.wyqhN9T2ujOl/foo.pipe": unable to open SAM/BAM/CRAM file at /tmp/coverm_fifo.wyqhN9T2ujOl/foo.pipe [2022-08-02T07:14:03Z ERROR coverm::bam_generator] Error when running mapping process. Exitstatus was ExitStatus(ExitStatus(256)). Command run was: ["bash -c \"set -e -o pipefail; bwa mem -t 90 \'/tmp/coverm-mapping-index.bqpqp1GxhiZ7/.tmpzfBZeD\' \'/data3/QITA/lp/D2/WWTP_DNA/BLG_8/READ_QC/BLG0/final_pure_reads_1.fastq\' \'/data3/QITA/lp/D2/WWTP_DNA/BLG_8/READ_QC/BLG0/final_pure_reads_2.fastq\' 2>/tmp/.tmpFbdRW4 | samtools sort -T \'/tmp/coverm_fifo.wyqhN9T2ujOl/coverm-make-samtools-sortwotEcW\' -l0 -@ 89 2>/tmp/.tmp8zezSg > \"/tmp/coverm_fifo.wyqhN9T2ujOl/foo.pipe\"\""] [2022-08-02T07:14:03Z ERROR coverm::bam_generator] The STDERR for the BWA_MEM part was: [bns_restore_core] Parse error reading /tmp/coverm-mapping-index.bqpqp1GxhiZ7/.tmpzfBZeD.amb

[2022-08-02T07:14:03Z ERROR coverm::bam_generator] The STDERR for the samtools sort part was: samtools sort: failed to read header from "-"

[2022-08-02T07:14:03Z ERROR coverm::bam_generator] Cannot continue since mapping failed.

Hollyhlp commented 1 year ago

And here is the command I used:

coverm genome --coupled /data3/final_pure_reads_1.fastq /data3//final_pure_reads_2.fastq --genome-fasta-directory /data3/HLP/srenamed/ -o B-DNA-abundance/B0-count -m count --min-read-aligned-percent 0.75 --min-read-percent-identity 0.95 --min-covered-fraction 0 -p bwa-mem -t 90

wwood commented 1 year ago

Hi Holly,

Thanks for including the command you used. I think this might already be fixed in the code in the repo, but just not released.

Are you able to try that? Alternatively you could try making your own BWA MEM index and then specifying that as -r ?

nvpatin commented 1 year ago

Hi, was this issue ever solved? I am getting the same error but only for one file out of several hundred that were successful.

rhysnewell commented 1 year ago

Hello,

I would just check and make sure that your tmp drive isn't running out space when you run your coverm command. Try re-running your command with TMPDIR=/drive/with/lots/of/space coverm ... and see if the error still persists.

Cheers, Rhys

Somebodyatthdoor commented 11 months ago

Hi,

Just to add some extra info. I was getting this same error and it was caused by accidently misnaming my input sample files. Once I ensured the command was pointing to the correct files it worked fine.

Cheers, Laura