This function takes an XML document, along with the name and value of an attribute, and removes the BarcodeB nodes that match the specified attribute. Additionally, it identifies the associated Sample nodes with the same name attribute as the removed BarcodeB nodes and removes them as well. These removals only occur if the sample/barcode node in question is not a control (e.g. IPC, NC, SC, Bridge, etc.)

removeBarcodeAndSamples(doc, attribute_name, attribute_value)

Arguments

doc

An XML document.

attribute_name

The name of the attribute to match in BarcodeB nodes.

attribute_value

The value of the attribute to match in BarcodeB nodes. Can be multiple values.

Value

The modified XML document with BarcodeB and associated Sample nodes removed.

Examples

doc <- read_xml("your_file.xml")
#> Error in read_xml("your_file.xml"): could not find function "read_xml"
new_doc <- removeBarcodeAndSamples(doc, "name", c("774951", "23112"))
#> Error: object 'doc' not found