画基因结构图 gggenes 用法 |
您所在的位置:网站首页 › 卧室结构图画画教程 › 画基因结构图 gggenes 用法 |
目录
画基因结构图 gggenes 用法Drawing gene arrows with geom_gene_arrow()Beautifying the plot with theme_genesAligning genes across facets with make_alignment_dummies()Labelling genes with geom_gene_label()Reversing some genes with the optional forward aestheticViewing subgene segments
画基因结构图 gggenes 用法
使用gggenes这个R包 看官网 https://wilkox.org/gggenes/ gggenes is a ggplot2 extension for drawing gene arrow maps. Installing gggenes Install the stable version of gggenes from CRAN: install.packages("gggenes") #If you want the development version, install it from GitHub: devtools::install_github("wilkox/gggenes") Drawing gene arrows with geom_gene_arrow()geom_gene_arrow() is a ggplot2 geom that represents genes with arrows. The start and end locations of the genes within their molecule(s) are mapped to the xmin and xmax aesthetics respectively. These start and end locations are used to determine the directions in which the arrows point. The y aesthetic must be mapped to the molecule(s). If you are drawing more than one molecule, and the numerical locations of the genes are not similar across molecules, you almost certainly want to facet the plot with scales = “free” to avoid drawing ridiculously large molecules with ridiculously tiny genes. library(ggplot2) library(gggenes) ggplot(example_genes, aes(xmin = start, xmax = end, y = molecule, fill = gene)) + geom_gene_arrow() + facet_wrap(~ molecule, scales = "free", ncol = 1) + scale_fill_brewer(palette = "Set3")Because the resulting plot can look cluttered, a ggplot2 theme theme_genes is provided with some sensible defaults. ggplot(example_genes, aes(xmin = start, xmax = end, y = molecule, fill = gene)) + geom_gene_arrow() + facet_wrap(~ molecule, scales = "free", ncol = 1) + scale_fill_brewer(palette = "Set3") + theme_genes()Often you will want a certain gene to be vertically aligned across the faceted molecules. make_alignment_dummies() generates a set of dummy genes that if added to the plot with geom_blank() will extend the range of each facet to visually align the selected gene across facets. dummies = xsubmax for all subgenes (subgenes that break gene boundaries will be skipped with a warning).The suggested usage is to use geom_gene_arrow() with no fill, and then add a subgene layer over this: ggplot(example_genes, aes(xmin = start, xmax = end, y = molecule)) + facet_wrap(~ molecule, scales = "free", ncol = 1) + geom_gene_arrow(fill = "white") + geom_subgene_arrow(data = example_subgenes, aes(xmin = start, xmax = end, y = molecule, fill = gene, xsubmin = from, xsubmax = to), color="black", alpha=.7) + theme_genes()
|
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |