Glycan structures appear in several text formats. If you work with data from different sources, you may find that each database, software tool, or research group uses its own conventions for representing structures as text.
glyparse provides a parser for each supported format and
converts the results to a common glyrepr::glycan_structure
representation.
This gives you a consistent starting point for structure comparison and downstream analysis, without rewriting every input by hand.
All public parsers return glyrepr::glycan_structure
objects. If you are unfamiliar with glyrepr, see the glyrepr
vignette.
Here is a quick overview of the formats supported by the package:
| Format | Parser | Common sources |
|---|---|---|
| IUPAC-condensed | parse_iupac_condensed() |
Literature, UniCarbKB |
| IUPAC-short | parse_iupac_short() |
Literature, UniCarbKB |
| IUPAC-extended | parse_iupac_extended() |
Literature, UniCarbKB |
| IUPAC-compact | parse_iupac_compact() |
Compact database and literature notation |
| GlyCAM IUPAC | parse_glycam_iupac() |
GlyCAM workflows |
| GlycoCT | parse_glycoct() |
Literature, GlycomeDB |
| WURCS | parse_wurcs() |
Literature, GlyTouCan |
| Linear Code | parse_linear_code() |
Literature |
| LINUCS | parse_linucs() |
Glycan structure software |
| KCF | parse_kcf() |
KEGG GLYCAN |
| GlycoWorkbench | parse_gwb() |
GlycoWorkbench and GWS files |
| pGlyco | parse_pglyco_struc() |
pGlyco software results |
| StrucGP | parse_strucgp_struc() |
StrucGP software results |
The package includes an automatic parser and 13 format-specific
parsers. Each parser accepts a character vector of structure strings and
returns a glyrepr::glycan_structure object.
When the input format is not known in advance, use
auto_parse(). It detects the format one element at a time,
so a vector can contain mixed formats.
x <- c(
"Gal(b1-3)GalNAc(b1-",
"(N(F)(N(H(H(N))(H(N(H))))))",
"WURCS=2.0/3,3,2/[a2122h-1b_1-5][a1122h-1b_1-5][a1122h-1a_1-5]/1-2-3/a4-b1_b3-c1"
)
auto_parse(x)
#> <glycan_structure[3]>
#> [1] Gal(b1-3)GalNAc(b1-
#> [2] Hex(??-?)HexNAc(??-?)Hex(??-?)[HexNAc(??-?)Hex(??-?)]Hex(??-?)HexNAc(??-?)[dHex(??-?)]HexNAc(??-
#> [3] Man(a1-3)Man(b1-4)Glc(b1-
#> # Unique structures: 3This format is widely used in scientific literature and databases like UniCarbKB.
For more detail about this notation, see the glyrepr
IUPAC vignette.
# Single structure
iupac_condensed <- "Neu5Ac(a2-3)Gal(b1-4)[Fuc(a1-3)]GlcNAc(b1-4)Gal(b1-4)Glc(a1-"
parse_iupac_condensed(iupac_condensed)
#> <glycan_structure[1]>
#> [1] Neu5Ac(a2-3)Gal(b1-4)[Fuc(a1-3)]GlcNAc(b1-4)Gal(b1-4)Glc(a1-
#> # Unique structures: 1# Multiple structures at once
glycans <- c(
"Man(a1-3)[Man(a1-6)]Man(b1-4)GlcNAc(b1-4)GlcNAc(b1-", # N-glycan core
"Gal(b1-3)GalNAc(b1-", # O-glycan core 1
"Neu5Ac(a2-3)Gal(b1-3)[GlcNAc(b1-6)]GalNAc(b1-" # O-glycan core 2
)
parse_iupac_condensed(glycans)
#> <glycan_structure[3]>
#> [1] Man(a1-3)[Man(a1-6)]Man(b1-4)GlcNAc(b1-4)GlcNAc(b1-
#> [2] Gal(b1-3)GalNAc(b1-
#> [3] Neu5Ac(a2-3)Gal(b1-3)[GlcNAc(b1-6)]GalNAc(b1-
#> # Unique structures: 3This compact format is popular in research papers because it saves space:
# The same structures in short format
iupac_short <- c(
"Mana3(Mana6)Manb4GlcNAcb4GlcNAcb-",
"Galb3GalNAcb-",
"Neu5Aca3Galb3(GlcNAcb6)GalNAcb-"
)
parse_iupac_short(iupac_short)
#> <glycan_structure[3]>
#> [1] Man(a1-3)[Man(a1-6)]Man(b1-4)GlcNAc(b1-4)GlcNAc(b1-
#> [2] Gal(b1-3)GalNAc(b1-
#> [3] Neu5Ac(a2-3)Gal(b1-3)[GlcNAc(b1-6)]GalNAc(b1-
#> # Unique structures: 3The parser infers common linkage positions when they are omitted.
This verbose format includes full chemical names and stereochemistry:
IUPAC-compact notation places the linkage immediately after each residue and uses parentheses for branches.
GlyCAM IUPAC strings include configuration and ring markers such as
DManp and use a terminal -OH marker for the
reducing end. The parser normalizes these strings before parsing
them.
GlycoCT uses separate RES and LIN sections.
It is verbose, but records residue and linkage information
explicitly.
WURCS (Web3 Unique Representation of Carbohydrate Structures) is a compact standardised exchange format used by resources such as GlyTouCan.
KCF represents a glycan as a graph with NODE and
EDGE sections. It is used by KEGG GLYCAN.
kcf <- paste0(
"ENTRY G00066 Glycan\n",
"NODE 6\n",
" 1 Cer 18 0\n",
" 2 Glc 12 0\n",
" 3 Gal 6 0\n",
" 4 GlcNAc -2 0\n",
" 5 Gal -10 0\n",
" 6 GlcNAc -18 0\n",
"EDGE 5\n",
" 1 2:b1 1:1\n",
" 2 3:b1 2:4\n",
" 3 4:b1 3:3\n",
" 4 5:b1 4:4\n",
" 5 6:b1 5:3\n",
"///"
)
parse_kcf(kcf)
#> <glycan_structure[1]>
#> [1] GlcNAc(b1-3)Gal(b1-4)GlcNAc(b1-3)Gal(b1-4)Glc(b1-
#> # Unique structures: 1Linear Code is a compact notation used in literature and glycan software:
GlycoWorkbench strings describe the structure from the reducing end
and may include mass options after $. Those options are
ignored because they are not part of the glycan graph.
If you work with glycoproteomics, you may encounter pGlyco’s parenthetical notation:
pglyco <- "(N(F)(N(H(H(N))(H(N(H))))))"
parse_pglyco_struc(pglyco)
#> <glycan_structure[1]>
#> [1] Hex(??-?)HexNAc(??-?)Hex(??-?)[HexNAc(??-?)Hex(??-?)]Hex(??-?)HexNAc(??-?)[dHex(??-?)]HexNAc(??-
#> # Unique structures: 1In this notation:
By default, a malformed structure stops the call with an informative
error. When processing a larger collection,
on_failure = "na" preserves the input positions and returns
NA for records that cannot be parsed.