View source: R/canonicalize-graphs.R
| canonicalize_glycan_graphs | R Documentation |
Return canonical graphs and their IUPAC keys together. For ordinary trees, ordering and key generation share one traversal. Graph, vertex, and edge attributes are retained with their corresponding objects. Unlike structure vector construction, this function does not deduplicate graphs: equal structures can retain different source attributes.
canonicalize_glycan_graphs(
graphs,
validate = TRUE,
on_failure = c("error", "na")
)
graphs |
A list of glycan |
validate |
Whether to validate each graph before canonicalization.
Set to |
on_failure |
Either |
Strict failures have class glyrepr_error_structure_failure with
position, input_name, and reason fields. Recovery warnings have class
glyrepr_warning_structure_failure with positions and reasons fields.
A list containing aligned, named vectors iupac, status, and
reason, and an aligned named list graphs. Status is "ok", "missing",
or "invalid". Missing and invalid entries have a NULL graph and NA
key. Reasons are NA except for invalid entries.
graphs <- as.list(n_glycan_core())
result <- canonicalize_glycan_graphs(graphs)
result$iupac
new_glycan_structure(result$iupac, stats::setNames(result$graphs, result$iupac))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.