其他
单细胞数据可视化R包 | scRNAtoolVis 0.0.3 版本更新
The following article is from 老俊俊的生信笔记 Author JunJunLab
不要变了模样
1引言
在 scRNAtoolVis 推出这段时间里,陆陆续续收到了用户和粉丝们的一些 建议及疑问, 针对这些问题花了一些时间对 scRNAtoolVis 进行一些优化及添加更多的一些参数满足大家对于一些细节的调整,当然尽可能在不大改的情况进行调整,每个包都有或多或少的短板或者缺陷。
感谢使用者们的反馈,可以使这个包变得更好!
此次优化功能简介:
clusterCornerAxes:
改变图例大小 在图里添加细胞标签 去除图例
FeatureCornerAxes:
去除图例 不按样本分面展示 指定 corner 坐标位置 设置图例显示范围
AverageHeatmap:
去除基于名称 去除亚群注释图例名称 标记部分基于名称
安装:
重新安装你将可获得最新版本:
install.packages('devtools')
devtools::install_github('junjunlab/scRNAtoolVis')
library(scRNAtoolVis)
2clusterCornerAxes
加载测试数据:
library(Seurat)
test <- system.file("extdata", "seuratTest.RDS", package = "scRNAtoolVis")
tmp <- readRDS(test)
# add celltype
tmp$cellType <- Idents(tmp)
设置图例大小:
# legend key size
clusterCornerAxes(object = tmp,
reduction = 'umap',
clusterCol = 'cellType',
noSplit = T,
keySize = 8)
添加细胞名称:
# add cell type
clusterCornerAxes(object = tmp,
reduction = 'umap',
clusterCol = "cellType",
noSplit = T,
cellLabel = T,
cellLabelSize = 5)
去除图例:
# remove legend
clusterCornerAxes(object = tmp,
reduction = 'umap',
clusterCol = "cellType",
noSplit = T,
cellLabel = T,
cellLabelSize = 5,
show.legend = F)
分面:
# split
clusterCornerAxes(object = tmp,
reduction = 'umap',
clusterCol = "cellType",
groupFacet = 'orig.ident',
noSplit = F,
cellLabel = T,
cellLabelSize = 3,
show.legend = F,
aspect.ratio = 1,
themebg = 'bwCorner')
3FeatureCornerAxes
默认绘图,默认按样本分面展示:
# default
FeatureCornerAxes(object = tmp,reduction = 'umap',
groupFacet = 'orig.ident',
relLength = 0.5,
relDist = 0.2,
features = c("Actb","Ythdc1", "Ythdf2"))
去除图例:
# remove legend
FeatureCornerAxes(object = tmp,reduction = 'umap',
groupFacet = 'orig.ident',
relLength = 0.5,
relDist = 0.2,
features = c("Actb","Ythdc1", "Ythdf2"),
show.legend = F)
设置 groupFacet = NULL 取消分面:
# no facet group
FeatureCornerAxes(object = tmp,reduction = 'umap',
groupFacet = NULL,
relLength = 0.5,
relDist = 0.2,
features = c("Actb","Ythdc1", "Ythdf2"),
aspect.ratio = 1)
指定在特定样本添加坐标:
# specify corner position
p1 <- FeatureCornerAxes(object = tmp,reduction = 'umap',
groupFacet = 'orig.ident',
relLength = 0.5,
relDist = 0.2,
aspect.ratio = 1,
features = c("Actb","Ythdc1", "Ythdf2"),
axes = 'one')
p2 <- FeatureCornerAxes(object = tmp,reduction = 'umap',
groupFacet = 'orig.ident',
relLength = 0.5,
relDist = 0.2,
aspect.ratio = 1,
features = c("Actb","Ythdc1", "Ythdf2"),
axes = 'one',
cornerVariable = 'ST4')
# combine
cowplot::plot_grid(p1,p2,ncol = 2,align = 'hv')
设置图例显示范围:
# given a range to plot
p1 <- FeatureCornerAxes(object = tmp,reduction = 'umap',
groupFacet = NULL,
relLength = 0.5,
relDist = 0.2,
features = c("Actb","Ythdc1", "Ythdf2"),
aspect.ratio = 1,
themebg = 'bwCorner')
p2 <- FeatureCornerAxes(object = tmp,reduction = 'umap',
groupFacet = NULL,
relLength = 0.5,
relDist = 0.2,
features = c("Actb","Ythdc1", "Ythdf2"),
aspect.ratio = 1,
themebg = 'bwCorner',
minExp = 0,maxExp = 2)
# combine
cowplot::plot_grid(p1,p2,ncol = 1,align = 'hv')
4AverageHeatmap
load test data:
httest <- system.file("extdata", "htdata.RDS", package = "scRNAtoolVis")
pbmc <- readRDS(httest)
# load markergene
markergene <- system.file("extdata", "top5pbmc.markers.csv", package = "scRNAtoolVis")
markers <- read.table(markergene, sep = ',', header = TRUE)
去除基因名:
# remove rownames
AverageHeatmap(object = pbmc,
markerGene = markers$gene,
showRowNames = F)
去除注释名称:
# remove cluster anno name
AverageHeatmap(object = pbmc,
markerGene = markers$gene,
clusterAnnoName = F)
标记特定基因名称:
# mark some genes
# tartget gene
annoGene <- c("LDHB","CCR7","LEF1","NKG7","CST7",
"GZMK","HLA-DQA1","HLA-DRB1","HLA-DPA1")
AverageHeatmap(object = pbmc,
markerGene = markers$gene,
clusterAnnoName = F,
showRowNames = F,
markGenes = annoGene)
5结尾
有其它建议或者疑问请在 github 提问。
往期精品(点击图片直达文字对应教程)
后台回复“生信宝典福利第一波”或点击阅读原文获取教程合集