wwood / CoverM

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

[2023-06-04T07:45:16Z INFO coverm::contig] In sample 'cdhit_rep_seq.fna/SRR13083091_1.fq.gz', found 0 reads mapped out of 0 total (NaN%) #169

Open JiaLonghao1997 opened 1 year ago

JiaLonghao1997 commented 1 year ago

When we run coverm:

/home1/jialh/anaconda3/envs/MAG/bin/coverm contig  \
-t 8 -r /home1/jialh/brain/CAGs/CAGs/cdhit_rep_seq.fna  \
-1 /home1/jialh/brain/JPN/preprocessing/01_processing/05_sync/SRR13083091_1.fq.gz \
-2 /home1/jialh/brain/JPN/preprocessing/01_processing/05_sync/SRR13083091_2.fq.gz     \
--bam-file-cache-directory /home1/jialh/brain/CAGs/CAGs/coverm/SRR13083091_coverm_temp     \
--output-file /home1/jialh/brain/CAGs/CAGs/coverm/SRR13083091_gene_abundance.txt

We got the next error. The reference file cdhit_rep_seq.fna is from hundreds of samples, which include the sample SRR13083091. Why do we got this error? How to deal with this issue? image

wwood commented 1 year ago

Hi,

From the timestamps it seems minimap2 finishes instantly, which isn't a good sign. Is something wrong with the input files or minimap2 executable?

Wanning888 commented 1 year ago

Hello,

I was wondering if you have managed to solve this problem. I'm having a similar issue and would greatly appreciate any help you can give me.

JiaLonghao1997 commented 1 year ago

You can just map reads to the contigs by minimap2 before calculating abundance by coverm.

reference: https://github.com/deng-lab/viroprofiler/blob/main/modules/local/abundance.nf

[WARNING] For a multi-part index, no @SQ lines will be outputted.

Please use --split-prefix. https://github.com/lh3/minimap2/issues/301

node: One CPUs contains two cores. If threads=4, %CPU will be around 200%.

rule mapping_reads_to_contigs: input: r1 = lambda wildcards: sample_reads[wildcards.samp][0], r2 = lambda wildcards: sample_reads[wildcards.samp][1], representative_genes = join(outdir,"cdhit_rep_seq.fna") output: bam = join(outdir, "bam", "{samp}.bam") params: tempdir = join(outdir, "bam", "{samp}_temp_bam") threads: 4 shell:""" /home1/jialh/tools/anaconda3/envs/coverm/bin/minimap2 -t {threads} \ -ax sr --split-prefix {params.tempdir} {input.representative_genes} {input.r1} {input.r2} | \ /home1/jialh/tools/anaconda3/bin/samtools sort --threads {threads} -o {output.bam} """

rule CoverM: input: bam = join(outdir, "bam", "{samp}.bam") output: gene_abundance = join(outdir, "coverm", "{samp}_gene_abundance.txt") params: temp_dir = join(outdir, "coverm", "{samp}_coverm_temp") threads: 4 conda: "/home1/jialh/brain/pipeline/2020NBTbhattlab/CAGs/scripts/coverm.yaml" shell: """ /home1/jialh/tools/anaconda3/envs/coverm/bin/coverm contig \ --bam-files {input.bam} -t {threads} --min-read-percent-identity 0.95 \ --output-file {output.gene_abundance} """

Wanning888 @.***> 于2023年6月26日周一 11:01写道:

Hello,

I was wondering if you have managed to solve this problem. I'm having a similar issue and would greatly appreciate any help you can give me.

— Reply to this email directly, view it on GitHub https://github.com/wwood/CoverM/issues/169#issuecomment-1606520397, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHXJVDKLQGXLW3KXIF6EM5LXND3QPANCNFSM6AAAAAAYZY7MFQ . You are receiving this because you authored the thread.Message ID: @.***>