AMR 2.1.1.9094__tar.gz → 2.1.1.9099__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.
- {AMR-2.1.1.9094 → AMR-2.1.1.9099}/AMR/datasets.py +21 -3
- {AMR-2.1.1.9094 → AMR-2.1.1.9099}/AMR.egg-info/PKG-INFO +39 -71
- {AMR-2.1.1.9094 → AMR-2.1.1.9099}/PKG-INFO +39 -71
- {AMR-2.1.1.9094 → AMR-2.1.1.9099}/README.md +37 -69
- {AMR-2.1.1.9094 → AMR-2.1.1.9099}/setup.py +2 -2
- {AMR-2.1.1.9094 → AMR-2.1.1.9099}/AMR/__init__.py +0 -0
- {AMR-2.1.1.9094 → AMR-2.1.1.9099}/AMR/functions.py +0 -0
- {AMR-2.1.1.9094 → AMR-2.1.1.9099}/AMR.egg-info/SOURCES.txt +0 -0
- {AMR-2.1.1.9094 → AMR-2.1.1.9099}/AMR.egg-info/dependency_links.txt +0 -0
- {AMR-2.1.1.9094 → AMR-2.1.1.9099}/AMR.egg-info/requires.txt +0 -0
- {AMR-2.1.1.9094 → AMR-2.1.1.9099}/AMR.egg-info/top_level.txt +0 -0
- {AMR-2.1.1.9094 → AMR-2.1.1.9099}/setup.cfg +0 -0
@@ -8,14 +8,31 @@ from rpy2 import robjects
|
|
8
8
|
from rpy2.robjects import pandas2ri
|
9
9
|
from rpy2.robjects.packages import importr, isinstalled
|
10
10
|
import pandas as pd
|
11
|
+
# import importlib.metadata as metadata
|
11
12
|
|
12
|
-
# Check if
|
13
|
+
# Check if AMR package is installed in R
|
13
14
|
if not isinstalled('AMR'):
|
14
15
|
utils = importr('utils')
|
15
|
-
utils.install_packages('AMR')
|
16
|
+
utils.install_packages('AMR', repos='https://msberends.r-universe.dev')
|
17
|
+
|
18
|
+
# Python package version of AMR
|
19
|
+
python_amr_version = metadata.version('AMR')
|
20
|
+
# R package version of AMR
|
21
|
+
# r_amr_version = robjects.r('packageVersion("AMR")')[0]
|
22
|
+
|
23
|
+
# 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)
|
16
32
|
|
17
33
|
# Activate the automatic conversion between R and pandas DataFrames
|
18
34
|
pandas2ri.activate()
|
35
|
+
|
19
36
|
# example_isolates
|
20
37
|
example_isolates = pandas2ri.rpy2py(robjects.r('''
|
21
38
|
df <- AMR::example_isolates
|
@@ -26,6 +43,7 @@ df[] <- lapply(df, function(x) {
|
|
26
43
|
x
|
27
44
|
}
|
28
45
|
})
|
46
|
+
df <- df[, !sapply(df, is.list)]
|
29
47
|
df
|
30
48
|
'''))
|
31
49
|
example_isolates['date'] = pd.to_datetime(example_isolates['date'])
|
@@ -33,6 +51,6 @@ example_isolates['date'] = pd.to_datetime(example_isolates['date'])
|
|
33
51
|
# microorganisms
|
34
52
|
microorganisms = pandas2ri.rpy2py(robjects.r('AMR::microorganisms[, !sapply(AMR::microorganisms, is.list)]'))
|
35
53
|
antibiotics = pandas2ri.rpy2py(robjects.r('AMR::antibiotics[, !sapply(AMR::antibiotics, is.list)]'))
|
36
|
-
clinical_breakpoints = pandas2ri.rpy2py(robjects.r('AMR::clinical_breakpoints'))
|
54
|
+
clinical_breakpoints = pandas2ri.rpy2py(robjects.r('AMR::clinical_breakpoints[, !sapply(AMR::clinical_breakpoints, is.list)]'))
|
37
55
|
|
38
56
|
print(f"{BLUE}AMR:{RESET} {GREEN}Done.{RESET}", flush=True)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: AMR
|
3
|
-
Version: 2.1.1.
|
3
|
+
Version: 2.1.1.9099
|
4
4
|
Summary: A Python wrapper for the AMR R package
|
5
5
|
Home-page: https://github.com/msberends/AMR
|
6
|
-
Author: Matthijs Berends
|
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
|
@@ -13,43 +13,43 @@ Classifier: Operating System :: OS Independent
|
|
13
13
|
Requires-Python: >=3.6
|
14
14
|
Description-Content-Type: text/markdown
|
15
15
|
|
16
|
-
---
|
17
|
-
title: "AMR for Python"
|
18
|
-
output:
|
19
|
-
rmarkdown::html_vignette:
|
20
|
-
toc: true
|
21
|
-
toc_depth: 3
|
22
|
-
vignette: >
|
23
|
-
%\VignetteIndexEntry{AMR for Python}
|
24
|
-
%\VignetteEncoding{UTF-8}
|
25
|
-
%\VignetteEngine{knitr::rmarkdown}
|
26
|
-
editor_options:
|
27
|
-
chunk_output_type: console
|
28
|
-
---
|
29
|
-
|
30
|
-
```{r setup, include = FALSE, results = 'markup'}
|
31
|
-
knitr::opts_chunk$set(
|
32
|
-
warning = FALSE,
|
33
|
-
collapse = TRUE,
|
34
|
-
comment = "#>",
|
35
|
-
fig.width = 7.5,
|
36
|
-
fig.height = 5
|
37
|
-
)
|
38
|
-
```
|
39
16
|
|
40
|
-
|
17
|
+
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/).
|
18
|
+
|
19
|
+
This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` package internally. Despite the need to have R installed, Python users can now easily work with AMR data directly through Python code.
|
20
|
+
|
21
|
+
# Install
|
41
22
|
|
42
|
-
|
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.
|
43
24
|
|
44
|
-
|
25
|
+
For Linux:
|
45
26
|
|
46
|
-
|
27
|
+
```bash
|
28
|
+
# Ubuntu / Debian
|
29
|
+
sudo apt install r-base
|
30
|
+
# Fedora:
|
31
|
+
sudo dnf install R
|
32
|
+
# CentOS/RHEL
|
33
|
+
sudo yum install R
|
34
|
+
```
|
35
|
+
|
36
|
+
For macOS (using [Homebrew](https://brew.sh)):
|
37
|
+
|
38
|
+
```bash
|
39
|
+
brew install r
|
40
|
+
```
|
41
|
+
|
42
|
+
For Windows, visit the [CRAN download page](https://cran.r-project.org) to download and install R.
|
47
43
|
|
48
|
-
|
44
|
+
2. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
|
49
45
|
|
50
|
-
|
46
|
+
```bash
|
47
|
+
pip install AMR
|
48
|
+
```
|
51
49
|
|
52
|
-
|
50
|
+
# Examples of Usage
|
51
|
+
|
52
|
+
## Cleaning Taxonomy
|
53
53
|
|
54
54
|
Here’s an example that demonstrates how to clean microorganism and drug names using the `AMR` Python package:
|
55
55
|
|
@@ -85,7 +85,8 @@ print(df)
|
|
85
85
|
|
86
86
|
* **ab_name**: Similarly, this function standardises antimicrobial names. The different representations of ciprofloxacin (e.g., "Cipro", "CIP", "J01MA02", and "Ciproxin") are all converted to the standard name, "Ciprofloxacin".
|
87
87
|
|
88
|
-
|
88
|
+
|
89
|
+
## Taxonomic Data Sets Now in Python!
|
89
90
|
|
90
91
|
As a Python user, you might like that the most important data sets of the `AMR` R package, `microorganisms`, `antibiotics`, `clinical_breakpoints`, and `example_isolates`, are now available as regular Python data frames:
|
91
92
|
|
@@ -126,42 +127,7 @@ AMR.antibiotics
|
|
126
127
|
| ZFD | NaN | Zoliflodacin | None | NaN | None | NaN | None |
|
127
128
|
|
128
129
|
|
129
|
-
|
130
|
-
|
131
|
-
To be able to use the `AMR` Python package, it is required to install both R and the `AMR` R package.
|
132
|
-
|
133
|
-
### Preparation: Install R and `AMR` R package
|
134
|
-
|
135
|
-
For Linux and macOS, this is just:
|
136
|
-
|
137
|
-
```bash
|
138
|
-
# Ubuntu / Debian
|
139
|
-
sudo apt install r-base && Rscript -e 'install.packages("AMR")'
|
140
|
-
# Fedora:
|
141
|
-
sudo dnf install R && Rscript -e 'install.packages("AMR")'
|
142
|
-
# CentOS/RHEL
|
143
|
-
sudo yum install R && Rscript -e 'install.packages("AMR")'
|
144
|
-
# Arch Linux
|
145
|
-
sudo pacman -S r && Rscript -e 'install.packages("AMR")'
|
146
|
-
# macOS
|
147
|
-
brew install r && Rscript -e 'install.packages("AMR")'
|
148
|
-
```
|
149
|
-
|
150
|
-
For Windows, visit the [CRAN download page](https://cran.r-project.org) in install R, then afterwards install the 'AMR' package manually.
|
151
|
-
|
152
|
-
### Install `AMR` Python Package
|
153
|
-
|
154
|
-
Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
|
155
|
-
|
156
|
-
```bash
|
157
|
-
pip install AMR
|
158
|
-
```
|
159
|
-
|
160
|
-
# Working with `AMR` in Python
|
161
|
-
|
162
|
-
Now that we have everything set up, let’s walk through some practical examples of using the `AMR` package within Python.
|
163
|
-
|
164
|
-
## Example 1: Calculating AMR
|
130
|
+
## Calculating AMR
|
165
131
|
|
166
132
|
```python
|
167
133
|
import AMR
|
@@ -176,7 +142,7 @@ print(result)
|
|
176
142
|
[0.59555556]
|
177
143
|
```
|
178
144
|
|
179
|
-
##
|
145
|
+
## Generating Antibiograms
|
180
146
|
|
181
147
|
One of the core functions of the `AMR` package is generating an antibiogram, a table that summarises the antimicrobial susceptibility of bacterial isolates. Here’s how you can generate an antibiogram from Python:
|
182
148
|
|
@@ -215,6 +181,8 @@ In this example, we generate an antibiogram by selecting various antibiotics.
|
|
215
181
|
|
216
182
|
With the `AMR` Python package, Python users can now effortlessly call R functions from the `AMR` R package. This eliminates the need for complex `rpy2` configurations and provides a clean, easy-to-use interface for antimicrobial resistance analysis. The examples provided above demonstrate how this can be applied to typical workflows, such as standardising microorganism and antimicrobial names or calculating resistance.
|
217
183
|
|
218
|
-
By
|
184
|
+
By just running `import AMR`, users can seamlessly integrate the robust features of the R `AMR` package into Python workflows.
|
185
|
+
|
186
|
+
Whether you're cleaning data or analysing resistance patterns, the `AMR` Python package makes it easy to work with AMR data in Python.
|
219
187
|
|
220
188
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: AMR
|
3
|
-
Version: 2.1.1.
|
3
|
+
Version: 2.1.1.9099
|
4
4
|
Summary: A Python wrapper for the AMR R package
|
5
5
|
Home-page: https://github.com/msberends/AMR
|
6
|
-
Author: Matthijs Berends
|
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
|
@@ -13,43 +13,43 @@ Classifier: Operating System :: OS Independent
|
|
13
13
|
Requires-Python: >=3.6
|
14
14
|
Description-Content-Type: text/markdown
|
15
15
|
|
16
|
-
---
|
17
|
-
title: "AMR for Python"
|
18
|
-
output:
|
19
|
-
rmarkdown::html_vignette:
|
20
|
-
toc: true
|
21
|
-
toc_depth: 3
|
22
|
-
vignette: >
|
23
|
-
%\VignetteIndexEntry{AMR for Python}
|
24
|
-
%\VignetteEncoding{UTF-8}
|
25
|
-
%\VignetteEngine{knitr::rmarkdown}
|
26
|
-
editor_options:
|
27
|
-
chunk_output_type: console
|
28
|
-
---
|
29
|
-
|
30
|
-
```{r setup, include = FALSE, results = 'markup'}
|
31
|
-
knitr::opts_chunk$set(
|
32
|
-
warning = FALSE,
|
33
|
-
collapse = TRUE,
|
34
|
-
comment = "#>",
|
35
|
-
fig.width = 7.5,
|
36
|
-
fig.height = 5
|
37
|
-
)
|
38
|
-
```
|
39
16
|
|
40
|
-
|
17
|
+
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/).
|
18
|
+
|
19
|
+
This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` package internally. Despite the need to have R installed, Python users can now easily work with AMR data directly through Python code.
|
20
|
+
|
21
|
+
# Install
|
41
22
|
|
42
|
-
|
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.
|
43
24
|
|
44
|
-
|
25
|
+
For Linux:
|
45
26
|
|
46
|
-
|
27
|
+
```bash
|
28
|
+
# Ubuntu / Debian
|
29
|
+
sudo apt install r-base
|
30
|
+
# Fedora:
|
31
|
+
sudo dnf install R
|
32
|
+
# CentOS/RHEL
|
33
|
+
sudo yum install R
|
34
|
+
```
|
35
|
+
|
36
|
+
For macOS (using [Homebrew](https://brew.sh)):
|
37
|
+
|
38
|
+
```bash
|
39
|
+
brew install r
|
40
|
+
```
|
41
|
+
|
42
|
+
For Windows, visit the [CRAN download page](https://cran.r-project.org) to download and install R.
|
47
43
|
|
48
|
-
|
44
|
+
2. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
|
49
45
|
|
50
|
-
|
46
|
+
```bash
|
47
|
+
pip install AMR
|
48
|
+
```
|
51
49
|
|
52
|
-
|
50
|
+
# Examples of Usage
|
51
|
+
|
52
|
+
## Cleaning Taxonomy
|
53
53
|
|
54
54
|
Here’s an example that demonstrates how to clean microorganism and drug names using the `AMR` Python package:
|
55
55
|
|
@@ -85,7 +85,8 @@ print(df)
|
|
85
85
|
|
86
86
|
* **ab_name**: Similarly, this function standardises antimicrobial names. The different representations of ciprofloxacin (e.g., "Cipro", "CIP", "J01MA02", and "Ciproxin") are all converted to the standard name, "Ciprofloxacin".
|
87
87
|
|
88
|
-
|
88
|
+
|
89
|
+
## Taxonomic Data Sets Now in Python!
|
89
90
|
|
90
91
|
As a Python user, you might like that the most important data sets of the `AMR` R package, `microorganisms`, `antibiotics`, `clinical_breakpoints`, and `example_isolates`, are now available as regular Python data frames:
|
91
92
|
|
@@ -126,42 +127,7 @@ AMR.antibiotics
|
|
126
127
|
| ZFD | NaN | Zoliflodacin | None | NaN | None | NaN | None |
|
127
128
|
|
128
129
|
|
129
|
-
|
130
|
-
|
131
|
-
To be able to use the `AMR` Python package, it is required to install both R and the `AMR` R package.
|
132
|
-
|
133
|
-
### Preparation: Install R and `AMR` R package
|
134
|
-
|
135
|
-
For Linux and macOS, this is just:
|
136
|
-
|
137
|
-
```bash
|
138
|
-
# Ubuntu / Debian
|
139
|
-
sudo apt install r-base && Rscript -e 'install.packages("AMR")'
|
140
|
-
# Fedora:
|
141
|
-
sudo dnf install R && Rscript -e 'install.packages("AMR")'
|
142
|
-
# CentOS/RHEL
|
143
|
-
sudo yum install R && Rscript -e 'install.packages("AMR")'
|
144
|
-
# Arch Linux
|
145
|
-
sudo pacman -S r && Rscript -e 'install.packages("AMR")'
|
146
|
-
# macOS
|
147
|
-
brew install r && Rscript -e 'install.packages("AMR")'
|
148
|
-
```
|
149
|
-
|
150
|
-
For Windows, visit the [CRAN download page](https://cran.r-project.org) in install R, then afterwards install the 'AMR' package manually.
|
151
|
-
|
152
|
-
### Install `AMR` Python Package
|
153
|
-
|
154
|
-
Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
|
155
|
-
|
156
|
-
```bash
|
157
|
-
pip install AMR
|
158
|
-
```
|
159
|
-
|
160
|
-
# Working with `AMR` in Python
|
161
|
-
|
162
|
-
Now that we have everything set up, let’s walk through some practical examples of using the `AMR` package within Python.
|
163
|
-
|
164
|
-
## Example 1: Calculating AMR
|
130
|
+
## Calculating AMR
|
165
131
|
|
166
132
|
```python
|
167
133
|
import AMR
|
@@ -176,7 +142,7 @@ print(result)
|
|
176
142
|
[0.59555556]
|
177
143
|
```
|
178
144
|
|
179
|
-
##
|
145
|
+
## Generating Antibiograms
|
180
146
|
|
181
147
|
One of the core functions of the `AMR` package is generating an antibiogram, a table that summarises the antimicrobial susceptibility of bacterial isolates. Here’s how you can generate an antibiogram from Python:
|
182
148
|
|
@@ -215,6 +181,8 @@ In this example, we generate an antibiogram by selecting various antibiotics.
|
|
215
181
|
|
216
182
|
With the `AMR` Python package, Python users can now effortlessly call R functions from the `AMR` R package. This eliminates the need for complex `rpy2` configurations and provides a clean, easy-to-use interface for antimicrobial resistance analysis. The examples provided above demonstrate how this can be applied to typical workflows, such as standardising microorganism and antimicrobial names or calculating resistance.
|
217
183
|
|
218
|
-
By
|
184
|
+
By just running `import AMR`, users can seamlessly integrate the robust features of the R `AMR` package into Python workflows.
|
185
|
+
|
186
|
+
Whether you're cleaning data or analysing resistance patterns, the `AMR` Python package makes it easy to work with AMR data in Python.
|
219
187
|
|
220
188
|
|
@@ -1,40 +1,40 @@
|
|
1
|
-
---
|
2
|
-
title: "AMR for Python"
|
3
|
-
output:
|
4
|
-
rmarkdown::html_vignette:
|
5
|
-
toc: true
|
6
|
-
toc_depth: 3
|
7
|
-
vignette: >
|
8
|
-
%\VignetteIndexEntry{AMR for Python}
|
9
|
-
%\VignetteEncoding{UTF-8}
|
10
|
-
%\VignetteEngine{knitr::rmarkdown}
|
11
|
-
editor_options:
|
12
|
-
chunk_output_type: console
|
13
|
-
---
|
14
|
-
|
15
|
-
```{r setup, include = FALSE, results = 'markup'}
|
16
|
-
knitr::opts_chunk$set(
|
17
|
-
warning = FALSE,
|
18
|
-
collapse = TRUE,
|
19
|
-
comment = "#>",
|
20
|
-
fig.width = 7.5,
|
21
|
-
fig.height = 5
|
22
|
-
)
|
23
|
-
```
|
24
1
|
|
25
|
-
|
2
|
+
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/).
|
3
|
+
|
4
|
+
This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` package internally. Despite the need to have R installed, Python users can now easily work with AMR data directly through Python code.
|
5
|
+
|
6
|
+
# Install
|
26
7
|
|
27
|
-
|
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.
|
28
9
|
|
29
|
-
|
10
|
+
For Linux:
|
30
11
|
|
31
|
-
|
12
|
+
```bash
|
13
|
+
# Ubuntu / Debian
|
14
|
+
sudo apt install r-base
|
15
|
+
# Fedora:
|
16
|
+
sudo dnf install R
|
17
|
+
# CentOS/RHEL
|
18
|
+
sudo yum install R
|
19
|
+
```
|
20
|
+
|
21
|
+
For macOS (using [Homebrew](https://brew.sh)):
|
22
|
+
|
23
|
+
```bash
|
24
|
+
brew install r
|
25
|
+
```
|
26
|
+
|
27
|
+
For Windows, visit the [CRAN download page](https://cran.r-project.org) to download and install R.
|
32
28
|
|
33
|
-
|
29
|
+
2. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
|
34
30
|
|
35
|
-
|
31
|
+
```bash
|
32
|
+
pip install AMR
|
33
|
+
```
|
36
34
|
|
37
|
-
|
35
|
+
# Examples of Usage
|
36
|
+
|
37
|
+
## Cleaning Taxonomy
|
38
38
|
|
39
39
|
Here’s an example that demonstrates how to clean microorganism and drug names using the `AMR` Python package:
|
40
40
|
|
@@ -70,7 +70,8 @@ print(df)
|
|
70
70
|
|
71
71
|
* **ab_name**: Similarly, this function standardises antimicrobial names. The different representations of ciprofloxacin (e.g., "Cipro", "CIP", "J01MA02", and "Ciproxin") are all converted to the standard name, "Ciprofloxacin".
|
72
72
|
|
73
|
-
|
73
|
+
|
74
|
+
## Taxonomic Data Sets Now in Python!
|
74
75
|
|
75
76
|
As a Python user, you might like that the most important data sets of the `AMR` R package, `microorganisms`, `antibiotics`, `clinical_breakpoints`, and `example_isolates`, are now available as regular Python data frames:
|
76
77
|
|
@@ -111,42 +112,7 @@ AMR.antibiotics
|
|
111
112
|
| ZFD | NaN | Zoliflodacin | None | NaN | None | NaN | None |
|
112
113
|
|
113
114
|
|
114
|
-
|
115
|
-
|
116
|
-
To be able to use the `AMR` Python package, it is required to install both R and the `AMR` R package.
|
117
|
-
|
118
|
-
### Preparation: Install R and `AMR` R package
|
119
|
-
|
120
|
-
For Linux and macOS, this is just:
|
121
|
-
|
122
|
-
```bash
|
123
|
-
# Ubuntu / Debian
|
124
|
-
sudo apt install r-base && Rscript -e 'install.packages("AMR")'
|
125
|
-
# Fedora:
|
126
|
-
sudo dnf install R && Rscript -e 'install.packages("AMR")'
|
127
|
-
# CentOS/RHEL
|
128
|
-
sudo yum install R && Rscript -e 'install.packages("AMR")'
|
129
|
-
# Arch Linux
|
130
|
-
sudo pacman -S r && Rscript -e 'install.packages("AMR")'
|
131
|
-
# macOS
|
132
|
-
brew install r && Rscript -e 'install.packages("AMR")'
|
133
|
-
```
|
134
|
-
|
135
|
-
For Windows, visit the [CRAN download page](https://cran.r-project.org) in install R, then afterwards install the 'AMR' package manually.
|
136
|
-
|
137
|
-
### Install `AMR` Python Package
|
138
|
-
|
139
|
-
Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
|
140
|
-
|
141
|
-
```bash
|
142
|
-
pip install AMR
|
143
|
-
```
|
144
|
-
|
145
|
-
# Working with `AMR` in Python
|
146
|
-
|
147
|
-
Now that we have everything set up, let’s walk through some practical examples of using the `AMR` package within Python.
|
148
|
-
|
149
|
-
## Example 1: Calculating AMR
|
115
|
+
## Calculating AMR
|
150
116
|
|
151
117
|
```python
|
152
118
|
import AMR
|
@@ -161,7 +127,7 @@ print(result)
|
|
161
127
|
[0.59555556]
|
162
128
|
```
|
163
129
|
|
164
|
-
##
|
130
|
+
## Generating Antibiograms
|
165
131
|
|
166
132
|
One of the core functions of the `AMR` package is generating an antibiogram, a table that summarises the antimicrobial susceptibility of bacterial isolates. Here’s how you can generate an antibiogram from Python:
|
167
133
|
|
@@ -200,4 +166,6 @@ In this example, we generate an antibiogram by selecting various antibiotics.
|
|
200
166
|
|
201
167
|
With the `AMR` Python package, Python users can now effortlessly call R functions from the `AMR` R package. This eliminates the need for complex `rpy2` configurations and provides a clean, easy-to-use interface for antimicrobial resistance analysis. The examples provided above demonstrate how this can be applied to typical workflows, such as standardising microorganism and antimicrobial names or calculating resistance.
|
202
168
|
|
203
|
-
By
|
169
|
+
By just running `import AMR`, users can seamlessly integrate the robust features of the R `AMR` package into Python workflows.
|
170
|
+
|
171
|
+
Whether you're cleaning data or analysing resistance patterns, the `AMR` Python package makes it easy to work with AMR data in Python.
|
@@ -2,14 +2,14 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name='AMR',
|
5
|
-
version='2.1.1.
|
5
|
+
version='2.1.1.9099',
|
6
6
|
packages=find_packages(),
|
7
7
|
install_requires=[
|
8
8
|
'rpy2',
|
9
9
|
'numpy',
|
10
10
|
'pandas',
|
11
11
|
],
|
12
|
-
author='Matthijs Berends',
|
12
|
+
author='Dr. Matthijs Berends',
|
13
13
|
author_email='m.s.berends@umcg.nl',
|
14
14
|
description='A Python wrapper for the AMR R package',
|
15
15
|
long_description=open('README.md').read(),
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|