Gggenes 绘制基因图
https://wilkox.org/gggenes/ https://github.com/wilkox/gggenes/
pak::pkg_install("gggenes")
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")
输入数据格式如下
head(example_genes)
```
molecule gene start end strand orientation
1 Genome5 genA 405113 407035 forward -1
2 Genome5 genB 407035 407916 forward -1
3 Genome5 genC 407927 408394 forward -1
4 Genome5 genD 408387 408737 reverse -1
5 Genome5 genE 408751 409830 forward 1
6 Genome5 genF 409836 410315 forward -1
包含正反方向`forward = orientation`
ggplot(example_subgenes, aes(xmin = start, xmax = end, y = molecule, fill = gene, forward = orientation)) + geom_gene_arrow() + facet_wrap(~ molecule, scales = "free", ncol = 1) + scale_fill_brewer(palette = "Set3") ```