AMR 2.1.1.9099__tar.gz → 2.1.1.9106__tar.gz

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.
@@ -4,31 +4,48 @@ RESET = '\033[0m'
4
4
 
5
5
  print(f"{BLUE}AMR:{RESET} Setting up R environment and AMR datasets...", flush=True)
6
6
 
7
+
8
+ import os
7
9
  from rpy2 import robjects
8
10
  from rpy2.robjects import pandas2ri
9
11
  from rpy2.robjects.packages import importr, isinstalled
10
12
  import pandas as pd
11
- # import importlib.metadata as metadata
13
+ import importlib.metadata as metadata
14
+
15
+ # Get the path to the virtual environment
16
+ venv_path = os.getenv('VIRTUAL_ENV') # Path to the active virtual environment
17
+ if not venv_path:
18
+ raise EnvironmentError("No virtual environment detected. Please activate your Python virtual environment.")
12
19
 
13
- # Check if AMR package is installed in R
20
+ # Define R library path within the venv
21
+ r_lib_path = os.path.join(venv_path, "R_libs")
22
+ # Ensure the R library path exists
23
+ os.makedirs(r_lib_path, exist_ok=True)
24
+ # Set the R library path in .libPaths
25
+ base = importr('base')
26
+ base._libPaths(r_lib_path)
27
+
28
+ # Check if the AMR package is installed in R
14
29
  if not isinstalled('AMR'):
15
30
  utils = importr('utils')
16
- utils.install_packages('AMR', repos='https://msberends.r-universe.dev')
31
+ utils.install_packages('AMR', repos='https://msberends.r-universe.dev', quiet=True)
17
32
 
18
33
  # Python package version of AMR
19
- python_amr_version = metadata.version('AMR')
34
+ try:
35
+ python_amr_version = metadata.version('AMR')
36
+ except metadata.PackageNotFoundError:
37
+ python_amr_version = None
38
+
20
39
  # R package version of AMR
21
- # r_amr_version = robjects.r('packageVersion("AMR")')[0]
40
+ r_amr_version = robjects.r(f'as.character(packageVersion("AMR", lib.loc = "{r_lib_path}"))')[0]
22
41
 
23
42
  # Compare R and Python package versions
24
- # if r_amr_version != python_amr_version:
25
- # print(f"{BLUE}AMR:{RESET} Version mismatch detected. Updating AMR R package version to {python_amr_version}...", flush=True)
26
- # try:
27
- # # Re-install the specific version of AMR in R
28
- # utils = importr('utils')
29
- # utils.install_packages('AMR', repos='https://msberends.r-universe.dev')
30
- # except Exception as e:
31
- # print(f"{BLUE}AMR:{RESET} Could not update: {e}{RESET}", flush=True)
43
+ if python_amr_version and r_amr_version != python_amr_version:
44
+ try:
45
+ utils = importr('utils')
46
+ utils.install_packages('AMR', repos='https://msberends.r-universe.dev', quiet=True)
47
+ except Exception as e:
48
+ print(f"{BLUE}AMR:{RESET} Could not update: {e}{RESET}", flush=True)
32
49
 
33
50
  # Activate the automatic conversion between R and pandas DataFrames
34
51
  pandas2ri.activate()
@@ -1,17 +1,19 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: AMR
3
- Version: 2.1.1.9099
3
+ Version: 2.1.1.9106
4
4
  Summary: A Python wrapper for the AMR R package
5
5
  Home-page: https://github.com/msberends/AMR
6
6
  Author: Dr. Matthijs Berends
7
7
  Author-email: m.s.berends@umcg.nl
8
8
  License: GPL 2
9
9
  Project-URL: Bug Tracker, https://github.com/msberends/AMR/issues
10
- Platform: UNKNOWN
11
10
  Classifier: Programming Language :: Python :: 3
12
11
  Classifier: Operating System :: OS Independent
13
12
  Requires-Python: >=3.6
14
13
  Description-Content-Type: text/markdown
14
+ Requires-Dist: rpy2
15
+ Requires-Dist: numpy
16
+ Requires-Dist: pandas
15
17
 
16
18
 
