mirror of
https://github.com/msberends/AMR.git
synced 2026-11-16 00:10:57 +01:00
- data-raw/microorganisms_files/: registry of all MO codes of every release since v2.0.0 (78,992 codes, built from the git tags), approved renames, and README with the rules; decision by Matthijs S. Berends: MO codes from before v2.0.0 are not supported - as.mo(): codes of earlier releases are translated deterministically via the internal MO_RETIRED_CODES (generated from the registry); unknown codes are no longer guessed (previously F_TRCHP, Trichophyton in v3.0.1, became Talaromyces chlamydosporus) - synonym_mo_to_accepted_mo(): a missing target of one source no longer overwrites a valid target of another source (e.g. Chaetomium abuense), and no 'renamed to itself' - taxonomy build: codes are reused and reserved from the registry instead of the development data (fixes 40 codes reused in the 2026 development data), also for phylum to family; synonym cycles are broken; dangling 'renamed to' identifiers are removed; the build stops on any broken integrity rule before saving - run_microorganisms_build.R: runs the build in chunks at its checkpoints in one R process, with progress logging and resuming from any checkpoint; prompt updated accordingly - tests: shared integrity rules (helper-microorganisms.R) used by build and testthat, registry tests over all codes, sentinel organisms, regression tests; current defects of the data on main are listed in microorganisms_known_defects.csv until the next rebuild Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2.8 KiB
2.8 KiB
MO code registry
MO codes (such as B_ESCHR_COLI) are stored by users in their own data, sometimes for years. A code must
therefore always mean the same taxon, in every future version of the AMR package. This folder contains
the registry that guarantees this.
Files
| File | Contents |
|---|---|
mo_code_registry.csv |
Every MO code that was ever part of a released version of the AMR package since v2.0.0, with the taxon it denotes (name, rank, domain, genus, species, subspecies), the first and last release it was in, and older names of the same code (e.g. a corrected spelling). |
build_mo_code_registry.R |
Recreates mo_code_registry.csv from the git tags of all releases. Run it after every new release. |
mo_code_renames.csv |
The only allowed exceptions: registered codes that get another name, because it is the same taxon (e.g. a corrected spelling or a renamed species group). Every row needs approved_by and approved_date. |
Rules
- Only releases count. Development versions (the main branch) are never part of the registry. Codes that only existed in a development version carry no weight and may be reassigned.
- Codes from before v2.0.0 are not supported. Decision by Matthijs S. Berends, 3 October 2026: MO codes from releases before v2.0.0 (12 March 2023) are not supported. Every code in all releases since v2.0.0 has always meant the same taxon (checked on 3 October 2026), so the registry starts without conflicts.
- A registered code is never given to another taxon. The taxonomy build
(
data-raw/_reproduction_scripts/reproduction_of_microorganisms.R) reuses the code of every taxon in the registry (most recent release first), never gives a registered code to a new taxon, and stops if a registered code would get another name than in the registry, unless that is listed and approved inmo_code_renames.csv. - A registered code that is no longer in the data still works.
as.mo()translates it to the current code of the same taxon (by its name, so also if the taxon moved to another domain), using an internal lookup table (MO_RETIRED_CODES) that is created from the registry indata-raw/_pre_commit_checks.R. If the taxon is no longer in the data at all, the result isNAwith a warning. The package never guesses. - Tests enforce all of this.
tests/testthat/test-data-microorganisms.Rchecks the current data against the registry and the renames, and checks that every registered code resolves to its own taxon.
After a release
- Make sure the git tag of the release exists (e.g.
v3.1.0). - Run
source("data-raw/microorganisms_files/build_mo_code_registry.R")from the root of the repository. - Review the changes to
mo_code_registry.csv(git diff): only new codes may be added, and existing codes may only get a laterlast_release. Commit the result.