
Locate All Structural Matches
rex_locate_all.RdLocate the nodes and edges of all matches in each glycan.
Arguments
- glycans
A character vector of glycan expressions in any format supported by
glyparse::auto_parse(), aglyrepr_structurevector, or one glyrepr-compatibleigraph. Character inputs may mix formats; malformed structures throw an error.- pattern
A character vector of patterns or one
rex_compile()object. Inputs recycle only from length one. Missing glycans or patterns propagate.
Value
A list of data frames with integer list-columns nodes and edges.
No match produces zero rows; missing input produces one row with
NA_integer_ in both columns. IDs are one-based and refer to the input
graph, or the canonical graph obtained from character input, as in
glyrepr::structure_nodes() and glyrepr::structure_edges(). Only
edges within the match are returned.
Details
The matching unit is a connected structural trace. As in glycowork, the
first successful trace per starting node is retained, then strict subsets
of other traces are removed. Distinct branches with equal sequences remain
distinct matches. Matches are ordered by decreasing residue count and then
starting node ID. Repeats are greedy unless marked lazy; successful traces
may overlap. Counts therefore need not equal text-regex counts.
Only connected rooted trees are supported; floating topology or floating
substituents are rejected explicitly. See rex_compile() for syntax.
See also
Other glycan queries:
rex_count(),
rex_detect(),
rex_extract(),
rex_extract_all(),
rex_locate(),
rex_match(),
rex_match_all(),
rex_subset(),
rex_which()
Examples
x <- c("Gal(b1-4)GlcNAc", "Fuc(a1-3)GlcNAc", NA)
rex_locate_all(x, "Gal-GlcNAc")
#> [[1]]
#> nodes edges
#> 1 1, 2 1
#>
#> [[2]]
#> [1] nodes edges
#> <0 rows> (or 0-length row.names)
#>
#> [[3]]
#> nodes edges
#> 1 NA NA
#>