Skip to content

Commit bc8d121

Browse files
authored
Merge pull request #205 from satijalab/develop
sctransform 0.4.2
2 parents 8efb692 + 8ffec46 commit bc8d121

File tree

13 files changed

+193
-58
lines changed

13 files changed

+193
-58
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
^supplement$
55
^scratch$
66
^revdep$
7+
.github

.github/workflows/rhub.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: R-hub
2+
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
config:
8+
description: 'A comma separated list of R-hub platforms to use.'
9+
type: string
10+
default: 'linux,windows,macos'
11+
name:
12+
description: 'Run name. You can leave this empty now.'
13+
type: string
14+
id:
15+
description: 'Unique ID. You can leave this empty now.'
16+
type: string
17+
18+
jobs:
19+
20+
setup:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
containers: ${{ steps.rhub-setup.outputs.containers }}
24+
platforms: ${{ steps.rhub-setup.outputs.platforms }}
25+
26+
steps:
27+
# NO NEED TO CHECKOUT HERE
28+
- uses: r-hub/actions/setup@v1
29+
with:
30+
config: ${{ github.event.inputs.config }}
31+
id: rhub-setup
32+
33+
linux-containers:
34+
needs: setup
35+
if: ${{ needs.setup.outputs.containers != '[]' }}
36+
runs-on: ubuntu-latest
37+
name: ${{ matrix.config.label }}
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
config: ${{ fromJson(needs.setup.outputs.containers) }}
42+
container:
43+
image: ${{ matrix.config.container }}
44+
45+
steps:
46+
- uses: r-hub/actions/checkout@v1
47+
- uses: r-hub/actions/platform-info@v1
48+
with:
49+
token: ${{ secrets.RHUB_TOKEN }}
50+
job-config: ${{ matrix.config.job-config }}
51+
- uses: r-hub/actions/setup-deps@v1
52+
with:
53+
token: ${{ secrets.RHUB_TOKEN }}
54+
job-config: ${{ matrix.config.job-config }}
55+
- uses: r-hub/actions/run-check@v1
56+
with:
57+
token: ${{ secrets.RHUB_TOKEN }}
58+
job-config: ${{ matrix.config.job-config }}
59+
60+
other-platforms:
61+
needs: setup
62+
if: ${{ needs.setup.outputs.platforms != '[]' }}
63+
runs-on: ${{ matrix.config.os }}
64+
name: ${{ matrix.config.label }}
65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
config: ${{ fromJson(needs.setup.outputs.platforms) }}
69+
70+
steps:
71+
- uses: r-hub/actions/checkout@v1
72+
- uses: r-hub/actions/setup-r@v1
73+
with:
74+
job-config: ${{ matrix.config.job-config }}
75+
token: ${{ secrets.RHUB_TOKEN }}
76+
- uses: r-hub/actions/platform-info@v1
77+
with:
78+
token: ${{ secrets.RHUB_TOKEN }}
79+
job-config: ${{ matrix.config.job-config }}
80+
- uses: r-hub/actions/setup-deps@v1
81+
with:
82+
job-config: ${{ matrix.config.job-config }}
83+
token: ${{ secrets.RHUB_TOKEN }}
84+
- uses: r-hub/actions/run-check@v1
85+
with:
86+
job-config: ${{ matrix.config.job-config }}
87+
token: ${{ secrets.RHUB_TOKEN }}

