The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Parallelize 'scuttle' functions

The 'scuttle' logo + The 'futurize' hexlogo = The 'future' logo

The futurize package allows you to easily turn sequential code into parallel code by piping the sequential code to the futurize() function. Easy!

TL;DR

library(futurize)
plan(multisession)
library(scuttle)

sce <- logNormCounts(sce) |> futurize()
qc <- perCellQCMetrics(sce) |> futurize()

Introduction

This vignette demonstrates how to use this approach to parallelize the scuttle functions.

The scuttle Bioconductor package provides basic utility functions for single-cell RNA-seq data analysis, including quality control, normalization, and aggregation, which can be parallelized across cells.

Example: Log-normalizing counts in parallel

The logNormCounts() function computes log-normalized expression values for a SingleCellExperiment object:

library(scuttle)

# Simulate data
set.seed(42)
n_genes <- 200L
n_cells <- 100L
counts <- matrix(
  rpois(n_genes * n_cells, lambda = 10),
  nrow = n_genes,
  ncol = n_cells,
  dimnames = list(
    paste0("gene", seq_len(n_genes)),
    paste0("cell", seq_len(n_cells))
  )
)

sce <- SingleCellExperiment::SingleCellExperiment(
  assays = list(counts = counts)
)

sce <- logNormCounts(sce)

Here logNormCounts() runs sequentially, but we can easily make it run in parallel by piping to futurize():

library(futurize)

sce <- logNormCounts(sce) |> futurize()

This will distribute the work across the available parallel workers, given that we have set up parallel workers, e.g.

plan(multisession)

The built-in multisession backend parallelizes on your local computer and works on all operating systems. There are other parallel backends to choose from, including alternatives to parallelize locally as well as distributed across remote machines, e.g.

plan(future.mirai::mirai_multisession)

and

plan(future.batchtools::batchtools_slurm)

Supported Functions

The following scuttle functions are supported by futurize():

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.