visummirrors seurattoscanpy dietseurat

1

visium_heart/st_snRNAseq/jobs/make_visium_scemirror.sh at db4d51ff033a6f25b24c99a275ea415128741f63 · saezlab/visium_heart (github.com)

DietSeurat function - RDocumentation

2

visium_heart/st_snRNAseq/utils/sce_mirrors.R at 5b30c7e497e06688a8448afd8d069d2fa70ebcd2 · saezlab/visium_heart (github.com)

# Copyright (c) [2021] [Ricardo O. Ramirez Flores]
# [email protected]

#' In this script we perform the transformation needed for the 
#' single cell objects to generate the shiny apps
#' powered by iSEE

library(optparse)
library(Seurat)
library(HDF5Array)
library(scater)

# Argument definition ---------------------------------------------------------------------------------
option_list <- list(
  make_option(c("--seurat_file"), 
              action ="store", 
              default = NULL, 
              type = 'character',
              help = "scell data with states in a variable"),
  make_option(c("--sce_folder"), 
              action= "store", 
              default = NULL, 
              type = 'character',
              help = "where to save the anndata object?"),
  make_option(c("--assay"), 
              action= "store", 
              default = "RNA", 
              type = 'character',
              help = "where to save the anndata object?"),
  make_option(c("--reduction"), 
              action= "store", 
              default = "umap", 
              type = 'character',
              help = "where to save the anndata object?")
)

opt <- parse_args(OptionParser(option_list = option_list))

cat("[INFO] Input parameters\n", file = stdout())
for(user_input in names(opt)) {
  if(user_input=="help") next;
  cat(paste0("[INFO] ",user_input," => ",opt[[user_input]],"\n"),file = stdout())
  assign(user_input,opt[[user_input]])
}

cell_data <- readRDS(seurat_file)
  
cell_data <- DietSeurat(
    cell_data,
    counts = TRUE,
    data = TRUE,
    scale.data = FALSE,
    features = NULL,
    assays = assay,
    dimreducs = reduction
  )
  
cell_data <- as.SingleCellExperiment(cell_data)

saveHDF5SummarizedExperiment(cell_data, dir = sce_folder, 
                             prefix = "", replace = FALSE,
                             chunkdim = NULL, level = NULL, as.sparse = NA,
                             verbose = NA)

#!/bin/bash
#PBS -l nodes=1:ppn=8
#PBS -l walltime=02:00:00
#PBS -l mem=130gb
#PBS -S /bin/bash
#PBS -N scemirror
#PBS -o /beegfs/work/hd_wh241/MI_revisions/analysis/jobs/make_visium_scemirror.out
#PBS -e /beegfs/work/hd_wh241/MI_revisions/analysis/jobs/make_visium_scemirror.err
#PBS -q smp
#PBS -m bea
#PBS -M [email protected]

source ~/.bashrc;
conda activate sc_analysis;
cd /beegfs/work/hd_wh241/MI_revisions;

$CONDA_PREFIX/bin/Rscript ./analysis/utils/sce_mirrors.R \
        --seurat_file "/beegfs/work/hd_wh241/MI_revisions/processed_visium/integration/integrated_slides.rds" \
        --sce_folder "/beegfs/work/hd_wh241/MI_revisions/processed_visium/integration/integrated_slides_sce" \
        --assay "Spatial" \
        --reduction "umap_harmony";

你可能感兴趣的:(chrome,前端)