MyNixOS website logo
Description

Plot Glycans using 'ggplot2'.

Plot glycans following the Symbol Nomenclature for Glycans (SNFG) using 'ggplot2'. SNFG provides a standardized visual representation of glycan structures.

gglycan: Grammar of Graphics for Glycans

gglycan

The goal of gglycan is to provide a ggplot2-compatible framework for visualizing glycan structures (N-glycans, O-glycans, etc.) using the standard SNFG (Symbol Nomenclature for Glycans) style. It leverages ggtangle for network layout and ggstar for SNFG symbols.

Installation

You can install the development version of gglycan like so:

# install.packages("devtools")
devtools::install_github("YuLab-SMU/gglycan")

Example

This is a basic example which shows you how to plot a complex N-glycan:

library(ggplot2)
library(gglycan)

# Define a glycan using IUPAC condensed string
s <- "Neu5Ac(a2-3)Gal(b1-4)GlcNAc(b1-2)Man(a1-3)[Neu5Ac(a2-3)Gal(b1-4)GlcNAc(b1-2)Man(a1-6)]Man(b1-4)GlcNAc(b1-4)GlcNAc"

# Plot with default SNFG style and layout
gglycan(s) + 
  geom_glycan()

Custom Layouts

gglycan supports flexible layouts. You can change the growth direction (left, right, up, down) and adjust branching angles.

# Vertical layout growing upwards
gglycan(s, direction = "up", angle_sep = 45) + 
  geom_glycan() + 
  ggtitle("Vertical Layout")

Motif Highlighting

You can highlight specific substructures (motifs) within a glycan. The motif remains fully opaque, while the rest of the structure is dimmed.

# Highlight the Sialyl-Lewis x like motif
motif <- "Neu5Ac(a2-3)Gal(b1-4)GlcNAc"

gglycan(s, motif = motif) + 
  geom_glycan() + 
  ggtitle("Motif Highlighting")

Key Features

  • IUPAC Parsing: Reads standard condensed IUPAC strings.
  • SNFG Standards: Automatic mapping of monosaccharides to SNFG shapes and colors.
  • Fishbone Layout: Custom layout algorithm mimicking textbook-style glycan drawings (symmetric Y-splits, orthogonal extension).
  • Motif Highlighting: Easy identification of substructures.
  • ggplot2 Extension: Fully compatible with ggplot2 layers, themes, and scales.
Metadata

Version

0.0.3

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows