khyox / recentrifuge

Recentrifuge: robust comparative analysis and contamination removal for metagenomics
http://www.recentrifuge.org
Other
86 stars 7 forks source link

rextract: ZeroDivisionError #36

Closed shrivastavabhishek closed 2 years ago

shrivastavabhishek commented 2 years ago

Hi @khyox , I was trying to run rextract.py" with sample dataset, it is terminating before completing the scripts and throwing the following error:

Traceback (most recent call last): File "/home/galaxy/.local/bin/rextract", line 347, in main() File "/home/galaxy/.local/bin/rextract", line 241, in main print(f' \033[90mMatching reads: \033[0m{len(records):_d} \033[90m\t' ZeroDivisionError: division by zero

I observe that the: length of the records 0 and number of sequences 0 are coming zero in some of the taxon id case. What I feel that there should be one condition to check it and exit gracefully at that point.

khyox commented 2 years ago

Thanks for reporting, @shrivastavabhishek. Unfortunately, you have not filled the bug/issue report so that limits my ability to help. Do you mean that you were entering no sequences in the sample dataset and that the script failed or you were filtering or searching for taxa not present in the samples?

shrivastavabhishek commented 2 years ago

Hi @khyox I am running the command : python rextract.py --fastq fastq_in.fastq --file centrifuge_report.txt --nodespath /mnt/galaxyIndices/genomes/basta/taxonomy/ -i 2

Here, Matching reads are zero associated with the taxonid 2 for the given fastq file and len(records) is 0 and num_seqs are zero.The scripts is exiting without creating any fastq_in_rxtr_incl2.fastq file.

Which is searching for taxon id 2 is not present in the samples?

Its throwing the below error and terminating: Traceback (most recent call last): File "/home/galaxy/.local/bin/rextract", line 347, in main() File "/home/galaxy/.local/bin/rextract", line 241, in main print(f' \033[90mMatching reads: \033[0m{len(records):_d} \033[90m\t' ZeroDivisionError: division by zero.

Please let me know if you need more info and requesting you to look into it.

khyox commented 2 years ago

Thanks @shrivastavabhishek! I see. As you mentioned previously, I agree on the need of a better way of ending the program in such a case —probably still with an error code so that a pipeline using this script may catch that non-0 exit status and proceed accordingly, but with a more informative one than ZeroDivisionError.