DESCRIPTION

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Package: sctransform
22
Type: Package
33
Title: Variance Stabilizing Transformations for Single Cell UMI Data
4-
Version: 0.4.1
5-
Date: 2023-10-18
4+
Version: 0.4.2
5+
Date: 2025-04-30
66
Authors@R: c(
77
person(given = "Christoph", family = "Hafemeister", email = "christoph.hafemeister@nyu.edu", role = "aut", comment = c(ORCID = "0000-0001-6365-8254")),
8-
person(given = "Saket", family = "Choudhary", email = "schoudhary@nygenome.org", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-5202-7633")),
8+
person(given = "Saket", family = "Choudhary", email = "saketc@iitb.ac.in", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-5202-7633")),
99
person(given = "Rahul", family = "Satija", email = "rsatija@nygenome.org", role = "ctb", comment = c(ORCID = "0000-0001-9448-8833"))
1010
)
1111
Description: A normalization method for single-cell UMI count data using a
@@ -42,4 +42,4 @@ Suggests:
4242
knitr
4343
Enhances:
4444
glmGamPoi
45-
RoxygenNote: 7.2.3
45+
RoxygenNote: 7.3.2

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ importFrom(dplyr,mutate)
2727
importFrom(dplyr,n)
2828
importFrom(dplyr,pull)
2929
importFrom(dplyr,summarise)
30+
importFrom(future,nbrOfWorkers)
3031
importFrom(future.apply,future_lapply)
3132
importFrom(graphics,abline)
3233
importFrom(graphics,par)

NEWS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# News
22
All notable changes will be documented in this file.
33

4+
## [0.4.2] - 2025-04-30
5+
6+
### Fixed
7+
8+
- Fixed citation orcid
9+
- Fix for future_lapply when using a single core [#201](https://github.com/satijalab/sctransform/issues/201)
10+
411
## [0.4.1] - 2023-10-18
512

613
### Fixed

R/differential_expression.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@
2020
#'
2121
#' @import Matrix
2222
#' @importFrom future.apply future_lapply
23+
#' @importFrom future nbrOfWorkers
2324
#' @importFrom stats model.matrix p.adjust pchisq
2425
#'
2526
compare_expression <- function(x, umi, group, val1, val2, method = 'LRT', bin_size = 256,
2627
cell_attr = x$cell_attr, y = x$y, min_cells = 5,
2728
weighted = TRUE, randomize = FALSE, verbosity = 2,
2829
verbose = NULL, show_progress = NULL) {
30+
if (nbrOfWorkers() == 1){
31+
my.lapply <- function(X, FUN, future.seed = TRUE) lapply(X, FUN)
32+
} else {
33+
my.lapply <- future_lapply
34+
}
2935
# Take care of deprecated arguments
3036
if (!is.null(verbose)) {
3137
warning("The 'verbose' argument is deprecated as of v0.3. Use 'verbosity' instead. (in sctransform::vst)", immediate. = TRUE, call. = FALSE)
@@ -93,15 +99,15 @@ compare_expression <- function(x, umi, group, val1, val2, method = 'LRT', bin_si
9399
for (i in 1:max_bin) {
94100
genes_bin <- genes[bin_ind == i]
95101
if (method == 't_test') {
96-
bin_res <- future_lapply(
102+
bin_res <- my.lapply(
97103
X = genes_bin,
98104
FUN = function(gene) {model_comparison_ttest(y[gene, use_cells], group)},
99105
future.seed = TRUE)
100106
}
101107
if (method == 'LRT') {
102108
mu <- x$model_pars_fit[genes_bin, -1, drop=FALSE] %*% t(regressor_data) # in log space
103109
y <- as.matrix(umi[genes_bin, use_cells])
104-
bin_res <- future_lapply(
110+
bin_res <- my.lapply(
105111
X = genes_bin,
106112
FUN = function(gene) {
107113
model_comparison_lrt(y[gene, ], mu[gene, ], x$model_pars_fit[gene, 'theta'], group, weights)},
@@ -175,7 +181,7 @@ compare_expression <- function(x, umi, group, val1, val2, method = 'LRT', bin_si
175181
y_theta[o] <- 10 ^ ksmooth(x = x$genes_log_mean_step1, y = log10(x$model_pars[, 'theta']),
176182
x.points = y_log_mean, bandwidth = bw, kernel='normal')$y
177183
names(y_theta) <- genes_bin
178-
bin_res <- future_lapply(
184+
bin_res <- my.lapply(
179185
X = genes_bin,
180186
FUN = function(gene) {
181187
return(model_comparison_lrt_free3(gene, y[gene, ], y_theta[gene], x$model_str, cell_attr, group, weights, randomize))

R/vst.R

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ NULL
9494
#'
9595
#' @import Matrix
9696
#' @importFrom future.apply future_lapply
97+
#' @importFrom future nbrOfWorkers
9798
#' @importFrom MASS theta.ml theta.mm glm.nb negative.binomial
9899
#' @importFrom stats glm glm.fit df.residual ksmooth model.matrix as.formula approx density poisson var bw.SJ
99100
#' @importFrom utils txtProgressBar setTxtProgressBar capture.output
@@ -602,7 +603,12 @@ get_model_pars <- function(genes_step1, bin_size, umi, model_str, cells_step1,
602603
index_lst <- split(index_vec, ceiling(index_vec/genes_per_worker))
603604

604605
# the index list will have at most n_workers entries, each one defining which genes to work on
605-
par_lst <- future_lapply(
606+
if (nbrOfWorkers() == 1){
607+
my.lapply <- function(X, FUN, future.seed = TRUE) lapply(X, FUN)
608+
} else {
609+
my.lapply <- future_lapply
610+
}
611+
par_lst <- my.lapply(
606612
X = index_lst,
607613
FUN = function(indices) {
608614
umi_bin_worker <- umi_bin[indices, , drop = FALSE]
@@ -692,6 +698,7 @@ get_model_pars <- function(genes_step1, bin_size, umi, model_str, cells_step1,
692698
}
693699

694700
get_model_pars_nonreg <- function(genes, bin_size, model_pars_fit, regressor_data, umi, model_str_nonreg, cell_attr, verbosity) {
701+
695702
bin_ind <- ceiling(x = 1:length(x = genes) / bin_size)
696703
max_bin <- max(bin_ind)
697704
if (verbosity > 1) {
@@ -702,9 +709,14 @@ get_model_pars_nonreg <- function(genes, bin_size, model_pars_fit, regressor_dat
702709
genes_bin <- genes[bin_ind == i]
703710
mu <- tcrossprod(model_pars_fit[genes_bin, -1, drop=FALSE], regressor_data)
704711
umi_bin <- as.matrix(umi[genes_bin, ])
712+
if (nbrOfWorkers() == 1){
713+
my.lapply <- function(X, FUN, future.seed = TRUE) lapply(X, FUN)
714+
} else {
715+
my.lapply <- future_lapply
716+
}
705717
model_pars_nonreg[[i]] <- do.call(
706718
rbind,
707-
future_lapply(X = genes_bin,
719+
my.lapply(X = genes_bin,
708720
FUN = function(gene) {
709721
fam <- negative.binomial(theta = model_pars_fit[gene, 'theta'], link = 'log')
710722
y <- umi_bin[gene, ]

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Running sctransform:
2121
```r
2222
# Runnning sctransform on a UMI matrix
2323
normalized_data <- sctransform::vst(umi_count_matrix)$y
24-
# v2 regularization
25-
normalized_data <- sctransform::vst(umi_count_matrix, vst.flavor="v2")$y
24+
# v1 regularization
25+
normalized_data <- sctransform::vst(umi_count_matrix, vst.flavor="v1")$y
2626

2727
# Runnning sctransform on a Seurat object
2828
seurat_object <- Seurat::SCTransform(seurat_object)
29-
#v2 regularization
30-
seurat_object <- Seurat::SCTransform(seurat_object, vst.flavor="v2")
29+
# v1 regularization
30+
seurat_object <- Seurat::SCTransform(seurat_object, vst.flavor="v1")
3131
```
3232

3333
## Help
@@ -39,7 +39,7 @@ Available vignettes:
3939

4040
- [Variance stabilizing transformation](https://htmlpreview.github.io/?https://github.com/satijalab/sctransform/blob/supp_html/supplement/variance_stabilizing_transformation.html)
4141
- [Using sctransform in Seurat](https://htmlpreview.github.io/?https://github.com/satijalab/sctransform/blob/supp_html/supplement/seurat.html)
42-
- [Examples of how to perform normalization, feature selection, integration, and differential expression with sctransform v2 regularization](https://satijalab.org/seurat/articles/sctransform_v2_vignette.html)
42+
- [Examples of how to perform normalization, feature selection, integration, and differential expression with sctransform v2 regularization](https://satijalab.org/seurat/articles/sctransform_vignette)
4343

4444

4545
Please use [the issue tracker](https://github.com/satijalab/sctransform/issues) if you encounter a problem

inst/CITATION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ citHeader("To cite sctransform in publications, please use:")
33
bibentry(bibtype = "article",
44
author = c(person(given = "Christoph", family = "Hafemeister", email = "christoph.hafemeister@nyu.edu", role = "aut",
55
comment = c(ORCID = "0000-0001-6365-8254")),
6-
person(given = "Rahul", family = "Satija", email = "rsatija@nygenome.org", role = c("aut", "ctb"), comment = c(ORCID = "000
7-
-0001-9448-8833"))),
6+
person(given = "Rahul", family = "Satija", email = "rsatija@nygenome.org", role = c("aut", "ctb"),
7+
comment = c(ORCID = "0000-0001-9448-8833"))),
88
title = "Normalization and variance stabilization of single-cell RNA-seq data using regularized negative binomial regression",
99
journal = "Genome Biology",
1010
year = "2019",
@@ -16,7 +16,7 @@ bibentry(bibtype = "article",
1616
)
1717

1818
bibentry(bibtype = "article",
19-
author = c(person(given = "Saket", family = "Choudhary", email = "schoudhary@nygenome.org", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-5202-7633")),
19+
author = c(person(given = "Saket", family = "Choudhary", email = "saketc@iitb.ac.in", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-5202-7633")),
2020
person(given = "Rahul", family = "Satija", email = "rsatija@nygenome.org", role = c("aut", "ctb"), comment = c(ORCID = "0000-0001-9448-8833"))),
2121
title = "Comparison and evaluation of statistical error models for scRNA-seq",
2222
journal = "Genome Biology",

revdep/README.md

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,37 @@
11
# Platform
22

3-
|field |value |
4-
|:--------|:----------------------------------------------|
5-
|version |R version 4.3.1 (2023-06-16) |
6-
|os |Ubuntu 20.04.6 LTS |
7-
|system |x86_64, linux-gnu |
8-
|ui |RStudio |
9-
|language |(EN) |
10-
|collate |en_US.UTF-8 |
11-
|ctype |en_US.UTF-8 |
12-
|tz |America/New_York |
13-
|date |2023-09-18 |
14-
|rstudio |2023.03.1+446 Cherry Blossom (server) |
15-
|pandoc |3.1.3 @ /home/choudharys/miniconda3/bin/pandoc |
3+
|field |value |
4+
|:--------|:-------------------------------------------------------------|
5+
|version |R version 4.5.0 (2025-04-11) |
6+
|os |Ubuntu 24.04.2 LTS |
7+
|system |x86_64, linux-gnu |
8+
|ui |RStudio |
9+
|language |en_GB:en |
10+
|collate |en_GB.UTF-8 |
11+
|ctype |en_GB.UTF-8 |
12+
|tz |Asia/Kolkata |
13+
|date |2025-04-30 |
14+
|rstudio |2024.12.1+563 Kousa Dogwood (desktop) |
15+
|pandoc |3.6.4 @ /data/miniconda3/bin/pandoc |
16+
|quarto |1.5.57 @ /usr/lib/rstudio/resources/app/bin/quarto/bin/quarto |
1617

1718
# Dependencies
1819

19-
|package |old |new |Δ |
20-
|:-------------|:-----|:----------|:--|
21-
|sctransform |0.3.5 |0.4.0 |* |
22-
|digest |NA |0.6.33 |* |
23-
|dplyr |NA |1.1.3 |* |
24-
|future |NA |1.33.0 |* |
25-
|future.apply |NA |1.11.0 |* |
26-
|ggplot2 |NA |3.4.3 |* |
27-
|gtable |NA |0.3.4 |* |
28-
|labeling |NA |0.4.3 |* |
29-
|matrixStats |NA |1.0.0 |* |
30-
|parallelly |NA |1.36.0 |* |
31-
|Rcpp |NA |1.0.11 |* |
32-
|RcppArmadillo |NA |0.12.6.4.0 |* |
33-
|rlang |NA |1.1.1 |* |
34-
|vctrs |NA |0.6.3 |* |
35-
|viridisLite |NA |0.4.2 |* |
20+
|package |old |new |Δ |
21+
|:-----------|:---|:----------|:--|
22+
|sctransform |NA |0.4.1.9003 |* |
3623

3724
# Revdeps
3825

39-
## Failed to check (6)
26+
## Failed to check (7)
4027

41-
|package |version |error |warning |note |
42-
|:-------|:-------|:-----|:-------|:----|
43-
|CAMML |? | | | |
44-
|EWCE |? | | | |
45-
|muscat |? | | | |
46-
|RESET |? | | | |
47-
|Seurat |? | | | |
48-
|VAM |? | | | |
28+
|package |version |error |warning |note |
29+
|:--------|:-------|:-----|:-------|:----|
30+
|CAMML |? | | | |
31+
|EWCE |? | | | |
32+
|muscat |? | | | |
33+
|RESET |? | | | |
34+
|SCdeconR |? | | | |
35+
|Seurat |? | | | |
36+
|VAM |? | | | |
4937

0 commit comments

Comments
 (0)