Export a phyloseq object to a multi-sheet Excel file for GBIF MDT submission
Source:R/phyloseq_to_MDT_excel.R
phyloseq_to_MDT_excel.RdWrite the OTU table, the sample data, the taxonomy table and (if present) the
reference sequences of a phyloseq object to a single multi-sheet .xlsx
file, formatted for submission to the GBIF
Metabarcoding Data Toolkit (MDT).
Each sheet gets a leading id column holding the row identifiers (taxa or
samples names). The reference sequences, when available, are appended as a
DNA_sequence column of the taxonomy sheet (Darwin Core DNA-derived-data
extension term).
When check_dwc = TRUE (the default), a lightweight Darwin Core compliance
check warns about recommended sample-level terms that are missing from
sample_data (decimalLatitude, decimalLongitude, eventDate). This is
a non-blocking helper, not a full validation of the GBIF MDT template.
Arguments
- physeq
(required) a
phyloseq-classobject.- filename
(character, default
"Phyloseq_Tables.xlsx") Path of the output.xlsxfile.- check_dwc
(logical, default TRUE) If TRUE, warn about recommended Darwin Core sample-level terms missing from
sample_data.
Details
This function requires the writexl package. See the GBIF Metabarcoding Data Toolkit for the expected input format.
Examples
# \donttest{
if (requireNamespace("writexl")) {
out <- file.path(tempdir(), "data_fungi_mini_MDT.xlsx")
phyloseq_to_MDT_excel(clean_pq(data_fungi_mini), filename = out)
file.exists(out)
unlink(out)
}
#> Loading required namespace: writexl
#> Warning: ! Recommended Darwin Core sample terms missing from sample_data:
#> "decimalLatitude", "decimalLongitude", and "eventDate".
#> ℹ Add them before GBIF MDT submission if available.
#> Excel file written to /tmp/RtmpMeUGPY/data_fungi_mini_MDT.xlsx
# }