CoverM icon indicating copy to clipboard operation
CoverM copied to clipboard

Sharded flag not respected when calculating contig coverage

Open donovan-h-parks opened this issue 3 years ago • 1 comments

Hi Ben,

I'm trying to run coverm contig with the --sharded flag, but it appears CoverM still expects the BAM files to be reference sorted:

> samtools sort -n example.1.fastq_R1.bam > name_R1.bam
> samtools sort -n example.1.fastq_R2.bam > name_R2.bam
> coverm contig --bam-files name*.bam --sharded --min-read-percent-identity 95 --min-read-aligned-percent 95 -m mean -o coverage.tsv --no-zeros -t 1
[2021-04-29T16:36:37Z INFO  coverm] CoverM version 0.6.1
[2021-04-29T16:36:37Z INFO  coverm] Using min-read-percent-identity 95%
[2021-04-29T16:36:37Z INFO  coverm] Using min-read-aligned-percent 95%
[2021-04-29T16:36:37Z INFO  coverm] Writing output to file: coverage.tsv
[2021-04-29T16:36:37Z INFO  coverm] Using min-covered-fraction 0%
[2021-04-29T16:36:37Z ERROR coverm::contig] BAM file appears to be unsorted. Input BAM files must be sorted by reference (i.e. by samtools sort)
thread 'main' panicked at 'BAM file appears to be unsorted. Input BAM files must be sorted by reference (i.e. by samtools sort)', /opt/conda/conda-bld/coverm_1616760421473/work/src/contig.rs:130:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

If I sort the my BAM files by reference everything works as expected even when using the --sharded flag which doesn't seem correct.

Thanks for the great work.

Cheers, Donovan

donovan-h-parks avatar Apr 29 '21 16:04 donovan-h-parks

Hi dparks, If I want to screen contigs with ≥70% of their length covered by the reads when using 'coverm contig', I wonder how to set --min-covered-fraction properly?

ZongzhiWu avatar May 14 '21 01:05 ZongzhiWu