AMR 2.1.1.9127__py3-none-any.whl → 2.1.1.9129__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- AMR/datasets.py +15 -19
- {AMR-2.1.1.9127.dist-info → AMR-2.1.1.9129.dist-info}/METADATA +1 -1
- AMR-2.1.1.9129.dist-info/RECORD +7 -0
- AMR-2.1.1.9127.dist-info/RECORD +0 -7
- {AMR-2.1.1.9127.dist-info → AMR-2.1.1.9129.dist-info}/WHEEL +0 -0
- {AMR-2.1.1.9127.dist-info → AMR-2.1.1.9129.dist-info}/top_level.txt +0 -0
AMR/datasets.py
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
BLUE = '\033[94m'
|
2
|
-
GREEN = '\033[32m'
|
3
|
-
RESET = '\033[0m'
|
4
|
-
|
5
1
|
import os
|
6
2
|
import sys
|
7
3
|
from rpy2 import robjects
|
@@ -17,18 +13,22 @@ venv_path = sys.prefix
|
|
17
13
|
r_lib_path = os.path.join(venv_path, "R_libs")
|
18
14
|
# Ensure the R library path exists
|
19
15
|
os.makedirs(r_lib_path, exist_ok=True)
|
20
|
-
|
16
|
+
|
17
|
+
# Import base and utils
|
21
18
|
base = importr('base')
|
22
|
-
|
23
|
-
base.options(warn = -1)
|
19
|
+
utils = importr('utils')
|
24
20
|
|
25
|
-
|
21
|
+
# Override R library paths globally for the session
|
22
|
+
robjects.r(f'.Library <- "{r_lib_path}"') # Replace default library
|
23
|
+
robjects.r(f'.Library.site <- "{r_lib_path}"') # Replace site-specific library
|
24
|
+
base._libPaths(r_lib_path) # Override .libPaths() as well
|
25
|
+
|
26
|
+
# Get the effective library path
|
26
27
|
r_amr_lib_path = base._libPaths()[0]
|
27
28
|
|
28
29
|
# Check if the AMR package is installed in R
|
29
|
-
if not isinstalled('AMR', lib_loc
|
30
|
-
|
31
|
-
print(f"{BLUE}AMR:{RESET} Installing AMR package to {BLUE}{r_amr_lib_path}/{RESET}...", flush=True)
|
30
|
+
if not isinstalled('AMR', lib_loc=r_amr_lib_path):
|
31
|
+
print(f"AMR: Installing latest AMR R package to {r_amr_lib_path}...", flush=True)
|
32
32
|
utils.install_packages('AMR', repos='https://msberends.r-universe.dev', quiet=True)
|
33
33
|
|
34
34
|
# Python package version of AMR
|
@@ -43,16 +43,12 @@ r_amr_version = robjects.r(f'as.character(packageVersion("AMR", lib.loc = "{r_li
|
|
43
43
|
# Compare R and Python package versions
|
44
44
|
if r_amr_version != python_amr_version:
|
45
45
|
try:
|
46
|
-
print(f"
|
47
|
-
utils = importr('utils')
|
46
|
+
print(f"AMR: Updating AMR package in {r_amr_lib_path}...", flush=True)
|
48
47
|
utils.install_packages('AMR', repos='https://msberends.r-universe.dev', quiet=True)
|
49
48
|
except Exception as e:
|
50
|
-
print(f"
|
51
|
-
|
52
|
-
# Restore warnings to default
|
53
|
-
base.options(warn = 0)
|
49
|
+
print(f"AMR: Could not update: {e}", flush=True)
|
54
50
|
|
55
|
-
print(f"
|
51
|
+
print(f"AMR: Setting up R environment and AMR datasets...", flush=True)
|
56
52
|
|
57
53
|
# Activate the automatic conversion between R and pandas DataFrames
|
58
54
|
pandas2ri.activate()
|
@@ -77,4 +73,4 @@ microorganisms = pandas2ri.rpy2py(robjects.r('AMR::microorganisms[, !sapply(AMR:
|
|
77
73
|
antibiotics = pandas2ri.rpy2py(robjects.r('AMR::antibiotics[, !sapply(AMR::antibiotics, is.list)]'))
|
78
74
|
clinical_breakpoints = pandas2ri.rpy2py(robjects.r('AMR::clinical_breakpoints[, !sapply(AMR::clinical_breakpoints, is.list)]'))
|
79
75
|
|
80
|
-
print(f"
|
76
|
+
print(f"AMR: Done.", flush=True)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
AMR/__init__.py,sha256=-3zoWVuhybnYkXePzljDrtcxxaAQscPpCPP75EiqLfQ,7540
|
2
|
+
AMR/datasets.py,sha256=t3ilqlqKu0rr4iHjG79fyWAXbdUw-WhCYyyeyZWxqoo,2629
|
3
|
+
AMR/functions.py,sha256=JSh-0_mfrAj7ajpazlv2KFyEtRAglj7oQV9Iiaux7eo,45557
|
4
|
+
AMR-2.1.1.9129.dist-info/METADATA,sha256=f19dBJeroInDhq8gPC3YkuDSUHgtF2BDlN0tNfyyOhE,9624
|
5
|
+
AMR-2.1.1.9129.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
6
|
+
AMR-2.1.1.9129.dist-info/top_level.txt,sha256=7K6Mq_X_OHdXOzQM5y06VUadXjYkze6yzufL1d7_6xc,4
|
7
|
+
AMR-2.1.1.9129.dist-info/RECORD,,
|
AMR-2.1.1.9127.dist-info/RECORD
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
AMR/__init__.py,sha256=-3zoWVuhybnYkXePzljDrtcxxaAQscPpCPP75EiqLfQ,7540
|
2
|
-
AMR/datasets.py,sha256=tNLt7ERRxR-HYWD_gY6NwkMjdTIkg0bqtdi98U7sCyQ,2673
|
3
|
-
AMR/functions.py,sha256=JSh-0_mfrAj7ajpazlv2KFyEtRAglj7oQV9Iiaux7eo,45557
|
4
|
-
AMR-2.1.1.9127.dist-info/METADATA,sha256=sYrsK-qr05-Yn2pxCyIyna4NKGIBZ_ZCvWI0lHUeVQE,9624
|
5
|
-
AMR-2.1.1.9127.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
6
|
-
AMR-2.1.1.9127.dist-info/top_level.txt,sha256=7K6Mq_X_OHdXOzQM5y06VUadXjYkze6yzufL1d7_6xc,4
|
7
|
-
AMR-2.1.1.9127.dist-info/RECORD,,
|
File without changes
|
File without changes
|