Changes between Version 56 and Version 57 of SOP/scRNA-seq


Ignore:
Timestamp:
04/23/24 14:24:39 (9 months ago)
Author:
xinlei.gao
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SOP/scRNA-seq

    v56 v57  
    1717}}}
    1818This command directs R to use a specific library path where Seurat version 4 is installed, ensuring compatibility with older datasets or software requirements.
     19
     20However, sometimes Seurat may depend on other R packages to run certain functions, in that case, only loading the older version of Seurat may not work. Instead, we could explicitly load all R packages from the last R library set to keep the packages compatible.
     21{{{
     22set_lib_paths <- function(lib_vec) {
     23  lib_vec <- normalizePath(lib_vec, mustWork = TRUE)
     24  shim_fun <- .libPaths
     25  shim_env <- new.env(parent = environment(shim_fun))
     26  shim_env$.Library <- character()
     27  shim_env$.Library.site <- character()
     28  environment(shim_fun) <- shim_env
     29  shim_fun(lib_vec)
     30}
     31
     32set_lib_paths(c("/nfs/apps/lib/R/4.2-focal/site-library.2023q1", "/opt/R/4.2.1/lib/R/library"))
     33
     34library(Seurat)
     35# load other required packages, e.g. scPred, for cell type annotation.
     36library(scPred)
     37}}}
     38
     39By running the codes above, all the required R packages will be loaded from the previous R library set (2023q1).
    1940
    2041=== Create a matrix of gene counts by cells ===