Skip to content

Commit

Permalink
Merge pull request #5905 from satijalab/develop
Browse files Browse the repository at this point in the history
Seurat v4.1.1
  • Loading branch information
mojaveazure authored May 2, 2022
2 parents eaaf675 + 31866cc commit a1294c4
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 51 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: Seurat
Version: 4.1.0
Date: 2022-01-14
Version: 4.1.1
Date: 2022-05-01
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 Expand Up @@ -66,7 +66,7 @@ Imports:
scales,
scattermore (>= 0.7),
sctransform (>= 0.3.3),
SeuratObject (>= 4.0.4),
SeuratObject (>= 4.1.0),
shiny,
spatstat.core,
spatstat.geom,
Expand Down
14 changes: 13 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
# Seurat 4.1.1 (2022-05-01)

## Changes
- Fix `giveCsparse` related warnings in `Read10X_h5`
- Fix ident labeling for `SpatialPlot` ([#5774](https://github.com/satijalab/seurat/issues/5774))
- Fix `ReadMtx` on Windows ([#5687](https://github.com/satijalab/seurat/issues/5687))
- Fix `VlnPlot` to switch on rasterization only when required ([#5846](https://github.com/satijalab/seurat/pull/5846))
- Fix `ncol` behavior in `SpatialPlot` ([#5774](https://github.com/satijalab/seurat/issues/5774))
- Set `jitter` to FALSE in `FeatureScatter` ([#5876](https://github.com/satijalab/seurat/pull/5876))
- Update `Cells` methods to new signature (`x, ...`)
- Replace use of `default.stringsAsFactors()` with `getOption("stringsAsFactors")`

# Seurat 4.1.0 (2022-01-14)
## Added
- Add `raster.dpi` parameter to `DimPlot/FeaturePlot` to optionally rasterize individual points ([#5392](https://github.com/satijalab/seurat/pull/5392))
- Add support for sctransform v2, differential expression on with SCT
- Add support for sctransform v2, differential expression with SCT assay

## Changes
- Update `ReadParseBio` to support split-pipe 0.9.6p ([#5446](https://github.com/satijalab/seurat/pull/5446))
Expand Down
9 changes: 5 additions & 4 deletions R/generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,15 @@ RunPCA <- function(object, ...) {
#' Run Supervised Latent Semantic Indexing
#'
#' Run a supervised LSI (SLSI) dimensionality reduction supervised by a
#' cell-cell kernel. SLSI is used to capture a linear transformation of peaks
#' cell-cell kernel. SLSI is used to capture a linear transformation of peaks
#' that maximizes its dependency to the given cell-cell kernel.
#'
#' @param object An object
#' @param ... Arguments passed to IRLBA irlba
#'
#' @return Returns Seurat object with the SLSI calculation stored in the
#' reductions slot
#'
#'
#' @export
#'
#' @rdname RunSLSI
Expand Down Expand Up @@ -506,8 +506,9 @@ RunTSNE <- function(object, ...) {
#' Run UMAP
#'
#' Runs the Uniform Manifold Approximation and Projection (UMAP) dimensional
#' reduction technique. To run, you must first install the umap-learn python
#' package (e.g. via \code{pip install umap-learn}). Details on this package can be
#' reduction technique. To run using \code{umap.method="umap-learn"}, you must
#' first install the umap-learn python package (e.g. via
#' \code{pip install umap-learn}). Details on this package can be
#' found here: \url{https://github.com/lmcinnes/umap}. For a more in depth
#' discussion of the mathematics underlying UMAP, see the ArXiv paper here:
#' \url{https://arxiv.org/abs/1802.03426}.
Expand Down
25 changes: 16 additions & 9 deletions R/objects.R
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ CreateSCTAssayObject <- function(
#' remove all DimReducs)
#' @param graphs Only keep a subset of Graphs specified here (if NULL, remove
#' all Graphs)
#' @param misc Preserve the \code{misc} slot; default is \code{TRUE}
#'
#' @export
#' @concept objects
Expand All @@ -466,7 +467,8 @@ DietSeurat <- function(
features = NULL,
assays = NULL,
dimreducs = NULL,
graphs = NULL
graphs = NULL,
misc = TRUE
) {
object <- UpdateSlots(object = object)
assays <- assays %||% FilterObjects(object = object, classes.keep = "Assay")
Expand Down Expand Up @@ -508,6 +510,11 @@ DietSeurat <- function(
}
}
}
# remove misc when desired
if (!isTRUE(x = misc)) {
slot(object = object, name = "misc") <- list()
}

# remove unspecified DimReducs and Graphs
all.objects <- FilterObjects(object = object, classes.keep = c('DimReduc', 'Graph'))
objects.to.remove <- all.objects[!all.objects %in% c(dimreducs, graphs)]
Expand Down Expand Up @@ -1301,7 +1308,7 @@ as.sparse.H5Group <- function(x, ...) {
#' @method Cells SCTModel
#' @export
#'
Cells.SCTModel <- function(x) {
Cells.SCTModel <- function(x, ...) {
return(rownames(x = slot(object = x, name = "cell.attributes")))
}

Expand All @@ -1313,7 +1320,7 @@ Cells.SCTModel <- function(x) {
#'
#' @seealso \code{\link[SeuratObject:Cells]{SeuratObject::Cells}}
#'
Cells.SlideSeq <- function(x) {
Cells.SlideSeq <- function(x, ...) {
return(rownames(x = GetTissueCoordinates(object = x)))
}

Expand All @@ -1323,7 +1330,7 @@ Cells.SlideSeq <- function(x) {
#' @method Cells STARmap
#' @export
#'
Cells.STARmap <- function(x) {
Cells.STARmap <- function(x, ...) {
return(rownames(x = GetTissueCoordinates(object = x)))
}

Expand All @@ -1332,7 +1339,7 @@ Cells.STARmap <- function(x) {
#' @method Cells VisiumV1
#' @export
#'
Cells.VisiumV1 <- function(x) {
Cells.VisiumV1 <- function(x, ...) {
return(rownames(x = GetTissueCoordinates(object = x, scale = NULL)))
}

Expand Down Expand Up @@ -2274,7 +2281,7 @@ setMethod(
definition = function(object) {
cat('An AnchorSet object containing', nrow(x = slot(object = object, name = "anchors")),
"anchors between the reference and query Seurat objects. \n",
"This can be used as input to TransferData.")
"This can be used as input to TransferData.\n")
}
)

Expand All @@ -2284,7 +2291,7 @@ setMethod(
definition = function(object) {
cat('An AnchorSet object containing', nrow(x = slot(object = object, name = "anchors")),
"anchors between", length(x = slot(object = object, name = "object.list")), "Seurat objects \n",
"This can be used as input to IntegrateData.")
"This can be used as input to IntegrateData.\n")
}
)

Expand All @@ -2295,7 +2302,7 @@ setMethod(
cat(
'A ModalityWeights object containing modality weights between',
paste(slot(object = object, name = "modality.assay"), collapse = " and "),
"assays \n", "This can be used as input to FindMultiModelNeighbors.")
"assays \n", "This can be used as input to FindMultiModelNeighbors.\n")
}
)

Expand All @@ -2307,7 +2314,7 @@ setMethod(
"An sctransform model.\n",
" Model formula: ", slot(object = object, name = "model"),
"\n Parameters stored for", nrow(x = SCTResults(object = object, slot = "feature.attributes")), "features,",
nrow(x = SCTResults(object = object, slot = "cell.attributes")), "cells")
nrow(x = SCTResults(object = object, slot = "cell.attributes")), "cells.\n")
}
)

Expand Down
21 changes: 17 additions & 4 deletions R/preprocessing.R
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ Read10X_h5 <- function(filename, use.names = TRUE, unique.features = TRUE) {
p = indptr[],
x = as.numeric(x = counts[]),
dims = shp[],
giveCsparse = FALSE
repr = "T"
)
if (unique.features) {
features <- make.unique(names = features)
Expand All @@ -967,7 +967,11 @@ Read10X_h5 <- function(filename, use.names = TRUE, unique.features = TRUE) {
types <- infile[[paste0(genome, '/features/feature_type')]][]
types.unique <- unique(x = types)
if (length(x = types.unique) > 1) {
message("Genome ", genome, " has multiple modalities, returning a list of matrices for this genome")
message(
"Genome ",
genome,
" has multiple modalities, returning a list of matrices for this genome"
)
sparse.mat <- sapply(
X = types.unique,
FUN = function(x) {
Expand Down Expand Up @@ -1103,10 +1107,19 @@ ReadMtx <- function(
"feature list" = features
)
for (i in seq_along(along.with = all.files)) {
uri <- normalizePath(all.files[[i]], mustWork = FALSE)
uri <- tryCatch(
expr = {
con <- url(description = all.files[[i]])
close(con = con)
all.files[[i]]
},
error = function(...) {
return(normalizePath(path = all.files[[i]], winslash = '/'))
}
)
err <- paste("Cannot find", names(x = all.files)[i], "at", uri)
uri <- build_url(url = parse_url(url = uri))
if (grepl(pattern = '^:///', x = uri)) {
if (grepl(pattern = '^[A-Z]?:///', x = uri)) {
uri <- gsub(pattern = '^://', replacement = '', x = uri)
if (!file.exists(uri)) {
stop(err, call. = FALSE)
Expand Down
2 changes: 1 addition & 1 deletion R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,7 @@ as.data.frame.Matrix <- function(
row.names = NULL,
optional = FALSE,
...,
stringsAsFactors = default.stringsAsFactors()
stringsAsFactors = getOption(x = "stringsAsFactors", default = FALSE)
) {
return(as.data.frame(
x = as.matrix(x = x),
Expand Down
37 changes: 25 additions & 12 deletions R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,7 @@ CellScatter <- function(
#' 100,000
#' @param raster.dpi Pixel resolution for rasterized plots, passed to geom_scattermore().
#' Default is c(512, 512).
#' @param jitter Jitter for easier visualization of crowded points
#' @param jitter Jitter for easier visualization of crowded points (default is FALSE)
#'
#' @return A ggplot object
#'
Expand Down Expand Up @@ -1924,7 +1924,7 @@ FeatureScatter <- function(
plot.cor = TRUE,
raster = NULL,
raster.dpi = c(512, 512),
jitter = TRUE
jitter = FALSE
) {
cells <- cells %||% colnames(x = object)
if (isTRUE(x = shuffle)) {
Expand Down Expand Up @@ -2418,7 +2418,7 @@ LinkedDimPlot <- function(
dims = dims,
col.by = group.by,
alpha.by = plot.env$alpha.by
) + scale_alpha_ordinal(range = alpha) + guides(alpha = FALSE)
) + scale_alpha_ordinal(range = alpha) + guides(alpha = "none")
plot.env$dimplot
}
)
Expand Down Expand Up @@ -2555,7 +2555,7 @@ LinkedFeaturePlot <- function(
scale_fill_gradientn(name = feature, colours = cols) +
theme(legend.position = 'top') +
scale_alpha(range = alpha) +
guides(alpha = FALSE)
guides(alpha = "none")
plot.env$spatialplot
}
)
Expand Down Expand Up @@ -2914,7 +2914,7 @@ ISpatialFeaturePlot <- function(
scale_fill_gradientn(name = plot.env$feature, colours = FeaturePalettes[[plot.env$palette]]) +
theme(legend.position = 'top') +
scale_alpha(range = c(input$alpha, 1)) +
guides(alpha = FALSE)
guides(alpha = "none")
plot.env$plot
})
}
Expand Down Expand Up @@ -3232,7 +3232,7 @@ SpatialPlot <- function(
) +
theme(legend.position = 'top') +
scale_alpha(range = alpha) +
guides(alpha = FALSE)
guides(alpha = "none")
} else if (label) {
plot <- LabelClusters(
plot = plot,
Expand Down Expand Up @@ -3286,10 +3286,14 @@ SpatialPlot <- function(
# images = GetImage(object = object, mode = 'plotly', image = images)
# ))
# }
if (length(x = images) > 1 && combine) {
plots <- wrap_plots(plots = plots, ncol = length(x = images))
} else if (length(x = images == 1) && combine) {
plots <- wrap_plots(plots = plots, ncol = ncol)
if (combine) {
if (!is.null(x = ncol)) {
return(wrap_plots(plots = plots, ncol = ncol))
}
if (length(x = images) > 1) {
return(wrap_plots(plots = plots, ncol = length(x = images)))
}
return(wrap_plots(plots = plots))
}
return(plots)
}
Expand Down Expand Up @@ -3542,13 +3546,20 @@ DotPlot <- function(
if (!is.null(x = id.levels)) {
data.plot$id <- factor(x = data.plot$id, levels = id.levels)
}
if (length(x = levels(x = data.plot$id)) == 1) {
ngroup <- length(x = levels(x = data.plot$id))
if (ngroup == 1) {
scale <- FALSE
warning(
"Only one identity present, the expression values will be not scaled",
call. = FALSE,
immediate. = TRUE
)
} else if (ngroup < 5 & scale) {
warning(
"Scaling data with a low number of groups may produce misleading results",
call. = FALSE,
immediate. = TRUE
)
}
avg.exp.scaled <- sapply(
X = unique(x = data.plot$features.plot),
Expand Down Expand Up @@ -7240,8 +7251,9 @@ SingleExIPlot <- function(
if ((nrow(x = data) > 1e5) & !isFALSE(raster)){
message("Rasterizing points since number of points exceeds 100,000.",
"\nTo disable this behavior set `raster=FALSE`")
# change raster to TRUE
raster <- TRUE
}
raster <- TRUE
}
if (!is.null(x = seed.use)) {
set.seed(seed = seed.use)
Expand Down Expand Up @@ -7666,6 +7678,7 @@ SingleSpatialPlot <- function(
colors <- DiscretePalette(length(unique(data[[col.by]])), palette = cols)
scale <- scale_fill_manual(values = colors, na.value = na.value)
} else {
cols <- cols[names(x = cols) %in% data$ident]
scale <- scale_fill_manual(values = cols, na.value = na.value)
}
plot <- plot + scale
Expand Down
24 changes: 19 additions & 5 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
# Seurat v4.1.0
# Seurat v4.1.1

## Test environments
* local Ubuntu 20.04 install, R 4.1.2
* local Ubuntu 20.04 install, R 4.1.3
* Ubuntu 16.04.6 (on travis-ci), R 4.0.0, R devel
* macOS 10.13.6 (on travis-ci), R 4.0.2
* Windows Server 2012 R2 (on AppVeyor), R 4.1.0 Patched
* win-builder (release, devel)

## R CMD check results
There were no ERRORs, WARNINGs, or NOTEs
There were no ERRORs or WARNINGs

There was one NOTE:

* checking CRAN incoming feasibility ... NOTE
Maintainer: 'Paul Hoffman <[email protected]>'

Found the following (possibly) invalid URLs:
URL: https://www.science.org/doi/abs/10.1126/science.aad0501
From: man/cc.genes.Rd
man/cc.genes.updated.2019.Rd
Status: 503
Message: Service Unavailable

This URL is valid and the service still exists. When navigating to the URL either via the documentation or directly, you are taken to the correct article

## Downstream dependencies

There no packages that depend on Seurat

There are sixteen packages that import Seurat: CAMML, CDSeq, CIDER, DR.SC, DUBStepR, PhitestR, Platypus, rPanglaoDB, scDiffCom, scMappR, SCRIP, scRNAstat, Signac, SignacX, SoupX, and tidyseurat; this update does not impact their functionality
There are sixteen packages that import Seurat: CAMML, CIDER, DR.SC, DUBStepR, maple, Platypus, rPanglaoDB, scDiffCom, scMappR, SCRIP, scRNAstat, Signac, SignacX, SoupX, spruce, and tidyseurat; this update does not impact their functionality

There are ten packages that suggest Seurat: BisqueRNA, ClustAssess, clustree, conos, DIscBIO, dyngen, harmony, rliger, Rmagic, and VAM; this update does not impact their functionality.
There are twelve packages that suggest Seurat: BisqueRNA, CIARA, ClustAssess, clustree, conos, DIscBIO, dyngen, harmony, rliger, Rmagic, treefit, and VAM; this update does not impact their functionality.
10 changes: 6 additions & 4 deletions man/Cells.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a1294c4

Please sign in to comment.