Skip to content

Commit

Permalink
add more friendly message when skipping refinery
Browse files Browse the repository at this point in the history
  • Loading branch information
AroneyS committed Jul 28, 2023
1 parent cb0b0b6 commit 0ff4bc3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions aviary/modules/binning/scripts/run_checkm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
from pathlib import Path

def checkm(checkm2_db, bin_folder, bin_ext, refinery_max_iterations, output_folder, output_file, threads):
if len([f for f in os.listdir(bin_folder) if f.endswith(bin_ext)]) > 0 and refinery_max_iterations > 0:
print(f"Using CheckM2 database {checkm2_db}/uniref100.KO.1.dmnd")
subprocess.run(f"CHECKM2DB={checkm2_db}/uniref100.KO.1.dmnd checkm2 predict -i {bin_folder}/ -x {bin_ext} -o {output_folder} -t {threads} --force")
shutil.copy(f"{output_folder}/quality_report.tsv", output_file)
else:
if len([f for f in os.listdir(bin_folder) if f.endswith(bin_ext)]) == 0:
print(f"No bins found in {bin_folder}")
os.makedirs(output_folder)
Path(output_file).touch()
elif refinery_max_iterations == 0:
print("Skipping pre-refinery CheckM2 rules")
os.makedirs(output_folder)
Path(output_file).touch()
else:
print(f"Using CheckM2 database {checkm2_db}/uniref100.KO.1.dmnd")
subprocess.run(f"CHECKM2DB={checkm2_db}/uniref100.KO.1.dmnd checkm2 predict -i {bin_folder}/ -x {bin_ext} -o {output_folder} -t {threads} --force")
shutil.copy(f"{output_folder}/quality_report.tsv", output_file)


if __name__ == '__main__':
Expand Down

0 comments on commit 0ff4bc3

Please sign in to comment.