1
0
mirror of https://github.com/msberends/AMR.git synced 2026-06-29 15:36:21 +02:00

(v3.0.1.9071) fix python wrapper

This commit is contained in:
2026-06-26 11:35:30 +02:00
parent 637ada920b
commit 61e1fbf1e0
3 changed files with 12 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 3.0.1.9070 Version: 3.0.1.9071
Date: 2026-06-26 Date: 2026-06-26
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR) Description: Functions to simplify and standardise antimicrobial resistance (AMR)

View File

@@ -1,4 +1,4 @@
# AMR 3.0.1.9070 # AMR 3.0.1.9071
Planned as v3.1.0, end of June 2026. Planned as v3.1.0, end of June 2026.

View File

@@ -72,7 +72,9 @@ base._libPaths(r_lib_path)
# Check if the AMR package is installed in R # Check if the AMR package is installed in R
if not isinstalled('AMR', lib_loc=r_lib_path): if not isinstalled('AMR', lib_loc=r_lib_path):
print(f"AMR: Installing latest AMR R package to {r_lib_path}...", flush=True) print(f"AMR: Installing latest AMR R package to {r_lib_path}...", flush=True)
utils.install_packages('AMR', repos='beta.amr-for-r.org', quiet=True) utils.install_packages('remotes', quiet=True)
remotes = importr('remotes')
remotes.install_github('msberends/AMR', quiet=True)
# Retrieve Python AMR version # Retrieve Python AMR version
try: try:
@@ -88,10 +90,15 @@ r_amr_version = str(r_amr_version[0])
if r_amr_version != python_amr_version: if r_amr_version != python_amr_version:
try: try:
print(f"AMR: Updating AMR package in {r_lib_path}...", flush=True) print(f"AMR: Updating AMR package in {r_lib_path}...", flush=True)
utils.install_packages('AMR', repos='beta.amr-for-r.org', quiet=True) utils.install_packages('remotes', quiet=True)
remotes = importr('remotes')
remotes.install_github('msberends/AMR', quiet=True)
r_amr_version = robjects.r(f'as.character(packageVersion("AMR", lib.loc = "{r_lib_path}"))')
r_amr_version = str(r_amr_version[0])
except Exception as e: except Exception as e:
print(f"AMR: Could not update: {e}", flush=True) print(f"AMR: Could not update: {e}", flush=True)
print(f"AMR: R package version {r_amr_version} loaded.", flush=True)
print(f"AMR: Setting up R environment and AMR datasets...", flush=True) print(f"AMR: Setting up R environment and AMR datasets...", flush=True)
# Activate the automatic conversion between R and pandas DataFrames # Activate the automatic conversion between R and pandas DataFrames
@@ -204,7 +211,7 @@ def r_to_python(r_func):
return wrapper return wrapper
EOL EOL
# Directory where the .Rd files are stored (update path as needed) # Directory where the .Rd files are stored
rd_dir="../man" rd_dir="../man"
# Iterate through each .Rd file in the man directory # Iterate through each .Rd file in the man directory