Skip to content

Commit

Permalink
Merge pull request #17 from mtisza1/update5
Browse files Browse the repository at this point in the history
to v3.3.2, Update5
  • Loading branch information
mtisza1 authored Oct 11, 2024
2 parents d7deed3 + de304f2 commit c21176b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]" },
]
Expand Down
19 changes: 13 additions & 6 deletions src/cenote/cenotetaker3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -79,7 +79,7 @@ def cenotetaker3():

parentpath = Path(pathname).parents[1]

__version__ = "3.3.1"
__version__ = "3.3.2"

Def_CPUs = os.cpu_count()

Expand Down Expand Up @@ -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):
Expand All @@ -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 \
Expand Down
10 changes: 5 additions & 5 deletions src/cenote/python_modules/prune_virus_coords1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand All @@ -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)
Expand All @@ -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 = [('C0', '0', (total_len+1))]
ddf_list = rep_list
else:
ddf_list = ddf_list
Expand Down
2 changes: 1 addition & 1 deletion src/cenote/python_modules/virus_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit c21176b

Please sign in to comment.