当前位置: 首页>数据库>正文

数据整合SingCellaR

Processing single-cell RNA-seq datasets using SingCellaR

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8980964/

Transitions in lineage specification and gene regulatory networks in hematopoietic stem/progenitor cells over human development

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8456780/

Single-Cell Analyses Reveal Megakaryocyte-Biased Hematopoiesis in Myelofibrosis and Identify Mutant Clone-Specific Targets

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7217381/

https://github.com/supatt-lab/SingCellaR

数据整合SingCellaR,第1张
整合的功能

安装

install.packages('devtools')
if (!requireNamespace('BiocManager', quietly = TRUE)) install.packages('BiocManager')
library(devtools)
install_github('supatt-lab/SingCellaR',ref='master', repos = BiocManager::repositories())

#安装依赖包

#Install required python modules by running the following R code:
library(reticulate)
 conda_create("r-reticulate", python_version="3.8")
py_install("fa2", envname="r-reticulate")
py_install("networkx", envname="r-reticulate")
py_install("Scrublet",envname="r-reticulate")

if(!require(harmony)) {
install.packages("harmony")
}

if(!require(AUCell)) {
  BiocManager::install("AUCell")}


if(!require(doParallel)) {
 install.packages("doParallel")}

if(!require(doRNG)) {
  install.packages("doRNG")}


if(!require(DAseq)) {
  devtools::install_github("KlugerLab/DAseq")}

if(!require(destiny)) {
 BiocManager::install("destiny")}

devtools::install_github('cole-trapnell-lab/monocle3',
                       
                           ref="develop")

#The destiny package is not available for Bioconductor version 3.13. 
#The user can install this package from GitHub.

install_github("https://github.com/theislab/destiny",
                 
                 build_vignettes=FALSE, dependencies=TRUE)

install.packages("rliger")


if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("sva")


if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("limma")

#2.Loading SingCellaR and SingCellaR object initialisation

library(SingCellaR)

data_matrices_dir<-"D:/SingCellaR-PBMC/filtered_feature_bc_matrix/"
PBMCs<-new("SingCellaR")
PBMCs@dir_path_10x_matrix<-data_matrices_dir
PBMCs@sample_uniq_id<-"PBMCs"
load_matrices_from_cellranger(PBMCs,cellranger.version = 3)

## "The sparse matrix is created."

PBMCs

##处理线粒体基因:“mitochondiral_genes_start_with”计算每个细胞的线粒体的百分比。
##人样本线粒体基因名称以“MT-”开头。

#gethub上面的代码是:process_cells_annotation(PBMCs,mitochondiral_genes_start_with="MT-"),报错
#应该是下面这个,作者文章里面的,可以运行
process_cells_annotation(PBMCs, mito_genes_start_with="MT-")

#QC plots

plot_cells_annotation(PBMCs,type="histogram")
plot_cells_annotation(PBMCs,type="boxplot")
plot_UMIs_vs_Detected_genes(PBMCs)

#过滤

filter_cells_and_genes(PBMCs,
                       min_UMIs=1000,
                       max_UMIs=30000,
                       min_detected_genes=500,
                       max_detected_genes=5000,
                       max_percent_mito=15,
                       genes_with_expressing_cells = 10,
                       isRemovedDoublets = FALSE) # 这里加一个isRemovedDoublets = FALSE,不然报错

#Normalisation
normalize_UMIs(PBMCs,use.scaled.factor = T)

#Regressing source of variations
#Next, the effect of the library size and the percentage of mitocondrial reads are regressed out.
remove_unwanted_confounders(PBMCs,residualModelFormulaStr="~UMI_count+percent_mito")

#高变异基因鉴定
get_variable_genes_by_fitting_GLM_model(PBMCs,mean_expr_cutoff = 0.05,disp_zscore_cutoff = 0.05)

#需要把管家基因(例如核糖体基因)和线粒体基因从高可变基因里面去除掉。
#SingCellaR 从 GMT 文件中读取包含核糖体和线粒体基因的信息,并将这些基因从高度可变的基因列表中删除。

#remove_unwanted_genes_from_variable_gene_set(PBMCs,gmt.file = "./Human_genesets/human.ribosomal-mitochondrial.genes.gmt",
#                                            removed_gene_sets=c("Ribosomal_gene","Mitocondrial_gene"))
#上面的那行代码怎么都运行不了,教程显示这步去了一个基因,影响不大,先做后面的。

#Here, the plot shows highly variable genes in the fitted GLM model.
plot_variable_genes(PBMCs)

#主成分分析
SingCellaR::runPCA(PBMCs, use.components=50, use.regressout.data = T)



https://www.xamrdz.com/database/6rd1873233.html

相关文章: