bonsai-team / matam

Mapping-Assisted Targeted-Assembly for Metagenomics
GNU Affero General Public License v3.0
19 stars 9 forks source link

Better error message when the input file does not exist #94

Open loic-couderc opened 4 years ago

loic-couderc commented 4 years ago

Is your feature request related to a problem? Please describe. When the input FASTQ file does not exist, MATAM does not stop properly its execution

Describe the solution you'd like Stop the execution with a clear message

loic-couderc commented 4 years ago

Current error message:

matam_assembly.py -i /tmp/fake.fq --cpu 4 --max_memory 10000 -v -o /tmp/matam_19_10_16-09_49_31 --perform_taxonomic_assignment --debug
2019-10-16 08:23:42,700 - root - INFO - === MATAM assembly ===
2019-10-16 08:23:42,700 - root - INFO - CMD: /home/ubuntu/matam/scripts/matam_assembly.py --verbose --debug --keep_tmp --cpu 4 --max_memory 10000 --best 10 --evalue 1.00e-05 --score_threshold 0.90 --coverage_threshold 0 --min_identity 1.00 --min_overlap_length 50 --min_read_node 1 --min_overlap_edge 1 --quorum 0.51 --read_correction auto --contig_coverage_threshold 20 --min_scaffold_length 500 --perform_taxonomic_assignment --training_model 16srrna --rdp_cutoff 0.8 --out_dir /tmp/matam_19_10_16-09_49_31 --ref_db /home/ubuntu/matam/db/SILVA_128_SSURef_NR95 --input_fastq  /tmp/fake.fq 
wc:  /tmp/fake.fq: No such file or directory
Traceback (most recent call last):
  File "bin/matam_assembly.py", line 1682, in <module>
    exit_code = main()
  File "bin/matam_assembly.py", line 918, in main
    input_fastq_line_nb = int(subprocess.check_output('wc -l {0}'.format(input_fastq_filepath), shell=True, bufsize=0).split()[0])
  File "/home/ubuntu/miniconda3/envs/matam/lib/python3.6/subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "/home/ubuntu/miniconda3/envs/matam/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'wc -l  /tmp/fake.fq' returned non-zero exit status 1.