17
19
  The `AMR` package for R is a powerful tool for antimicrobial resistance (AMR) analysis. It provides extensive features for handling microbial and antimicrobial data. However, for those who work primarily in Python, we now have a more intuitive option available: the [`AMR` Python Package Index](https://pypi.org/project/AMR/).
@@ -20,7 +22,13 @@ This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` p
20
22
 
21
23
  # Install
22
24
 
23
- 1. First make sure you have R installed. There is **no need to install the `AMR` R package**, as it will be installed automatically.
25
+ 1. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
26
+
27
+ ```bash
28
+ pip install AMR
29
+ ```
30
+
31
+ 2. Make sure you have R installed. There is **no need to install the `AMR` R package**, as it will be installed automatically.
24
32
 
25
33
  For Linux:
26
34
 
@@ -41,12 +49,6 @@ This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` p
41
49
 
42
50
  For Windows, visit the [CRAN download page](https://cran.r-project.org) to download and install R.
43
51
 
44
- 2. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
45
-
46
- ```bash
47
- pip install AMR
48
- ```
49
-
50
52
  # Examples of Usage
51
53
 
52
54
  ## Cleaning Taxonomy
@@ -184,5 +186,3 @@ With the `AMR` Python package, Python users can now effortlessly call R function
184
186
  By just running `import AMR`, users can seamlessly integrate the robust features of the R `AMR` package into Python workflows.
185
187
 
186
188
  Whether you're cleaning data or analysing resistance patterns, the `AMR` Python package makes it easy to work with AMR data in Python.
187
-
188
-
@@ -1,17 +1,19 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: AMR
3
- Version: 2.1.1.9099
3
+ Version: 2.1.1.9106
4
4
  Summary: A Python wrapper for the AMR R package
5
5
  Home-page: https://github.com/msberends/AMR
6
6
  Author: Dr. Matthijs Berends
7
7
  Author-email: m.s.berends@umcg.nl
8
8
  License: GPL 2
9
9
  Project-URL: Bug Tracker, https://github.com/msberends/AMR/issues
10
- Platform: UNKNOWN
11
10
  Classifier: Programming Language :: Python :: 3
12
11
  Classifier: Operating System :: OS Independent
13
12
  Requires-Python: >=3.6
14
13
  Description-Content-Type: text/markdown
14
+ Requires-Dist: rpy2
15
+ Requires-Dist: numpy
16
+ Requires-Dist: pandas
15
17
 
16
18
 
17
19
  The `AMR` package for R is a powerful tool for antimicrobial resistance (AMR) analysis. It provides extensive features for handling microbial and antimicrobial data. However, for those who work primarily in Python, we now have a more intuitive option available: the [`AMR` Python Package Index](https://pypi.org/project/AMR/).
@@ -20,7 +22,13 @@ This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` p
20
22
 
21
23
  # Install
22
24
 
23
- 1. First make sure you have R installed. There is **no need to install the `AMR` R package**, as it will be installed automatically.
25
+ 1. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
26
+
27
+ ```bash
28
+ pip install AMR
29
+ ```
30
+
31
+ 2. Make sure you have R installed. There is **no need to install the `AMR` R package**, as it will be installed automatically.
24
32
 
25
33
  For Linux:
26
34
 
@@ -41,12 +49,6 @@ This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` p
41
49
 
42
50
  For Windows, visit the [CRAN download page](https://cran.r-project.org) to download and install R.
43
51
 
44
- 2. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
45
-
46
- ```bash
47
- pip install AMR
48
- ```
49
-
50
52
  # Examples of Usage
51
53
 
52
54
  ## Cleaning Taxonomy
@@ -184,5 +186,3 @@ With the `AMR` Python package, Python users can now effortlessly call R function
184
186
  By just running `import AMR`, users can seamlessly integrate the robust features of the R `AMR` package into Python workflows.
185
187
 
186
188
  Whether you're cleaning data or analysing resistance patterns, the `AMR` Python package makes it easy to work with AMR data in Python.
187
-
188
-
@@ -5,7 +5,13 @@ This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` p
5
5
 
6
6
  # Install
7
7
 
8
- 1. First make sure you have R installed. There is **no need to install the `AMR` R package**, as it will be installed automatically.
8
+ 1. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
9
+
10
+ ```bash
11
+ pip install AMR
12
+ ```
13
+
14
+ 2. Make sure you have R installed. There is **no need to install the `AMR` R package**, as it will be installed automatically.
9
15
 
10
16
  For Linux:
11
17
 
@@ -26,12 +32,6 @@ This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` p
26
32
 
27
33
  For Windows, visit the [CRAN download page](https://cran.r-project.org) to download and install R.
28
34
 
29
- 2. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
30
-
31
- ```bash
32
- pip install AMR
33
- ```
34
-
35
35
  # Examples of Usage
36
36
 
37
37
  ## Cleaning Taxonomy
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='AMR',
5
- version='2.1.1.9099',
5
+ version='2.1.1.9106',
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  'rpy2',
File without changes
File without changes
File without changes