structure_nodes() and structure_edges() convert a glycan structure vector
to node and edge tibbles. structure_from_tibbles() rebuilds a
glyrepr_structure vector from those tibbles and a vector of reducing-end
anomers.
The glycan_id column is the integer position of each glycan in the input
vector. Duplicate structures are expanded to their original vector positions.
Missing structures have no node or edge rows and are reconstructed from
missing values in anomers.
If x is named, the node and edge tibbles also contain a glycan_name
column. structure_from_tibbles() uses glycan_name as output names when
that column is present.
Arguments
- x
A glycan structure vector.
- nodes
A data frame with columns
glycan_id,node_id,mono, andsub, and optionallyglycan_name.- edges
A data frame with columns
glycan_id,edge_id,from_node,to_node, andlinkage, and optionallyglycan_name.- anomers
A character vector of reducing-end anomers, one per glycan.
Value
structure_nodes()returns a tibble with columnsglycan_id,node_id,mono, andsub.structure_edges()returns a tibble with columnsglycan_id,edge_id,from_node,to_node, andlinkage.structure_from_tibbles()returns aglyrepr_structurevector.
Examples
glycans <- c(o_glycan_core_1(), o_glycan_core_1())
nodes <- structure_nodes(glycans)
edges <- structure_edges(glycans)
structure_from_tibbles(nodes, edges, get_anomer(glycans))
#> <glycan_structure[2]>
#> [1] Gal(b1-3)GalNAc(a1-
#> [2] Gal(b1-3)GalNAc(a1-
#> # Unique structures: 1
