Skip to content

Commit

Permalink
feat: add KNIME python and rdkit versions
Browse files Browse the repository at this point in the history
  • Loading branch information
breakthewall committed Mar 16, 2023
1 parent 41f2a20 commit 19f4d3a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
4 changes: 2 additions & 2 deletions retropath2_wrapper/Args.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
'KNIME_VERSION': '4.6.4',
'RP2_VERSION': 'r20220104',
'ZENODO_VERSION': "NA",
'KNIME_PYTHON_VERSION': '4.5.2.v202203041212',
'KNIME_RDKIT_VERSION': '4.5.0.v202207051536',
'KNIME_PYTHON_VERSION': '4.6.0.v202206100850',
'KNIME_RDKIT_VERSION': '4.6.1.v202212212136',
'KNIME_FOLDER': __PACKAGE_FOLDER
}
KNIME_ZENODO = {"4.6.4": "7515771", "4.7.0": "7564938"} # Map to Zenodo ID
Expand Down
12 changes: 6 additions & 6 deletions retropath2_wrapper/RetroPath2.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def retropath2(
sink_file: str, source_file: str, rules_file: str,
outdir: str,
kinstall: str = DEFAULTS['KNIME_FOLDER'],
kexec: str = None, kpkg_install: bool = True, kver: str = DEFAULTS['KNIME_VERSION'],
kexec: str = None,
kpkg_install: bool = True,
kver: str = DEFAULTS['KNIME_VERSION'],
kpython_ver: str = DEFAULTS['KNIME_PYTHON_VERSION'],
krdkit_ver: str = DEFAULTS['KNIME_RDKIT_VERSION'],
kzenodo_ver: str = DEFAULTS['ZENODO_VERSION'],
Expand Down Expand Up @@ -78,6 +80,8 @@ def retropath2(
kinstall=kinstall,
is_kpkg_install=kpkg_install,
kver=kver,
kpython_ver=kpython_ver,
krdkit_ver=krdkit_ver,
kzenodo_ver=kzenodo_ver
)
if rp2_version is not None:
Expand Down Expand Up @@ -105,11 +109,7 @@ def retropath2(
# if kexec is not specified
# and executable not detected in default path
knime.install_exec(logger=logger)
r_code = knime.install_pkgs(
kpython_ver=kpython_ver,
krdkit_ver=krdkit_ver,
logger=logger
)
r_code = knime.install_pkgs(logger=logger)
if r_code > 0:
return r_code, None
elif r_code == RETCODES['OSError']:
Expand Down
25 changes: 22 additions & 3 deletions retropath2_wrapper/knime.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,23 @@ def standardize_path(cls, path: str) -> str
ZENODO_API = "https://zenodo.org/api/"
KNIME_URL = "http://download.knime.org/analytics-platform/"

def __init__(self, workflow: str="", kinstall: str=DEFAULTS['KNIME_FOLDER'], kver: str = DEFAULTS['KNIME_VERSION'], is_kpkg_install: bool=False, kexec: Optional[str]=None, kzenodo_ver: str=DEFAULTS['ZENODO_VERSION'], *args, **kwargs) -> None:
def __init__(
self,
workflow: str="",
kinstall: str=DEFAULTS['KNIME_FOLDER'],
kver: str = DEFAULTS['KNIME_VERSION'],
kpython_ver: str=DEFAULTS['KNIME_PYTHON_VERSION'],
krdkit_ver: str=DEFAULTS['KNIME_RDKIT_VERSION'],
is_kpkg_install: bool=False,
kexec: Optional[str]=None,
kzenodo_ver: str=DEFAULTS['ZENODO_VERSION'],
# *args, **kwargs
) -> None:

self.workflow = workflow
self.kver = kver
self.kpython_ver = kpython_ver
self.krdkit_ver = krdkit_ver
self.is_kpkg_install = is_kpkg_install
self.kexec = kexec
self.kzenodo_ver = kzenodo_ver
Expand Down Expand Up @@ -140,6 +153,8 @@ def __repr__(self):
s = ["Knime vars:"]
s.append("workflow: " + self.workflow)
s.append("kver: " + self.kver)
s.append("kpython_ver: " + self.kpython_ver)
s.append("krdkit_ver: " + self.krdkit_ver)
s.append("is_kpkg_install: " + str(self.kpkg_install))
s.append("kpkg_install: " + self.kpkg_install)
s.append("kexec: " + self.kexec)
Expand Down Expand Up @@ -220,8 +235,8 @@ def install_exec(self, logger: Logger = getLogger(__name__)) -> None:

def install_pkgs(
self,
kpython_ver: str,
krdkit_ver: str,
kpython_ver: str = None,
krdkit_ver: str = None,
logger: Logger = getLogger(__name__)
) -> int:
"""Install KNIME packages needed to execute RetroPath2.0 workflow.
Expand All @@ -235,6 +250,10 @@ def install_pkgs(
------
int
"""
if kpython_ver is None:
kpython_ver = self.kpython_ver
if krdkit_ver is None:
krdkit_ver = self.krdkit_ver
returncode = 0
if self.kexec_install or self.is_kpkg_install:
StreamHandler.terminator = ""
Expand Down

0 comments on commit 19f4d3a

Please sign in to comment.