Format AMRgen long-format AST data to a table with the fields required for submission to EBI, and optionally generate JSON submission files (one per BioSample). See https://www.ebi.ac.uk/amr/amr_submission_guide/).
Usage
export_ebi_ast(
data,
pheno_col = "pheno_provided",
breakpoint_version,
submission_account,
domain = "self.ExampleDomain",
output_dir = NULL
)Arguments
- data
A data frame in AMRgen long format (e.g. output of
import_ast()orformat_ast()). Expected columns:id,drug_agent,spp_pheno, and at least one phenotype column (seepheno_col). Optional columns:mic,disk,method,platform.- pheno_col
Character string naming the column that contains SIR interpretations (class
sir). Default"pheno_provided".- breakpoint_version
Character string specifying the breakpoint version used for interpretation (e.g.
"EUCAST 2024").- submission_account
Character string specifying the EBI Webin submission account identifier (e.g.
"Webin-###"). If not provided, JSON output files will not be generated and the function will return the formated table only, which can be further updated and converted to submission-ready JSON later usingformat_ebi_json().- domain
Character string specifying the domain used in the submission metadata (e.g.
"self.ExampleDomain"). If not provided, JSON output files will not be generated and the function will return the formated table only, which can be further updated and converted to submission-ready JSON later usingformat_ebi_json().- output_dir
Character string specifying the directory where JSON files should be written. If not provided, JSON output files will not be generated and the function will return the formated table only, which can be further updated and converted to submission-ready JSON later using
format_ebi_json().
Value
Formatted data frame. When output_dir is provided, the AST data
is also written to individual JSON submission files, one per BioSample, in
the specified directory.
Details
Antibiotic names are in Title Case with "/" separating
combination agents (EBI convention, e.g.
"Amoxicillin/clavulanic acid").
Species names are derived from the spp_pheno column via
AMR::mo_name().
Examples
# Return formatted data frame without writing files
ebi_df <- export_ebi_ast(staph_ast_ebi)
if (FALSE) { # \dontrun{
# Write out data for each BioSample to an individual JSON file for submission
ebi_df <- export_ebi_ast(staph_ast_ebi,
breakpoint_version = "EUCAST 2015",
submission_account = "Webin-###",
domain = "self.ExampleDomain",
output_dir = "/path/to/output/"
)
} # }
