參考原文連結:
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()