mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 19:26:12 +01:00
(v2.1.1.9107) new pkg knowledge for AMR
This commit is contained in:
parent
31a0da0d3a
commit
0fda130a0b
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 2.1.1.9106
|
Version: 2.1.1.9107
|
||||||
Date: 2024-11-21
|
Date: 2024-11-21
|
||||||
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)
|
||||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 2.1.1.9106
|
# AMR 2.1.1.9107
|
||||||
|
|
||||||
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://msberends.github.io/AMR/#latest-development-version).)*
|
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://msberends.github.io/AMR/#latest-development-version).)*
|
||||||
|
|
||||||
|
@ -6,13 +6,17 @@ if [ "$(basename "$PWD")" != "AMR" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -rf data-raw/gpt_training_text_v*
|
||||||
|
|
||||||
# Define the output file, located in ./data-raw
|
# Define the output file, located in ./data-raw
|
||||||
version="$1"
|
version="$1"
|
||||||
output_file="data-raw/gpt_training_text_v${version}.txt"
|
output_file="data-raw/gpt_training_text_v${version}.txt"
|
||||||
|
|
||||||
# Clear the output file if it exists
|
# Clear the output file if it exists
|
||||||
echo "This files contains all context you must know about the AMR package for R." > "$output_file"
|
echo "This files contains all context you must know about the AMR package for R." > "$output_file"
|
||||||
echo -e "\n\n\n\n" >> "$output_file"
|
echo "First and foremost, you are trained on version ${version}. Remember this whenever someone asks which AMR package version you’re at." >> "$output_file"
|
||||||
|
echo "--------------------------------" >> "$output_file"
|
||||||
|
echo "" >> "$output_file"
|
||||||
|
|
||||||
# Function to remove header block (delimited by # ======)
|
# Function to remove header block (delimited by # ======)
|
||||||
remove_header() {
|
remove_header() {
|
||||||
@ -20,43 +24,51 @@ remove_header() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Process all .R files in the 'R' folder
|
# Process all .R files in the 'R' folder
|
||||||
for file in R/*.R; do
|
# for file in R/*.R; do
|
||||||
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
|
# echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE '$file':" >> "$output_file"
|
||||||
echo -e "\n\n" >> "$output_file"
|
# echo -e "\n" >> "$output_file"
|
||||||
|
# remove_header "$file" >> "$output_file"
|
||||||
|
# echo -e "\n\n" >> "$output_file"
|
||||||
|
# done
|
||||||
|
|
||||||
|
# Process important metadata files (DESCRIPTION, NAMESPACE, index.md)
|
||||||
|
for file in NAMESPACE index.md; do
|
||||||
|
if [[ -f $file ]]; then
|
||||||
|
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE '$file':" >> "$output_file"
|
||||||
|
echo -e "\n" >> "$output_file"
|
||||||
|
cat "$file" >> "$output_file"
|
||||||
|
echo -e "\n\n" >> "$output_file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Process all .Rd files from the 'man' folder
|
||||||
|
for file in man/*.Rd; do
|
||||||
|
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE '$file':" >> "$output_file"
|
||||||
|
echo -e "\n" >> "$output_file"
|
||||||
remove_header "$file" >> "$output_file"
|
remove_header "$file" >> "$output_file"
|
||||||
echo -e "\n\n" >> "$output_file"
|
echo -e "\n\n" >> "$output_file"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Process all .Rmd files in the 'vignettes' folder
|
# Process all .Rmd files in the 'vignettes' folder
|
||||||
for file in vignettes/*.Rmd; do
|
for file in vignettes/*.Rmd; do
|
||||||
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
|
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE '$file':" >> "$output_file"
|
||||||
echo -e "\n\n" >> "$output_file"
|
echo -e "\n" >> "$output_file"
|
||||||
remove_header "$file" >> "$output_file"
|
remove_header "$file" >> "$output_file"
|
||||||
echo -e "\n\n" >> "$output_file"
|
echo -e "\n\n" >> "$output_file"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Process important metadata files (DESCRIPTION, NAMESPACE, index.md)
|
# Process all .Rmd files in the 'vignettes' folder
|
||||||
for file in DESCRIPTION NAMESPACE index.md; do
|
echo "THE PART HEREAFTER CONTAINS THE README OF OUR PYTHON PACKAGE" >> "$output_file"
|
||||||
if [[ -f $file ]]; then
|
echo -e "\n" >> "$output_file"
|
||||||
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
|
for file in PythonPackage/AMR/README.md; do
|
||||||
echo -e "\n\n" >> "$output_file"
|
remove_header "$file" >> "$output_file"
|
||||||
cat "$file" >> "$output_file"
|
echo -e "\n\n" >> "$output_file"
|
||||||
echo -e "\n\n" >> "$output_file"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Process test files (if available) in the 'tests' folder
|
# Process test files (if available) in the 'tests' folder
|
||||||
for file in tests/*.R; do
|
# for file in tests/*.R; do
|
||||||
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
|
# echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE '$file':" >> "$output_file"
|
||||||
echo -e "\n\n" >> "$output_file"
|
# echo -e "\n" >> "$output_file"
|
||||||
remove_header "$file" >> "$output_file"
|
# remove_header "$file" >> "$output_file"
|
||||||
echo -e "\n\n" >> "$output_file"
|
# echo -e "\n\n" >> "$output_file"
|
||||||
done
|
# done
|
||||||
|
|
||||||
# Process all .Rd files from the 'man' folder
|
|
||||||
for file in man/*.Rd; do
|
|
||||||
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
|
|
||||||
echo -e "\n\n" >> "$output_file"
|
|
||||||
remove_header "$file" >> "$output_file"
|
|
||||||
echo -e "\n\n" >> "$output_file"
|
|
||||||
done
|
|
||||||
|
@ -46,9 +46,6 @@ BLUE = '\033[94m'
|
|||||||
GREEN = '\033[32m'
|
GREEN = '\033[32m'
|
||||||
RESET = '\033[0m'
|
RESET = '\033[0m'
|
||||||
|
|
||||||
print(f"{BLUE}AMR:{RESET} Setting up R environment and AMR datasets...", flush=True)
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from rpy2 import robjects
|
from rpy2 import robjects
|
||||||
from rpy2.robjects import pandas2ri
|
from rpy2.robjects import pandas2ri
|
||||||
@ -58,8 +55,6 @@ import importlib.metadata as metadata
|
|||||||
|
|
||||||
# Get the path to the virtual environment
|
# Get the path to the virtual environment
|
||||||
venv_path = os.getenv('VIRTUAL_ENV') # Path to the active virtual environment
|
venv_path = os.getenv('VIRTUAL_ENV') # Path to the active virtual environment
|
||||||
if not venv_path:
|
|
||||||
raise EnvironmentError("No virtual environment detected. Please activate your Python virtual environment.")
|
|
||||||
|
|
||||||
# Define R library path within the venv
|
# Define R library path within the venv
|
||||||
r_lib_path = os.path.join(venv_path, "R_libs")
|
r_lib_path = os.path.join(venv_path, "R_libs")
|
||||||
@ -86,11 +81,14 @@ r_amr_version = robjects.r(f'as.character(packageVersion("AMR", lib.loc = "{r_li
|
|||||||
# Compare R and Python package versions
|
# Compare R and Python package versions
|
||||||
if python_amr_version and r_amr_version != python_amr_version:
|
if python_amr_version and r_amr_version != python_amr_version:
|
||||||
try:
|
try:
|
||||||
|
print(f"{BLUE}AMR:{RESET} Updating package version{RESET}", flush=True)
|
||||||
utils = importr('utils')
|
utils = importr('utils')
|
||||||
utils.install_packages('AMR', repos='https://msberends.r-universe.dev', quiet=True)
|
utils.install_packages('AMR', repos='https://msberends.r-universe.dev', quiet=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"{BLUE}AMR:{RESET} Could not update: {e}{RESET}", flush=True)
|
print(f"{BLUE}AMR:{RESET} Could not update: {e}{RESET}", flush=True)
|
||||||
|
|
||||||
|
print(f"{BLUE}AMR:{RESET} 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
|
||||||
pandas2ri.activate()
|
pandas2ri.activate()
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
10203
data-raw/gpt_training_text_v2.1.1.9007.txt
Normal file
10203
data-raw/gpt_training_text_v2.1.1.9007.txt
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
10132
data-raw/gpt_training_text_v2.1.1.9107.txt
Normal file
10132
data-raw/gpt_training_text_v2.1.1.9107.txt
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user