(v2.1.1.9087) update unit tests

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2024-10-04 15:28:44 +02:00
1 parent 738689beea
commit 9fb891eee2
5 files changed
+34272 -7

No files matched your search

+10 -2
View File
@@ -159,15 +159,18 @@ pre_commit_lst$MO_STREP_ABCG <- AMR::microorganisms$mo[which(AMR::microorganisms
))] ))]
pre_commit_lst$MO_LANCEFIELD <- AMR::microorganisms$mo[which(AMR::microorganisms$mo %like% "^(B_STRPT_PYGN(_|$)|B_STRPT_AGLC(_|$)|B_STRPT_(DYSG|EQUI)(_|$)|B_STRPT_ANGN(_|$)|B_STRPT_(DYSG|CANS)(_|$)|B_STRPT_SNGN(_|$)|B_STRPT_SLVR(_|$))")] pre_commit_lst$MO_LANCEFIELD <- AMR::microorganisms$mo[which(AMR::microorganisms$mo %like% "^(B_STRPT_PYGN(_|$)|B_STRPT_AGLC(_|$)|B_STRPT_(DYSG|EQUI)(_|$)|B_STRPT_ANGN(_|$)|B_STRPT_(DYSG|CANS)(_|$)|B_STRPT_SNGN(_|$)|B_STRPT_SLVR(_|$))")]
pre_commit_lst$MO_WHO_PRIORITY_GENERA <- c( pre_commit_lst$MO_WHO_PRIORITY_GENERA <- c(
# World Health Organization's (WHO) Priority Pathogen List # World Health Organization's (WHO) Priority Pathogen List (some are from the group Enterobacteriaceae)
"Acinetobacter", "Acinetobacter",
"Aspergillus", "Aspergillus",
"Blastomyces", "Blastomyces",
"Campylobacter", "Campylobacter",
"Candida", "Candida",
"Citrobacter",
"Clostridioides", "Clostridioides",
"Coccidioides", "Coccidioides",
"Cryptococcus", "Cryptococcus",
"Edwardsiella",
"Enterobacter",
"Enterococcus", "Enterococcus",
"Escherichia", "Escherichia",
"Fusarium", "Fusarium",
@@ -175,15 +178,20 @@ pre_commit_lst$MO_WHO_PRIORITY_GENERA <- c(
"Helicobacter", "Helicobacter",
"Histoplasma", "Histoplasma",
"Klebsiella", "Klebsiella",
"Morganella",
"Mycobacterium", "Mycobacterium",
"Neisseria", "Neisseria",
"Paracoccidioides", "Paracoccidioides",
"Pneumocystis", "Pneumocystis",
"Proteus",
"Providencia",
"Pseudomonas", "Pseudomonas",
"Salmonella", "Salmonella",
"Serratia",
"Shigella", "Shigella",
"Staphylococcus", "Staphylococcus",
"Streptococcus" "Streptococcus",
"Yersinia"
) )
pre_commit_lst$MO_RELEVANT_GENERA <- c( pre_commit_lst$MO_RELEVANT_GENERA <- c(
"Absidia", "Absidia",
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
# Define the output file, located in ./data-raw
output_file="gpt_training_text.txt"
# 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 -e "\n\n\n\n" >> "$output_file"
# Function to remove header block (delimited by # ======)
remove_header() {
sed '/# =\{6,\}/,/# =\{6,\}/d' "$1"
}
# Process all .R files in the '../R' folder
for file in ../R/*.R; do
echo "THE NEXT PART 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
# Process all .Rmd files in the '../vignettes' folder
for file in ../vignettes/*.Rmd; do
echo "THE NEXT PART 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
# Process important metadata files (DESCRIPTION, NAMESPACE, README.md)
for file in ../DESCRIPTION ../NAMESPACE ../README.md; do
if [[ -f $file ]]; then
echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo -e "\n\n" >> "$output_file"
cat "$file" >> "$output_file"
echo -e "\n\n" >> "$output_file"
fi
done
# Process test files (if available) in the '../tests' folder
for file in ../tests/*.R; do
echo "THE NEXT PART 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
# Process all .Rd files from the '../man' folder
for file in ../man/*.Rd; do
echo "THE NEXT PART 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
File diff suppressed because it is too large. Load diff
Binary file not shown.
+5 -5
View File
@@ -206,7 +206,7 @@ expect_equal(
), ),
na.rm = TRUE na.rm = TRUE
), ),
1376 1390
) )
# unknown MOs # unknown MOs
@@ -214,23 +214,23 @@ test_unknown <- example_isolates
test_unknown$mo <- ifelse(test_unknown$mo == "B_ESCHR_COLI", "UNKNOWN", test_unknown$mo) test_unknown$mo <- ifelse(test_unknown$mo == "B_ESCHR_COLI", "UNKNOWN", test_unknown$mo)
expect_equal( expect_equal(
sum(first_isolate(test_unknown, include_unknown = FALSE)), sum(first_isolate(test_unknown, include_unknown = FALSE)),
1106 1116
) )
expect_equal( expect_equal(
sum(first_isolate(test_unknown, include_unknown = TRUE)), sum(first_isolate(test_unknown, include_unknown = TRUE)),
1589 1599
) )
test_unknown$mo <- ifelse(test_unknown$mo == "UNKNOWN", NA, test_unknown$mo) test_unknown$mo <- ifelse(test_unknown$mo == "UNKNOWN", NA, test_unknown$mo)
expect_equal( expect_equal(
sum(first_isolate(test_unknown)), sum(first_isolate(test_unknown)),
1106 1116
) )
# empty sir results # empty sir results
expect_equal( expect_equal(
sum(first_isolate(example_isolates, include_untested_sir = FALSE)), sum(first_isolate(example_isolates, include_untested_sir = FALSE)),
1360 1374
) )
# shortcuts # shortcuts