查看原文
其他

scRNAtoolVis 0.0.3 版本更新

JunJunLab 老俊俊的生信笔记 2023-06-15

不要变了模样

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 提问。





  老俊俊生信交流群 (微信交流群需收取20元入群费用(防止骗子和便于管理))



老俊俊微信:


知识星球:



今天的分享就到这里了,敬请期待下一篇!

最后欢迎大家分享转发,您的点赞是对我的鼓励肯定

如果觉得对您帮助很大,赏杯快乐水喝喝吧!




  





customize 你的 GSEA 图

GseaVis 优雅的可视化 GSEA 富集结果

GSEA 图是如何画出来的? (源码解析)

clusterProfiler 的可视化大全

clusterProfiler 做 GSEA 富集分析

深度神经网络学习对单细胞数据进行清洗去噪

ggpie 解决你的所有饼图绘制

Bigwig 可视化用 tackPlotR 试试看?

gggsea 个性化绘制 GSEA 图

scRNAtoolVis 绘制单细胞 Marker 基因均值表达热图

◀...

您可能也对以下帖子感兴趣

文章有问题?点此查看未经处理的缓存