• 全国 [切换]
  • 二维码
    早勤网

    手机WAP版

    手机也能找商机,信息同步6大终端平台!

    微信小程序

    微信公众号

    当前位置: 首页 » 行业新闻 » 热点新闻 » 正文

    scCustomize:自定义可视化你的单细胞数据(二)

    放大字体  缩小字体 发布日期:2020-02-03 12:19:33   浏览次数:1186  发布人:32e6****  IP:117.173.60.***  评论:0
    导读

    简介 scCustomize是一个单细胞转录组数据可视化的R包,里面集合了一些常用的数据可视化方法,可以与Seurat包进行很好的联用,支持Seurat,LIGER和SCE等常用对象的数据。image.pngR包安装 直接使用devtools包进行安装 devtools::install_github(repo = "samuel-marsh/scCustomize") remotes::inst

    简介

    scCustomize是一个单细胞转录组数据可视化的R包,里面集合了一些常用的数据可视化方法,可以与Seurat包进行很好的联用,支持Seurat,LIGER和SCE等常用对象的数据。




    image.png

    R包安装

    直接使用devtools包进行安装

    devtools::install_github(repo = "samuel-marsh/scCustomize") remotes::install_github(repo = "samuel-marsh/scCustomize")

    实例演示

    在本教程中,我将使用 SeuratData 包中的 HCA 骨髓单细胞数据。

    QC plot

    所有 scRNA-seq 数据分析的第一步就是执行一些 QC 检查和绘图,以便可以适当地过滤数据。scCustomize 包含许多功能,可用于快速轻松地生成一些最相关的 QC 图。

    library(tidyverse) library(patchwork) library(Seurat) library(scCustomize) library(qs) # Load Example Dataset hca_bm <- hcabm40k.Seuratdata::hcabm40k # Add pseudo group variable just for this vignette hca_bm@meta.data$group[hca_bm@meta.data$orig.ident == "MantonBM1" | hca_bm@meta.data$orig.ident == "MantonBM2" | hca_bm@meta.data$orig.ident == "MantonBM3" | hca_bm@meta.data$orig.ident == "MantonBM4"] <- "Group 1" hca_bm@meta.data$group[hca_bm@meta.data$orig.ident == "MantonBM5" | hca_bm@meta.data$orig.ident == "MantonBM6" | hca_bm@meta.data$orig.ident == "MantonBM7" | hca_bm@meta.data$orig.ident == "MantonBM8"] <- "Group 2"

    添加线粒体和核糖体基因百分比

    # These defaults can be run just by providing accepted species name hca_bm <- Add_Mito_Ribo_Seurat(seurat_object = hca_bm, species = "Human")


    image.png

    注意:目前Add_Mito_Ribo_Seurat函数只支持以上物种计算线粒体和核糖体基因百分比,如果需要,请在 GitHub 上提交问题以获取其他默认物种。请包括线粒体和核糖体基因的正则表达式模式或基因列表,我将在函数中添加额外的内置默认值。

    # Using gene name patterns hca_bm <- Add_Mito_Ribo_Seurat(seurat_object = hca_bm, species = "other", mito_pattern = "regexp_pattern", ribo_pattern = "regexp_pattern") # Using feature name lists mito_gene_list <- c("gene1", "gene2", "etc") ribo_gene_list <- c("gene1", "gene2", "etc") hca_bm <- Add_Mito_Ribo_Seurat(seurat_object = hca_bm, species = "other", mito_features = mito_gene_list, ribo_features = ribo_gene_list) # Using combination of gene lists and gene name patterns hca_bm <- Add_Mito_Ribo_Seurat(seurat_object = hca_bm, species = "Human", mito_features = mito_gene_list, ribo_pattern = "regexp_pattern")

    Plotting QC Metrics

    • VlnPlot-based QC Plots
      scCustomize 包提供了以下4种函数绘制VlnPlot-based QC Plots.
    • QC_Plots_Genes() Plots genes per cell/nucleus.
    • QC_Plots_UMIs() Plots UMIs per cell/nucleus.
    • QC_Plots_Mito() Plots mito% (named “percent_mito”) per cell/nucleus.
    • QC_Plots_Feature() Plots “feature” per cell/nucleus. Using parameter feature to allow plotting of any applicable named feature in object@meta.data slot.

    # All functions contain p1 <- QC_Plots_Genes(seurat_object = hca_bm, low_cutoff = 800, high_cutoff = 5500) p2 <- QC_Plots_UMIs(seurat_object = hca_bm, low_cutoff = 1200, high_cutoff = 45000) p3 <- QC_Plots_Mito(seurat_object = hca_bm, high_cutoff = 20) wrap_plots(p1, p2, p3, ncol = 3)


    image.png

    同时,还提供了一下可选择的自定义参数:

    • plot_title: Change plot title
    • x_axis_label/y_axis_label: Change axis labels.
    • x_lab_rotate: Should x-axis label be rotated 45 degrees?
    • y_axis_log: Should y-axis in linear or log10 scale.

    p1 <- QC_Plots_UMIs(seurat_object = hca_bm, low_cutoff = 1200, high_cutoff = 45000, pt.size = 0.1) p2 <- QC_Plots_UMIs(seurat_object = hca_bm, low_cutoff = 1200, high_cutoff = 45000, pt.size = 0.1, y_axis_log = TRUE) wrap_plots(p1, p2, ncol = 2)


    image.png

    • FeatureScatter-based QC Plots
      scCustomize 包提供了以下3种函数绘制FeatureScatter-based QC Plots.
    • QC_Plot_UMIvsGene() Plots genes vs UMIs per cell/nucleus
    • QC_Plot_GenevsFeature() Plots Genes vs. “feature” per cell/nucleus. Using parameter feature1 to allow plotting of any applicable named feature in object@meta.data slot.
    • QC_Plot_UMIvsFeature() Plots UMIs vs. “feature” per cell/nucleus. Using parameter feature1 to allow plotting of any applicable named feature in object@meta.data slot.

    # All functions contain QC_Plot_UMIvsGene(seurat_object = hca_bm, low_cutoff_gene = 800, high_cutoff_gene = 5500, low_cutoff_UMI = 500, high_cutoff_UMI = 50000) QC_Plot_GenevsFeature(seurat_object = hca_bm, feature1 = "percent_mito", low_cutoff_gene = 800, high_cutoff_gene = 5500, high_cutoff_feature = 20)


    image.png

    QC_Plot_UMIvsGene(seurat_object = hca_bm, meta_gradient_name = "percent_mito", low_cutoff_gene = 800, high_cutoff_gene = 5500, high_cutoff_UMI = 45000) QC_Plot_UMIvsGene(seurat_object = hca_bm, meta_gradient_name = "percent_mito", low_cutoff_gene = 800, high_cutoff_gene = 5500, high_cutoff_UMI = 45000, meta_gradient_low_cutoff = 20)


    image.png

    计算每个样本的QC值的中位数

    scCustomize 包提供了Median_Stats()函数,可以快速计算不同QC指标 (Genes/, UMIs/, %Mito/Cell, etc)的中位数。

    median_stats <- Median_Stats(seurat_object = hca_bm, group_by_var = "orig.ident")


    image.png

    绘制QC指标中位数值
    scCustomize 包提供了以下函数绘制QC指标的中位数值

    • Plot_Median_Genes()
    • Plot_Median_UMIs()
    • Plot_Median_Mito()
    • Plot_Median_Other()

    Plot_Median_Genes(seurat_object = hca_bm, group_by = "group") Plot_Median_UMIs(seurat_object = hca_bm, group_by = "group") Plot_Median_Mito(seurat_object = hca_bm, group_by = "group") Plot_Median_Other(seurat_object = hca_bm, median_var = "percent_ribo", group_by = "group")


    image.png

    内置自定义颜色画板

    (1)Continuous Palettes

    • viridis_plasma_dark_high
    • viridis_plasma_light_high
    • viridis_magma_dark_high
    • viridis_magma_light_high
    • viridis_inferno_dark_high
    • viridis_inferno_light_high
    • viridis_dark_high
    • viridis_light_high



    image.png

    (2)Discrete Palettes

    • alphabet (24)
    • alphabet2 (24)
    • glasbey (32)
    • polychrome (36)
    • stepped (24)
    • ditto_seq (40)
    • varibow (Dynamic)

    PalettePlot(palette = DiscretePalette_scCustomize(num_colors = 26, palette = "alphabet")) PalettePlot(palette = c("color1", "color2", ...)


    image.png




    image.png

    # Save as variable to global environment polychrome_pal <- DiscretePalette_scCustomize(num_colors = 36, palette = "polychrome") # Call within another function DimPlot(object = obj_name, cols = DiscretePalette_scCustomize(num_colors = 26, palette = "polychrome")) DimPlot_scCustom(seurat_object = pbmc)


    image.png

    不推荐电脑端访问(用户少)
    请微信扫一扫,查看完整信息(记得微信收藏)
     
    (文/匿名(若涉版权问题请联系我们核实发布者) / 非法信息举报 / 删稿)
    打赏
    免责声明
    • 
    本文为昵称为 32e6**** 发布的作品,本文仅代表发布者个人观点,本站未对其内容进行核实,请读者仅做参考,如若文中涉及有违公德、触犯法律的内容,一经发现,立即删除,发布者需自行承担相应责任。涉及到版权或其他问题,请及时联系我们154208694@qq.com删除,我们积极做(权利人与发布者之间的调停者)中立处理。郑重说明:不 违规举报 视为放弃权利,本站不承担任何责任!
    有个别老鼠屎以营利为目的遇到侵权情况但不联系本站或自己发布违规信息然后直接向本站索取高额赔偿等情况,本站一概以诈骗报警处理,曾经有1例诈骗分子已经绳之以法,本站本着公平公正的原则,若遇 违规举报 我们100%在3个工作日内处理!
    0 条相关评论
     

    (c)2008-现在 zaoqin.com All Rights Reserved.