当前位置:   article > 正文

r包安装4.2 卸载4.1 chb_irgsea

irgsea


installed.packages()
dir.create("D:/Win10 System/Documents/R/win-library/4.2")
.libPaths()

Sys.chmod("C:/Program Files/R/R-4.2.1/library", mode = '7777')

.libPaths("D:/Win10 System/Documents/R/win-library/4.2")
.libPaths(c("D:/Win10 System/Documents/R/win-library/4.2",
            "C:/Program Files/R/R-4.2.1/library",
            "D:/Win10 System/Documents/R/win-library/4.1","C:/Program Files/R/R-4.1.0/library"))
.libPaths()

getwd()

dir.create("D:/ARDS_scripts_1012/ARDS/Step2_harmony_f200_R3/chb")
setwd("D:/ARDS_scripts_1012/ARDS/Step2_harmony_f200_R3/chb")
getwd()

load(file = "D:/ARDS_scripts_1012/ARDS/Step2_harmony_f200_R3/ws/2022-10-16-epithelial/sepsis_Epithelial cell.rds")


library(installr)
updateR()
## 先卸载先前的安装控制程序
if (!require("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install(version = "3.15")

#在安装irGSEA 需要查看自己是否安装了以下这些包
if(1==1){
  # install packages from CRAN
  cran.packages <- c("msigdbr", "dplyr", "purrr", "stringr","magrittr",
                     "RobustRankAggreg", "tibble", "reshape2", "ggsci",
                     "tidyr", "aplot", "ggfun", "ggplotify", "ggridges",
                     "gghalves", "Seurat", "SeuratObject", "methods",
                     "devtools", "BiocManager","data.table","doParallel",
                     "doRNG")
  if (!requireNamespace(cran.packages, quietly = TRUE)) {
    install.packages(cran.packages, ask = F, update = F)
  }
  #BiocManager::install(version = '3.15')
  
  # install packages from Bioconductor
  bioconductor.packages <- c("GSEABase", "AUCell", "SummarizedExperiment",
                             "singscore", "GSVA", "ComplexHeatmap", "ggtree",
                             "Nebulosa")
  if (!requireNamespace(bioconductor.packages, quietly = F)) {
    BiocManager::install(bioconductor.packages, ask = F, update = T)
  }
  library(BiocManager)
  BiocManager::install(c("GSEABase", "AUCell", "SummarizedExperiment",
                         "singscore", "GSVA", "ComplexHeatmap", "ggtree",
                         "Nebulosa"))
  
  sessionInfo(package ="BiocManager" )
  # install packages from Github
  if (!requireNamespace("UCell", quietly = TRUE)) {
    devtools::install_github("carmonalab/UCell")
  }
  if (!requireNamespace("irGSEA", quietly = TRUE)) {
    devtools::install_github("chuiqin/irGSEA")
  }
  getwd()
  

  }
sessionInfo(package = c('AUCell', 'Nebulosa', 'singscore'))
#顺手设置一下数据集的ident
# set cluster to idents
library(Seurat)
Idents(subset_data) <- subset_data$stim
Idents(subset_data)

library(UCell)
library(irGSEA)

??irGSEA.score
msigdbr::msigdbr_show_species()  #Mus musculus
msigdbr::msigdbr_collections()
??install.packages
install.packages('Matrix', version = '1.5.0',lib ="D:/Win10 System/Documents/R/win-library/4.2", 
                 repos = "http://cran.us.r-project.org")
??library
#unloadNamespace("Matrix")
library("Matrix",lib.loc ="D:/Win10 System/Documents/R/win-library/4.2" )
pbmc3k.final <- irGSEA.score(object = subset_data, assay = "RNA",
                             slot = "data", seeds = 123, ncores = 1,
                             min.cells = 3, min.feature = 0,
                             custom = F, geneset = NULL, msigdb = T,
                             species = "Mus musculus", category = "C2",  
                             subcategory = 'CP:KEGG',
                             geneid = "symbol",
                             method = c("AUCell", "UCell", "singscore",
                                        "ssgsea"),
                             aucell.MaxRank = NULL, ucell.MaxRank = NULL,
                             kcdf = 'Gaussian')
#> Validating object structure
#> Updating object slots
#> Ensuring keys are in the proper strucutre
#> Ensuring feature names don't have underscores or pipes
#> Object representation is consistent with the most current Seurat version
#> Calculate AUCell scores
#> Warning: Feature names cannot have underscores ('_'), replacing with dashes
#> ('-')


#> Warning in .filterFeatures(expr, method): Feature names cannot have underscores
#> ('_'), replacing with dashes ('-')
#> Finish calculate ssgsea scores

# 返回一个Seurat对象,富集分数矩阵存放在RNA外的assay中
Seurat::Assays(pbmc3k.final)
#> [1] "RNA"       "AUCell"    "UCell"     "singscore" "ssgsea"

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/333512
推荐阅读
相关标签
  

闽ICP备14008679号