Reads and processes an XML file containing NULISAseq data. This function reads the input XML file and returns the XML document with updated info (v1.3.0) from loadNULISAseq (e.g. AQ and QC info).
writeUpdatedXML(
input_XML,
rawReadCutoff = 200,
data = NULL,
insertTargetIDs = FALSE,
canonicalTargets = TRUE,
targetMap = NULL
)Path to the input XML file to be processed
The raw read value cutoff to apply to individual sample/target combinations
Output of loadNULISAseq(input_XML) (optional). It must
describe input_XML. The function matches targets to
BarcodeA/Barcode nodes by barcode only. When you supply
data, the function ignores canonicalTargets and
targetMap. It gives a warning if you pass either of them. The
function still reads input_XML for the XML tree that it annotates.
Logical, default FALSE. If TRUE, the function writes
AlamarTargetID onto each BarcodeA/Barcode node that has no
id. The ids come from data$targets$AlamarTargetID. Each id is the
XML value, or the id that canonicalization in readNULISAseq()
resolved. The function matches nodes to rows by the name
attribute (the target barcode). An id that canonicalization resolved by
the plate's species guess is never written: that is any row whose
targetName_raw the target-id table lists under more than one id.
A targetMap entry (with data = NULL) names the id
explicitly, so that id is written. Otherwise put the id in the XML to
persist such a target.
A written id is permanent. Every later read takes the id as
authoritative. A read with canonicalTargets = TRUE (the default)
renames the target to the current name that the table gives for that
id. A later fix to the target-id table does not change a written id.
Neither this
function nor insertAlamarTargetIDXML() removes or changes an
existing id. If an existing id disagrees with data, the function
stops and returns no XML.
Hidden targets and targets in excludeTargets are not rows of
loadNULISAseq() output. So they get no id. A target with no
resolved id (an ambiguous or unknown name) also gets no id. The default
stays FALSE, because the shipped target-id table is not yet the
definitive registry.
Logical, default TRUE. The function passes it to
loadNULISAseq() when data is NULL. When you supply
data, the function ignores it. An explicit value then gives a
warning.
User-supplied target-id aliases, default NULL. The
function passes it to loadNULISAseq() when data is NULL.
When you supply data, the function ignores it. An explicit value
then gives a warning.
A character string containing the serialized XML.
writeUpdatedXML() is a first-time upgrade to XML version 1.3.0.
It writes the top-level QCThresholds, PlateQC,
SampleQC and TargetQC sections only when they are absent.
It writes TargetQC only for an AQ input.
A section that already exists stays unchanged. The function does not
recompute it. A 1.3.0 instrument export is an example of this input.
A log message names the kept sections.
Thus a repeat call on the output adds no section.
The function looks for these sections only as direct children of the
root. It does not detect a section that is nested deeper.
If input_XML has more than one copy of a top-level section, the
function stops before it reads the data. An earlier version of this
function made such copies. Run the function on the original file.
The function sets every ExecutionDetails/XMLversion node to
"1.3.0". It adds a node only when none exists.
On every call, the function recomputes ReadCount attributes. It
does this only on a ReadCount whose sample and target are rows of
data. It always sets aR. It sets NPQ, aB, and
on an AQ input AQ, aM and dr, only where the matching
matrix in data has a row for the target and a column for the
sample. A new value replaces the existing value. On a 1.3.0 input, this
includes values that the instrument wrote. The function does not set
AQ, aM or dr on Calibrator or IPC samples. An
attribute that the function does not set keeps its existing value. Examples
are a hidden or excluded target, and a target with no AQ result.
To write only AlamarTargetID and change nothing else, use
insertAlamarTargetIDXML().
# writeUpdatedXML("path/to/input.xml")