Skip to content

Commit

Permalink
Merge pull request #881 from satijalab/release/5.0.1
Browse files Browse the repository at this point in the history
Release/5.0.1
  • Loading branch information
Gesmira authored Nov 20, 2023
2 parents ca4c48b + f3fbb2b commit a87fd5f
Show file tree
Hide file tree
Showing 41 changed files with 1,523 additions and 726 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: Seurat
Version: 5.0.0
Date: 2023-10-23
Version: 5.0.1
Date: 2023-11-16
Title: Tools for Single Cell Genomics
Description: A toolkit for quality control, analysis, and exploration of single cell RNA sequencing data. 'Seurat' aims to enable users to identify and interpret sources of heterogeneity from single cell transcriptomic measurements, and to integrate diverse types of single cell data. See Satija R, Farrell J, Gennert D, et al (2015) <doi:10.1038/nbt.3192>, Macosko E, Basu A, Satija R, et al (2015) <doi:10.1016/j.cell.2015.05.002>, Stuart T, Butler A, et al (2019) <doi:10.1016/j.cell.2019.05.031>, and Hao, Hao, et al (2020) <doi:10.1101/2020.10.12.335331> for more details.
Authors@R: c(
Expand Down
13 changes: 13 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Seurat 5.0.1 (2023-11-16)

## Changes

- Fixed `SCTransform.StdAssay` to pass extra arguments to `sctransform::vst()`. Fixes [#875](https://github.com/satijalab/seurat/issues/7998)
- Fixed PercentageFeatureSet Layer calling [(#8009)](https://github.com/satijalab/seurat/issues/8009)
- Fixed cell highlighting [(#7914)](https://github.com/satijalab/seurat/pull/7914)
- Updated marker sorting to be by p-value with ties broken by absolute difference in percent expression
- Fixed issue with replicated barcodes in MappingScore [(#7922)](https://github.com/satijalab/seurat/issues/7922)
- Improved `PseudobulkExpression` by adding 'g' to cell names that started with numeric values
- Improved `PseudobulkExpression` by adding each variable specified in `group.by` as columns in the object metadata when `return.seurat=TRUE`
- Fixed `DimPlot` and `FeatureScatter` which were breaking when using the `split.by` argument with a variable that contained NAs

# Seurat 5.0.0 (2023-10-25)

## Added
Expand Down
4 changes: 2 additions & 2 deletions R/differential_expression.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ FindAllMarkers <- function(
subset = (myAUC > return.thresh | myAUC < (1 - return.thresh))
)
} else if (is.null(x = node) || test.use %in% c('bimod', 't')) {
gde <- gde[order(gde$p_val, -gde[, 2]), ]
gde <- gde[order(gde$p_val, -abs(gde$pct.1-gde$pct.2)), ]
gde <- subset(x = gde, subset = p_val < return.thresh)
}
if (nrow(x = gde) > 0) {
Expand Down Expand Up @@ -612,7 +612,7 @@ FindMarkers.default <- function(
if (test.use %in% DEmethods_nocorrect()) {
de.results <- de.results[order(-de.results$power, -de.results[, 1]), ]
} else {
de.results <- de.results[order(de.results$p_val, -abs(de.results[,colnames(fc.results)[1]])), ]
de.results <- de.results[order(de.results$p_val, -abs(de.results$pct.1-de.results$pct.2)), ]
de.results$p_val_adj = p.adjust(
p = de.results$p_val,
method = "bonferroni",
Expand Down
12 changes: 6 additions & 6 deletions R/integration.R
Original file line number Diff line number Diff line change
Expand Up @@ -2621,19 +2621,19 @@ MappingScore.AnchorSet <- function(
combined.object <- slot(object = anchors, name = "object.list")[[1]]
combined.object <- RenameCells(
object = combined.object,
new.names = unname(obj = sapply(
new.names = unname(obj = make.unique(sapply(
X = Cells(x = combined.object),
FUN = RemoveLastField
))
)))
)
query.cells <- sapply(
query.cells <- make.unique(sapply(
X = slot(object = anchors, name = "query.cells"),
FUN = RemoveLastField
)
ref.cells <- sapply(
))
ref.cells <- make.unique(sapply(
X = slot(object = anchors, name = "reference.cells"),
FUN = RemoveLastField
)
))
query.embeddings <- Embeddings(object = subset(
x = combined.object[["pcaproject.l2"]],
cells = query.cells
Expand Down
3 changes: 2 additions & 1 deletion R/preprocessing5.R
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,8 @@ SCTransform.StdAssay <- function(
conserve.memory = conserve.memory,
return.only.var.genes = return.only.var.genes,
seed.use = seed.use,
verbose = verbose)
verbose = verbose,
...)
min_var <- vst.out$arguments$min_variance
residual.type <- vst.out[['residual_type']] %||% 'pearson'
assay.out <- CreateSCTAssay(vst.out = vst.out, do.correct.umi = do.correct.umi, residual.type = residual.type,
Expand Down
62 changes: 52 additions & 10 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ PercentageFeatureSet <- function(
warn(message = "Both pattern and features provided. Pattern is being ignored.")
}
percent.featureset <- list()
layers <- Layers(object = object, pattern = "counts")
layers <- Layers(object = object, search = "counts")
for (i in seq_along(along.with = layers)) {
layer <- layers[i]
features.layer <- features %||% grep(
Expand Down Expand Up @@ -1425,6 +1425,8 @@ PseudobulkExpression.Seurat <- function(
stop("Number of layers provided does not match number of assays")
}
data <- FetchData(object = object, vars = rev(x = group.by))
#only keep meta-data columns that are in object
group.by <- intersect(group.by, colnames(data))
data <- data[which(rowSums(x = is.na(x = data)) == 0), , drop = F]
if (nrow(x = data) < ncol(x = object)) {
inform("Removing cells with NA for 1 or more grouping variables")
Expand All @@ -1450,6 +1452,22 @@ PseudobulkExpression.Seurat <- function(
data <- data[, which(num.levels > 1), drop = F]
}
category.matrix <- CreateCategoryMatrix(labels = data, method = method)
#check if column names are numeric
col.names <- colnames(category.matrix)
if (any(!(grepl("^[a-zA-Z]|^\\.[^0-9]", col.names)))) {
col.names <- ifelse(
!(grepl("^[a-zA-Z]|^\\.[^0-9]", col.names)),
paste0("g", col.names),
col.names
)
colnames(category.matrix) <- col.names
inform(
message = paste0("First group.by variable `", group.by[1],
"` starts with a number, appending `g` to ensure valid variable names"),
.frequency = "regularly",
.frequency_id = "PseudobulkExpression"
)
}
data.return <- list()
for (i in 1:length(x = assays)) {
if (inherits(x = features, what = "list")) {
Expand Down Expand Up @@ -1568,16 +1586,40 @@ PseudobulkExpression.Seurat <- function(
toRet <- ScaleData(object = toRet, verbose = verbose)
}
}
if ('ident' %in% group.by) {
first.cells <- sapply(
X = 1:ncol(x = category.matrix),
FUN = function(x) {
return(category.matrix[,x, drop = FALSE ]@i[1] + 1)
}
#add meta-data based on group.by variables
cells <- Cells(toRet)
for (i in 1:length(group.by)) {
if (group.by[i] != "ident") {
v <- sapply(
strsplit(cells, "_"),
function(x) {return(x[i])}
)
names(v) <- cells
toRet <- AddMetaData(toRet,
metadata = v,
col.name = group.by[i]
)
}
}
#set idents to pseudobulk variables
Idents(toRet) <- cells

#make orig.ident variable
#orig.ident = ident if group.by includes `ident`
#if not, orig.ident is equal to pseudobulk cell names
if(any(group.by == "ident")) {
i = which(group.by == "ident")
v <- sapply(
strsplit(cells, "_"),
function(x) {return(x[i])}
)
names(v) <- cells
toRet <- AddMetaData(toRet,
metadata = v,
col.name = "orig.ident"
)
Idents(object = toRet,
cells = colnames(x = toRet)
) <- Idents(object = object)[first.cells]
} else {
toRet$orig.ident <- cells
}
return(toRet)
} else {
Expand Down
12 changes: 8 additions & 4 deletions R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,9 @@ DimPlot <- function(
data[, shape.by] <- object[[shape.by, drop = TRUE]]
}
if (!is.null(x = split.by)) {
data[, split.by] <- FetchData(object = object, vars = split.by)[split.by]
split <- FetchData(object = object, vars = split.by, clean=TRUE)[split.by]
data <- data[rownames(split),]
data[, split.by] <- split
}
if (isTRUE(x = shuffle)) {
set.seed(seed = seed)
Expand Down Expand Up @@ -2045,7 +2047,9 @@ FeatureScatter <- function(
}
}
if (!is.null(x = split.by)) {
data[, split.by] <- FetchData(object = object, vars = split.by)[split.by]
split <- FetchData(object = object, vars = split.by, clean=TRUE)[split.by]
data <- data[rownames(split),]
data[, split.by] <- split
}
plots <- lapply(
X = group.by,
Expand Down Expand Up @@ -7895,7 +7899,7 @@ SetHighlight <- function(

# Check for raster
if (isTRUE(x = raster)) {
size <- size[1]
size <- sizes.highlight[1]
}

plot.order <- sort(x = unique(x = highlight), na.last = TRUE)
Expand Down Expand Up @@ -8200,7 +8204,7 @@ SingleDimPlot <- function(
raster <- raster %||% (nrow(x = data) > 1e5)
pt.size <- pt.size %||% AutoPointSize(data = data, raster = raster)

if (!is.null(x = cells.highlight) && pt.size == AutoPointSize(data = data, raster = raster) && sizes.highlight != pt.size && isTRUE(x = raster)) {
if (!is.null(x = cells.highlight) && pt.size != AutoPointSize(data = data, raster = raster) && sizes.highlight != pt.size && isTRUE(x = raster)) {
warning("When `raster = TRUE` highlighted and non-highlighted cells must be the same size. Plot will use the value provided to 'sizes.highlight'.")
}

Expand Down
76 changes: 44 additions & 32 deletions _pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,70 +14,72 @@ navbar:
title: "Seurat"
left:
- text: "Install"
href: articles/install.html
- text: "Seurat v5"
href: articles/get_started_v5.html
href: articles/install_v5.html
- text: "Get started"
href: articles/get_started.html
href: articles/get_started_v5_new.html
- text: "Vignettes"
menu:
- text: Introductory Vignettes
- text: "PBMC 3K guided tutorial"
href: articles/pbmc3k_tutorial.html
- text: "Data visualization vignette"
href: articles/visualization_vignette.html
- text: "SCTransform, v2 regularization"
href: articles/sctransform_vignette.html
- text: "Using Seurat with multi-modal data"
href: articles/multimodal_vignette.html
- text: "Seurat v5 Command Cheat Sheet"
href: articles/essential_commands.html
- text: -------
- text: Data Integration
- text: "Introduction to scRNA-seq integration"
href: articles/integration_introduction.html
- text: "Integrative analysis in Seurat v5"
href: articles/seurat5_integration.html
- text: "Mapping and annotating query datasets"
href: articles/integration_mapping.html
- text: "Fast integration using reciprocal PCA (RPCA)"
href: articles/integration_rpca.html
- text: "Tips for integrating large datasets"
href: articles/integration_large_datasets.html
- text: "Integrating scRNA-seq and scATAC-seq data"
href: articles/atacseq_integration_vignette.html
- text: "Multimodal reference mapping"
href: articles/multimodal_reference_mapping.html
- text: -------
- text: New Statistical Methods
- text: Multi-assay data
- text: "Dictionary Learning for cross-modality integration"
href: articles/seurat5_integration_bridge.html
- text: "Weighted Nearest Neighbor Analysis"
href: articles/weighted_nearest_neighbor_analysis.html
- text: "Integrating scRNA-seq and scATAC-seq data"
href: articles/seurat5_atacseq_integration_vignette.html
- text: "Multimodal reference mapping"
href: articles/multimodal_reference_mapping.html
- text: "Mixscape Vignette"
href: articles/mixscape_vignette.html
- text: "Using sctransform in Seurat"
href: articles/sctransform_vignette.html
- text: "SCTransform, v2 regularization"
href: articles/sctransform_v2_vignette.html
- text: -------
- text: Massively scalable analysis
- text: "Sketch-based analysis in Seurat v5"
href: articles/seurat5_sketch_analysis.html
- text: "Sketch integration using a 1 million cell dataset from Parse Biosciences"
href: articles/ParseBio_sketch_integration.html
- text: "Map COVID PBMC datasets to a healthy reference"
href: articles/COVID_SCTMapping.html
- text: "BPCells Interaction"
href: articles/seurat5_bpcells_interaction_vignette.html
- text: -------
- text: Spatial analysis
- text: "Analysis of spatial datasets (Imaging-based)"
href: articles/seurat5_spatial_vignette_2.html
- text: "Analysis of spatial datasets (Sequencing-based)"
href: articles/spatial_vignette.html
- text: -------
- text: Other
- text: "Data visualization vignette"
href: articles/visualization_vignette.html
- text: "Cell-cycle scoring and regression"
href: articles/cell_cycle_vignette.html
- text: "Differential expression testing"
href: articles/de_vignette.html
- text: "Demultiplexing with hashtag oligos (HTOs)"
href: articles/hashing_vignette.html
- text: "Interoperability between single-cell object formats"
href: articles/conversion_vignette.html
- text: "Parallelization in Seurat with future"
href: articles/future_vignette.html
- text: "Dimensional reduction vignette"
href: articles/dim_reduction_vignette.html
- text: "Seurat essential commands list"
href: articles/essential_commands.html
- text: "Seurat interaction tips"
href: articles/interaction_vignette.html
- text: "Merging Seurat objects"
href: articles/merge_vignette.html
- text: Extensions
href: articles/extensions.html
- text: FAQ
href: "https://github.com/satijalab/seurat/discussions"
- text: "News"
href: news/index.html
href: articles/announcements.html
- text: "Reference"
href: reference/index.html
- text: "Archive"
Expand Down Expand Up @@ -157,6 +159,16 @@ reference:
- contents:
- has_concept("convenience")

- title: "Multimodal"
desc: "Functions for multimodal analysis"
- contents:
- has_concept("multimodal")

- title: "Re-exports"
desc: "Functions for flexible analysis of massively scalable datasets"
- contents:
- has_concept("sketching")

- title: "Re-exports"
desc: "Functions re-exported from other packages"
- contents:
Expand Down
22 changes: 13 additions & 9 deletions index.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
![](articles/assets/seurat_banner.jpg)

## **Beta release of Seurat v5**
## **Seurat v5**

We are excited to release an initial beta version of Seurat v5! This update brings the following new features and functionality:
We are excited to release Seurat v5! To install, please follow the instructions in our [install page](install.html). This update brings the following new features and functionality:

* **Analysis of sequencing and imaging-based spatial datasets:** Spatially resolved datasets are redefining our understanding of cellular interactions and the organization of human tissues. Both sequencing-based(i.e. Visium, SLIDE-seq, etc.), and imaging-based (MERFISH/Vizgen, Xenium, CosMX, etc.) technologies have unique advantages, and require tailored analytical methods and software infrastructure. In Seurat v5, we introduce flexible and diverse support for a wide variety of spatially resolved data types, and support for analytical techniqiues for scRNA-seq integration, deconvolution, and niche identification.

- Vignette: [Analysis of spatial datasets (Sequencing-based)](articles/seurat5_spatial_vignette.html)
- Vignette: [Analysis of spatial datasets (Imaging-based)](articles/seurat5_spatial_vignette_2.html)\
\
* **Integrative multimodal analysis:** The cellular transcriptome is just one aspect of cellular identity, and recent technologies enable routine profiling of chromatin accessibility, histone modifications, and protein levels from single cells. In Seurat v5, we introduce 'bridge integration', a statistical method to integrate experiments measuring different modalities (i.e. separate scRNA-seq and scATAC-seq datasets), using a separate multiomic dataset as a molecular 'bridge'. For example, we demonstrate how to map scATAC-seq datasets onto scRNA-seq datasets, to assist users in interpreting and annotating data from new modalities.\
\
We recognize that while the goal of matching shared cell types across datasets may be important for many problems, users may also be concerned about which method to use, or that integration could result in a loss of biological resolution. In Seurat v5, we also introduce flexible and streamlined workflows for the integration of multiple scRNA-seq datasets. This makes it easier to explore the results of different integration methods, and to compare these results to a workflow that excludes integration steps.
Expand All @@ -28,15 +23,24 @@ We enable high-performance via the BPCells package, developed by Ben Parks in th
- Vignette: [Interacting with BPCell matrices in Seurat v5](articles/seurat5_bpcells_interaction_vignette.html)
- BPCells R Package: [Scaling Single Cell Analysis to Millions of Cells](https://bnprks.github.io/BPCells/)\
\
* **Backwards compatibility:** While Seurat v5 introduces new functionality, we have ensured that the software is backwards-compatible with previous versions, so that users will continue to be able to re-run existing workflows. As v5 is still in beta, the CRAN installation (`install.packages("Seurat")`) will continue to install Seurat v4, but users can opt-in to test Seurat v5 by following the instructions in our [install page](install.html).\
* **Analysis of sequencing and imaging-based spatial datasets:** Spatially resolved datasets are redefining our understanding of cellular interactions and the organization of human tissues. Both sequencing-based(i.e. Visium, SLIDE-seq, etc.), and imaging-based (MERFISH/Vizgen, Xenium, CosMX, etc.) technologies have unique advantages, and require tailored analytical methods and software infrastructure. In Seurat v5, we introduce flexible and diverse support for a wide variety of spatially resolved data types, and support for analytical techniqiues for scRNA-seq integration, deconvolution, and niche identification.

- Vignette: [Analysis of spatial datasets (Sequencing-based)](articles/seurat5_spatial_vignette.html)
- Vignette: [Analysis of spatial datasets (Imaging-based)](articles/seurat5_spatial_vignette_2.html)\
\
* **Backwards compatibility:** While Seurat v5 introduces new functionality, we have ensured that the software is backwards-compatible with previous versions, so that users will continue to be able to re-run existing workflows. Previous versions of Seurat, such as Seurat v4, can also be installed following the instructions in our [install page](install.html).\

## **Changes between v4 and v5**

We have documented major changes between Seurat v4 and v5 in our [News page](announcements.html) for reference.

## **About Seurat**

Seurat is an R package designed for QC, analysis, and exploration of single-cell RNA-seq data. Seurat aims to enable users to identify and interpret sources of heterogeneity from single-cell transcriptomic measurements, and to integrate diverse types of single-cell data.

If you use Seurat in your research, please considering citing:

* [Hao, et al., bioRxiv 2022](https://doi.org/10.1101/2022.02.24.481684) [Seurat v5]
* [Hao, et al., Nature Biotechnology 2023](https://www.nature.com/articles/s41587-023-01767-y) [Seurat v5]
* [Hao\*, Hao\*, et al., Cell 2021](https://doi.org/10.1016/j.cell.2021.04.048) [Seurat v4]
* [Stuart\*, Butler\*, et al., Cell 2019](https://www.cell.com/cell/fulltext/S0092-8674(19)30559-8) [Seurat v3]
* [Butler, et al., Nat Biotechnol 2018](https://doi.org/10.1038/nbt.4096) [Seurat v2]
Expand Down
Loading

0 comments on commit a87fd5f

Please sign in to comment.