The goal of glydraw is to draw published-ready Structure Nomenclature For Glycans (SNFG). We use ggplot2 as the backend to draw the cartoons.
We recommend installing the meta-package glycoverse, which includes this package and other core glycoverse packages.
If you don’t want to install all glycoverse packages, you can only install glydraw.
You can install the latest release of glydraw from r-universe (recommended):
# install.packages("pak")
pak::repo_add(glycoverse = "https://glycoverse.r-universe.dev")
pak::pkg_install("glydraw")Or from GitHub:
pak::pkg_install("glycoverse/glydraw@*release")Or install the development version (NOT recommended):
pak::pkg_install("glycoverse/glydraw")Note: Tips and troubleshooting for the meta-package glycoverse are also applicable here: Installation of glycoverse.
Call draw_cartoon() to plot a SNFG:
library(glydraw)
draw_cartoon("Man(a1-3)[Man(a1-6)]Man(b1-4)GlcNAc(b1-4)GlcNAc(b1-")And call save_cartoon() to save it to a file:
cartoon <- draw_cartoon("Man(a1-3)[Man(a1-6)]Man(b1-4)GlcNAc(b1-4)GlcNAc(b1-")
save_cartoon(cartoon, "N-core.png", dpi = 300)You can also use export_cartoons() to save mutiple SNFGs to a
directory, directly from a glexp::experiment() object:
library(glyexp)
# Make a tidy experiment object
exp <- real_experiment |> slice_head_var(n = 5)
export_cartoons(exp, "path/to/save")
