This function reads an XML file, modifies specific attributes within the <Barcode> elements under <BarcodeB>, and inserts corresponding covariate values from a provided data frame.
insertCovariatesXML(input_XML, covariates, sanitize_names = FALSE)Path to the input XML file.
A data frame containing covariate information, including 'sampleName' and other covariate columns.
Logical (default FALSE). When TRUE, covariate column names are passed through `clean_covariate_names(case = "lower_camel")` before being written as XML attributes. Use this when interoperating with NAS, which applies the same sanitation on covariate upload — identical sanitation on both sides keeps the attribute name stable across NAS export → NULISAseqR import → NAS re-import (issue #3199). Default FALSE preserves the historical write-verbatim contract for direct callers.
The modified XML document.
# Example usage:
# data <- loadNULISAseq('input.xml')
# data$samples$newAnnot <- c(1:length(1:nrow(data$samples)))
# insertCovariatesXML("input.xml", data$samples)