From eb1562813bde6d2365079ae43de636f3d39e1308 Mon Sep 17 00:00:00 2001 From: Mike Tisza Date: Fri, 11 Oct 2024 14:49:44 -0500 Subject: [PATCH 1/2] fix dependency check and chunk --- src/cenote/cenotetaker3.py | 17 ++++++++++++----- .../python_modules/prune_virus_coords1.py | 10 +++++----- src/cenote/python_modules/virus_summary.py | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/cenote/cenotetaker3.py b/src/cenote/cenotetaker3.py index 62a233a..58f5c7e 100644 --- a/src/cenote/cenotetaker3.py +++ b/src/cenote/cenotetaker3.py @@ -12,7 +12,7 @@ import string import re import logging -from distutils.spawn import find_executable +from shutil import which def str2bool(v): if isinstance(v, bool): @@ -381,10 +381,12 @@ def check_ct3_dbs(): ### check dependencies def is_tool(name): """Check whether `name` is on PATH.""" - return find_executable(name) is not None + return which(name) is not None - tool_dep_list = ['samtools', 'minimap2', 'tRNAscan-SE', 'seqkit', 'hhblits', - 'bedtools', 'phanotate.py', 'mmseqs'] + tool_dep_list = ['samtools', 'minimap2', + 'tRNAscan-SE', 'seqkit', + 'hhblits', 'bedtools', + 'phanotate.py', 'mmseqs'] for tool in tool_dep_list: if not is_tool(tool): @@ -395,12 +397,17 @@ def is_tool(name): reqs = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze']) installed_packages = [r.decode().split('==')[0] for r in reqs.split()] - python_dep_list = ['pyhmmer', 'numpy', 'pandas', 'biopython', 'pyrodigal-gv'] + python_dep_list = ['pyhmmer', 'numpy', 'pandas', 'biopython', 'pyrodigal'] for pydep in python_dep_list: if pydep not in installed_packages: logger.warning(f"{pydep} not found in installed python packages. Exiting.") sys.exit() + + if not 'pyrodigal-gv' in installed_packages: + if not 'pyrodigal_gv' in installed_packages: + logger.warning(f"pyrodigal-gv not found in installed python packages. Exiting.") + sys.exit() ## check run_title suitability if re.search(r'^[a-zA-Z0-9_]+$', str(args.run_title)) and \ diff --git a/src/cenote/python_modules/prune_virus_coords1.py b/src/cenote/python_modules/prune_virus_coords1.py index 8883179..085ad7b 100644 --- a/src/cenote/python_modules/prune_virus_coords1.py +++ b/src/cenote/python_modules/prune_virus_coords1.py @@ -192,7 +192,7 @@ def left_cutoff(position, groupframe): row1["Position start"] == 0 and \ row1["Position stop"] != (total_len + 1): - ddf = ["Chunk_" + str(i1), + ddf = ["C_" + str(i1), row1["Position start"], right_cutoff(row2["Window midpoint"], group)] ddf_list.append(ddf) @@ -206,11 +206,11 @@ def left_cutoff(position, groupframe): rico = right_cutoff(row2["Window midpoint"], group) if rico > leco: - ddf = ["Chunk_" + str(i1), + ddf = ["C_" + str(i1), left_cutoff(row1["Window midpoint"], group), right_cutoff(row2["Window midpoint"], group)] else: - ddf = ["Chunk_" + str(i1), row1["Window midpoint"], row2["Window midpoint"]] + ddf = ["C_" + str(i1), row1["Window midpoint"], row2["Window midpoint"]] ddf_list.append(ddf) @@ -219,7 +219,7 @@ def left_cutoff(position, groupframe): row1["Position start"] != 0 and \ row1["Position stop"] == (total_len + 1): - ddf = ["Chunk_" + str(i1), + ddf = ["C_" + str(i1), left_cutoff(row1["Window midpoint"], group), row2["Position stop"]] ddf_list.append(ddf) @@ -230,7 +230,7 @@ def left_cutoff(position, groupframe): if merged_df.iloc[0,1] == '+' and \ merged_df.iloc[0,2] == 0 and \ merged_df.iloc[0,3] == (total_len + 1): #if first column last(2nd row) == last -1 then its one chunk - rep_list = [('Chunk_0', '0', (total_len+1))] + rep_list = [('C_0', '0', (total_len+1))] ddf_list = rep_list else: ddf_list = ddf_list diff --git a/src/cenote/python_modules/virus_summary.py b/src/cenote/python_modules/virus_summary.py index 6241744..c792f31 100644 --- a/src/cenote/python_modules/virus_summary.py +++ b/src/cenote/python_modules/virus_summary.py @@ -137,7 +137,7 @@ summary_list = [] for name, group in grouped_df: - if "Chunk" in str(name[2]): + if "C" in str(name[2]): outname = "@".join([name[0], name[2]]) else: outname = name[0] From de304f2447186e6aced00f38ff8e847d946a9ddb Mon Sep 17 00:00:00 2001 From: Mike Tisza Date: Fri, 11 Oct 2024 15:24:23 -0500 Subject: [PATCH 2/2] version 3.3.2 init, chunk to C --- pyproject.toml | 2 +- src/cenote/cenotetaker3.py | 2 +- src/cenote/python_modules/prune_virus_coords1.py | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a5b97e2..de46af2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "cenotetaker3" -version = "3.3.1" +version = "3.3.2" authors = [ { name="Mike Tisza", email="michael.tisza@gmail.com" }, ] diff --git a/src/cenote/cenotetaker3.py b/src/cenote/cenotetaker3.py index 58f5c7e..bf09255 100644 --- a/src/cenote/cenotetaker3.py +++ b/src/cenote/cenotetaker3.py @@ -79,7 +79,7 @@ def cenotetaker3(): parentpath = Path(pathname).parents[1] - __version__ = "3.3.1" + __version__ = "3.3.2" Def_CPUs = os.cpu_count() diff --git a/src/cenote/python_modules/prune_virus_coords1.py b/src/cenote/python_modules/prune_virus_coords1.py index 085ad7b..46a89f6 100644 --- a/src/cenote/python_modules/prune_virus_coords1.py +++ b/src/cenote/python_modules/prune_virus_coords1.py @@ -192,7 +192,7 @@ def left_cutoff(position, groupframe): row1["Position start"] == 0 and \ row1["Position stop"] != (total_len + 1): - ddf = ["C_" + str(i1), + ddf = ["C" + str(i1), row1["Position start"], right_cutoff(row2["Window midpoint"], group)] ddf_list.append(ddf) @@ -206,11 +206,11 @@ def left_cutoff(position, groupframe): rico = right_cutoff(row2["Window midpoint"], group) if rico > leco: - ddf = ["C_" + str(i1), + ddf = ["C" + str(i1), left_cutoff(row1["Window midpoint"], group), right_cutoff(row2["Window midpoint"], group)] else: - ddf = ["C_" + str(i1), row1["Window midpoint"], row2["Window midpoint"]] + ddf = ["C" + str(i1), row1["Window midpoint"], row2["Window midpoint"]] ddf_list.append(ddf) @@ -219,7 +219,7 @@ def left_cutoff(position, groupframe): row1["Position start"] != 0 and \ row1["Position stop"] == (total_len + 1): - ddf = ["C_" + str(i1), + ddf = ["C" + str(i1), left_cutoff(row1["Window midpoint"], group), row2["Position stop"]] ddf_list.append(ddf) @@ -230,7 +230,7 @@ def left_cutoff(position, groupframe): if merged_df.iloc[0,1] == '+' and \ merged_df.iloc[0,2] == 0 and \ merged_df.iloc[0,3] == (total_len + 1): #if first column last(2nd row) == last -1 then its one chunk - rep_list = [('C_0', '0', (total_len+1))] + rep_list = [('C0', '0', (total_len+1))] ddf_list = rep_list else: ddf_list = ddf_list