Combine residue-level composition traits (see count_residues),
structural traits (see compute_structural_traits), and
user-defined motifs (see compute_userdefined_traits)
into a unified trait vector.
compute_glycan_traits(tree, motifs = NULL)A parsed glycan tree from pGlyco3_to_tree or wurcs_to_tree.
Optional named list of user-defined glycan motifs.
A named list of numeric trait values.
# Example: parse a pGlyco3-style glycan expression into a tree
pGlyco_expr <- "(N(N(H(H(H))(H(H)(H)(H(H))))))"
# Convert to glycan tree structure
tree <- pGlyco3_to_tree(pGlyco_expr)
# Explore parsed nodes and edges
tree$node
#> [1] "N" "N" "H" "H" "H" "H" "H" "H" "H" "H"
tree$edge
#> [1] "a-b" "b-c" "c-d" "d-e" "c-f" "f-g" "f-h" "f-i" "i-j"
# Build igraph representation
g <- build_glycan_igraph(tree)
plot_glycan_tree(g)
# Define user motifs for trait computation
user_motifs <- list(
LinearH3 = list(
node = c("H", "H", "H"),
edge = c("a-b", "b-c")
),
FucBranch = list(
node = c("H", "N", "F"),
edge = c("a-b", "b-c")
)
)
# Compute glycan structural traits
compute_glycan_traits(tree, motifs = user_motifs)
#> $GlycanSize
#> [1] 10
#>
#> $Hexose
#> [1] 8
#>
#> $HexNAc
#> [1] 2
#>
#> $Neu5Ac
#> [1] 0
#>
#> $Neu5Gc
#> [1] 0
#>
#> $Fucose
#> [1] 0
#>
#> $Antennas
#> [1] 0
#>
#> $IsBisecting
#> [1] 0
#>
#> $IsComplex
#> [1] 0
#>
#> $IsOligomannose
#> [1] 1
#>
#> $IsHybrid
#> [1] 0
#>
#> $IsC_Fucosed
#> [1] 0
#>
#> $IsA_Fucosed
#> [1] 0
#>
#> $LinearH3
#> [1] 5
#>
#> $FucBranch
#> [1] 0
#>