参考原文链接:
https://mp.weixin.qq.com/s/K8FHv0dxriaGxKI0efRN5g
https://mp.weixin.qq.com/s/gtnYWJcUubNKT4SIldk9uQ
1.安装
devtools::install_github('junjunlab/scRNAtoolVis')
library(scRNAtoolVis)
#过程报错,需要首先安装依赖包:magick
install.packages("magick")
#再次报错,需要先安装magick依赖的imagemagick
$conda install conda-forge::imagemagick
2.使用
#test data
library(scRNAtoolVis)
# load test data
test <- system.file("extdata", "seuratTest.RDS", package = "scRNAtoolVis")
tmp <- readRDS(test)
具体见最开始参考教程。自己使用的一个示例:
library(scRNAtoolVis)
png(paste0("featureplot-main_marker.png"), width = 18, height = 6, res = 400, units = "in")
# given a range to plot
p1 <- FeatureCornerAxes(object = MERGE,reduction = 'umap',
groupFacet = NULL,
relLength = 0.5,
relDist = 0.1,
features =c("CX3CR1","CLDN5","GFAP","PCDH15","MBP"),
# aspect.ratio = 1,
# themebg = 'bwCorner',#增加方框
minExp = 0,maxExp = 5,#设置最大和最小显示值
show.legend=F #是否显示图例
)
p2 <- FeatureCornerAxes(object = MERGE,reduction = 'umap',
groupFacet = NULL,
relLength = 0.5,
relDist = 0.1,
features = c("SATB2", "SLC17A7","CAMK2A","GAD1","GAD2"),
# aspect.ratio = 1,
# themebg = 'bwCorner'
# show.legend=T #是否显示图例
minExp = 0,maxExp = 5#设置表达量最小和最大显示值
)
# combine
cowplot::plot_grid(p1,p2,ncol = 1,align = 'hv') #上下两行
# cowplot::plot_grid(p1,p2,ncol=2,align='hv') #两列
dev.off()
png(paste0("featureplot-neruon.png"), width = 9, height = 3, res = 400, units = "in")
# given a range to plot
FeatureCornerAxes(object = MERGE,reduction = 'umap',
groupFacet = NULL,
relLength = 0.5,
relDist = 0.1,
features =c("SNAP25", "STMN2", "RBFOX3"),
# aspect.ratio = 1,
# themebg = 'bwCorner'
)
dev.off()
标签:featureplot,library,UMAP,heatmap,magick,install,test,scRNAtoolVis
From: https://www.cnblogs.com/corrschi/p/18113569