This function processes XML nodes representing QC data (from either `<PlateQC>` or `<SampleQC>`) and converts them into a tidy data frame. It handles both flat `<QCFlag>` nodes and nested `<Sample>` nodes containing `<QCFlag>` children.
readQCXMLNode(nodes, rename = TRUE, tag = "QCFlag")A list of XML nodes, typically retrieved with `xml2::xml_find_all()`, representing either `<QCFlag>` elements directly or `<Sample>` elements that contain `<QCFlag>` children.
Logical; if `TRUE`, column names will be renamed to more descriptive names (e.g., `name` → `flagName`, `set` → `status`, `value` → `val`).
A data frame with one row per QC flag. For nested `<Sample>` nodes, a `sample` column will be included. Returns `NULL` if `nodes` is `NULL`.
- If `nodes` contains only `<QCFlag>` elements (as under `<PlateQC>`), the output will contain attributes and values for each flag. - If `nodes` contains `<Sample>` elements (as under `<SampleQC>`), each `<QCFlag>` inside will be parsed and include an additional `sample` column. - The `rename` parameter allows renaming of columns using standard recoding.
# For Plate-level QC:
plate_nodes <- xml2::xml_find_all(xml_doc, ".//PlateQC/QCFlag")
#> Error: object 'xml_doc' not found
readQCXMLNode(plate_nodes)
#> Error: object 'plate_nodes' not found
# For Sample-level QC:
sample_nodes <- xml2::xml_find_all(xml_doc, ".//SampleQC/Sample")
#> Error: object 'xml_doc' not found
readQCXMLNode(sample_nodes)
#> Error: object 'sample_nodes' not found