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.
You can install the latest release of glyrepr from GitHub with:
# install.packages("remotes")
::install_github("glycoverse/glyrepr@*release") remotes
Or install the development version:
::install_github("glycoverse/glyrepr") remotes
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.
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:
<- as_glycan_structure(c("GlcNAc(b1-4)GlcNAc(?1-", "Man(a1-2)GlcNAc(?1-"))
structures
# 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