glyrepr
provides two important representations of glycans: glycan compositions and glycan structures. This package is the core of glycoverse
ecosystem, as it provides the basic data structures and functions for representing and manipulating glycans.
In fact, the functions in this packages are heavily used by other glycoverse
packages such as glyparse and glymotif, which you are probably already using or will use.
Installation
You can install the development version of glyrepr from GitHub with:
# install.packages("pak")
pak::pak("glycoverse/glyrepr")
Role in glycoverse
As the cornerstone of the glycoverse
ecosystem, this package provides two fundamental data structures for representing glycans: glycan_composition()
and glycan_structure()
. These specialized data types are what distinguish glycoverse
from other omics analysis frameworks, serving as the foundation for higher-level packages like glymotif
, which build upon them to perform advanced glycan analysis.
Example
library(glyrepr)
# Create glycan compositions
glycan_composition(
c(Man = 5, GlcNAc = 2),
c(Man = 3, Gal = 2, GlcNAc = 4, Fuc = 1, Neu5Ac = 2)
)
#> <glycan_composition[2]>
#> [1] Man(5)GlcNAc(2)
#> [2] Man(3)Gal(2)GlcNAc(4)Fuc(1)Neu5Ac(2)
# Parse IUPAC-condensed glycan text representation
# `glyrepr` supports IUPAC-condensed glycan text representation natively.
# For other formats like WURCS or glycoCT, use the `glyparse` package.
# For example, the following two glycan structures are equivalent:
structures <- as_glycan_structure(c("GlcNAc(b1-4)GlcNAc", "Man(a1-2)GlcNAc"))
# Get the composition of a glycan structure
as_glycan_composition(structures)
#> <glycan_composition[2]>
#> [1] GlcNAc(2)
#> [2] Man(1)GlcNAc(1)
# Count the number of given residues
count_mono(structures, "Hex")
#> [1] 0 1
count_mono(glycan_composition(c(Man = 3, GlcNAc = 2, Gal = 2)), "Hex")
#> [1] 5