| Title: | Draw beautiful SNFG cartoons |
|---|---|
| Description: | Draw beautiful SNFG cartoons. |
| Authors: | Xisong Feng [aut, cre] (ORCID: <https://orcid.org/0009-0000-4057-1295>) |
| Maintainer: | Xisong Feng <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.4.1 |
| Built: | 2026-05-26 15:09:34 UTC |
| Source: | https://github.com/glycoverse/glydraw |
Draw a Symbol Nomenclature For Glycan (SNFG)
draw_cartoon( structure, show_linkage = TRUE, orient = c("H", "V"), highlight = NULL )draw_cartoon( structure, show_linkage = TRUE, orient = c("H", "V"), highlight = NULL )
structure |
A |
show_linkage |
Show linkage annotation or not. Default is TRUE. |
orient |
The orientation of glycan structure. "H" for horizontal, "V" for vertical. Default is "H" |
highlight |
An integer vector specifying the node indices to highlight.
This argument is applicable only when |
a ggplot2 object
## Not run: draw_cartoon("Gal(b1-3)GalNAc(a1-") ## End(Not run)## Not run: draw_cartoon("Gal(b1-3)GalNAc(a1-") ## End(Not run)
This function calls draw_cartoon() on each glycan structure in x,
then calls save_cartoon() to save a figure for each of them.
IUPAC-condensed nomenclatures are used as file names. If x is a named
character vector or named glyrepr::glycan_structure() vector, the vector
names are used as file names.
export_cartoons( x, dirname, file_ext = "png", dpi = 300, show_linkage = TRUE, orient = c("H", "V") )export_cartoons( x, dirname, file_ext = "png", dpi = 300, show_linkage = TRUE, orient = c("H", "V") )
x |
A |
dirname |
Directory name to save the cartoons. If it does not exist, it is created. |
file_ext |
File extension supported by |
dpi |
Dots per inch. Defaults to 300. |
show_linkage |
Show linkage annotation or not. Default is TRUE. |
orient |
The orientation of glycan structure. "H" for horizontal, "V" for vertical. Default is "H" |
The function returns the list of cartoons implicitly.
## Not run: library(glyexp) export_cartoons(real_experiment, "path/to/save") ## End(Not run)## Not run: library(glyexp) export_cartoons(real_experiment, "path/to/save") ## End(Not run)
In theory, you can just use ggplot2::ggsave() to save the cartoons plotted by draw_cartoon().
However, you can have trouble finding the best sizes for each cartoon
to make them look alike.
This function is designed to save the cartoons with self-adjusted sizes,
based on the size of the glycans,
so that when glycans with different sizes are put together, they will look alike.
save_cartoon(cartoon, file, dpi = 300)save_cartoon(cartoon, file, dpi = 300)
cartoon |
A ggplot2 object returned by |
file |
File name of glycan cartoon. |
dpi |
Dots per inch, default = 300. |
## Not run: cartoon <- draw_cartoon("Gal(b1-3)GalNAc(a1-") save_cartoon(cartoon, "p1.png", dpi = 300) ## End(Not run)## Not run: cartoon <- draw_cartoon("Gal(b1-3)GalNAc(a1-") save_cartoon(cartoon, "p1.png", dpi = 300) ## End(Not run)