has_floating_parts: Detect Floating Glycan Parts

View source: R/floating-parts.R

has_floating_partsR Documentation

Detect Floating Glycan Parts

Description

Test whether each glycan structure contains one or more unresolved floating parts.

Usage

has_floating_parts(x)

Arguments

x

A glycan_structure() vector or a glycan igraph.

Details

A floating part is a known glycan residue or substructure whose parent residue in the complete glycan structure is not fully localized. For example, a bi-antennary N-glycan may contain one sialic acid while the available evidence cannot determine which of its two terminal galactoses carries that residue. The sialic acid can then be represented as a floating part with both galactoses as candidate parents.

In the glyrepr IUPAC extension, floating parts appear in braces before the main glycan:

  • ⁠{<floating>}<main>⁠ means every feasible node outside that floating component is a candidate parent.

  • ⁠{<floating>|<parents>}<main>⁠ restricts the candidates to the comma-separated complete-sequence node indices in ⁠<parents>⁠.

Node indices follow residue order in the complete IUPAC-condensed sequence: residue nodes in floating blocks are counted from left to right before the main glycan, while substituent blocks contribute no node indices. A floating part may target a node in another floating component or the main tree, but not a node in its own component. It may contain one residue or an entire subtree, and its virtual attachment linkage may be fully known, partially known, or unknown.

Internally, an unresolved structure is an annotated forest containing one main tree and one disconnected tree per floating part. The virtual linkage and candidate parents are stored as graph metadata rather than as an edge. Each floating-part metadata entry also stores nodes, the complete vector of vertex indices in that floating component, so downstream graph operations do not need to rediscover its membership by traversal. structure_floating_parts() exposes attachment metadata in tabular form, and structure_component_membership() exposes component membership.

An effective singleton parent domain fully localizes the attachment. When one floating component attaches to another, their component metadata is merged and newly singleton domains are resolved iteratively. Such parts are normalized to ordinary graph edges, so has_floating_parts() returns FALSE once every attachment is localized.

Value

A logical vector with the same length and names as vector input, or a logical scalar for graph input. Missing structures produce NA.

See Also

structure_floating_parts(), has_floating_substituents(), as_glycan_structure()

Examples

main <- paste0(
  "Gal(b1-4)GlcNAc(b1-2)Man(a1-3)",
  "[Gal(b1-4)GlcNAc(b1-2)Man(a1-6)]",
  "Man(b1-4)GlcNAc(b1-4)GlcNAc(b1-"
)
ambiguous <- as_glycan_structure(
  paste0("{Neu5Ac(a2-3)|2,5}", main)
)
glycans <- c(ambiguous = ambiguous, ordinary = as_glycan_structure(main))
has_floating_parts(glycans)
structure_floating_parts(ambiguous)

localized <- as_glycan_structure(
  "{Neu5Ac(a2-3)|2}Gal(b1-4)GlcNAc(b1-"
)
has_floating_parts(localized)


glyrepr documentation built on Sept. 22, 2026, 5:09 p.m.