Skip to content

Instantly share code, notes, and snippets.

@stemangiola
Last active June 21, 2024 06:44
Show Gist options
  • Save stemangiola/70580cb90c26b865a578edb9eb4219ae to your computer and use it in GitHub Desktop.
Save stemangiola/70580cb90c26b865a578edb9eb4219ae to your computer and use it in GitHub Desktop.
# PREMISE
# these implementation of HPCL is highly experimental.
# Therefore the interface, function names, arguments names, types of input
# are subject to change and to be extended.
# At this stage, the input is a named list of Seurat objects.
# In another branch (soon to be integrated), we accept SCE, H5 SCE, and anndata
BiocManager::install("MangiolaLaboratory/HPCell@grammar-hpc", upgrade_dependencies=FALSE)
BiocManager::install("crew", upgrade_dependencies=FALSE)
BiocManager::install("crew.cluster", upgrade_dependencies=FALSE)
BiocManager::install('satijalab/seurat-data', upgrade_dependencies=FALSE)
library(HPCell)
library(crew)
library(crew.cluster)
library(magrittr)
library(Seurat)
library(SeuratData)
options(Seurat.object.assay.version = "v5")
input_seurat <-
LoadData("pbmc3k") |>
_[,1:500] |>
list() |>
magrittr::set_names("pbmc3k")
# Define and execute the pipeline
input_seurat |>
# Initialise pipeline characteristics
initialise_hpc(
#debug_step = "empty_droplets_tbl_072a0a001eedb254",
# Default resourced
computing_resources = crew_controller_local(workers = 10)
# Slurm resources
# computing_resources =
# crew.cluster::crew_controller_slurm(
# slurm_memory_gigabytes_per_cpu = 5,
# workers = 50,
# tasks_max = 5,
# verbose = T
# )
) |>
# Remove empty outliers
remove_empty_DropletUtils() |>
# Remove dead cells
remove_dead_scuttle() |>
# Score cell cycle
score_cell_cycle_seurat() |>
# Remove doublets
remove_doublets_scDblFinder() |>
# Annotation
annotate_cell_type() |>
normalise_abundance_seurat_SCT(factors_to_regress = c(
"subsets_Mito_percent",
"subsets_Ribo_percent",
"G2M.Score"
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment