diff --git a/ectyper/ectyper.py b/ectyper/ectyper.py index 50b47f4..a63d12c 100644 --- a/ectyper/ectyper.py +++ b/ectyper/ectyper.py @@ -120,10 +120,10 @@ def run_program(): os.makedirs(temp_dir, exist_ok=True) LOG.info("Gathering genome files list ...") - raw_genome_files = decompress_gunzip_files(genomeFunctions.get_files_as_list(args.input), temp_dir) + input_files_list = genomeFunctions.get_files_as_list(args.input) + raw_genome_files = decompress_gunzip_files(input_files_list, temp_dir) - LOG.info("Identifying genome file types") - + LOG.info(f"Identifying genome file types on {len(raw_genome_files)} inputs ...") raw_files_dict = genomeFunctions.identify_raw_files(raw_genome_files, args) diff --git a/ectyper/genomeFunctions.py b/ectyper/genomeFunctions.py index 3e01f63..0f50298 100644 --- a/ectyper/genomeFunctions.py +++ b/ectyper/genomeFunctions.py @@ -38,12 +38,18 @@ def get_files_as_list(file_or_directory): for root, dirs, files in os.walk(file_or_directory): for filename in files: files_list.append(os.path.join(root, filename)) + LOG.info(f"Identified {len(files_list)} genomes in {file_or_directory}") # check if input is concatenated file locations separated by , (comma) elif ',' in file_or_directory: - LOG.info("Using genomes in the input list") + LOG.info("Using genomes in the input list separated by ','") + missing_inputs_count = 0 for filename in file_or_directory.split(','): if os.path.exists(os.path.abspath(filename)): files_list.append(os.path.abspath(filename)) + else: + LOG.warning(f"File {filename} not found in the ',' separated list") + missing_inputs_count += 1 + LOG.info(f"Total of {len(files_list)} genomes identified with a valid path and {missing_inputs_count} missing") else: LOG.info("Checking existence of file " + file_or_directory) input_abs_file_path = os.path.abspath(file_or_directory) @@ -213,8 +219,10 @@ def assemble_reads(reads, bowtie_base, combined_fasta, temp_dir, cores=1): '-U', reads, '-S', sam_reads ] + subprocess_util.run_subprocess(bowtie_run) + # Convert reads from sam to bam bam_reads = os.path.join(temp_dir, output_name + '.bam') sam_convert = [ diff --git a/ectyper/subprocess_util.py b/ectyper/subprocess_util.py index 78c7ece..a9d2cba 100644 --- a/ectyper/subprocess_util.py +++ b/ectyper/subprocess_util.py @@ -38,4 +38,5 @@ def run_subprocess(cmd, input_data=None, un=False, ignorereturncode=False): LOG.error("Error in subprocess. The following command failed: {}".format(cmd)) LOG.error("Subprocess failed with error: \"{}\"".format(comp_proc.stderr.decode("utf-8"))) LOG.critical("ectyper has stopped") - exit("subprocess failure") + raise Exception(f"subprocess failure while running {cmd} command") +