Skip to content

Commit

Permalink
Merge pull request #4529 from satijalab/develop
Browse files Browse the repository at this point in the history
Seurat v4.0.2
  • Loading branch information
rsatija authored May 24, 2021
2 parents 4e868fc + 058325f commit af2925c
Show file tree
Hide file tree
Showing 26 changed files with 1,429 additions and 503 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.0.1
Date: 2021-03-17
Version: 4.0.2
Date: 2021-05-20
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 All @@ -10,7 +10,7 @@ Authors@R: c(
person(given = "Jeff", family = "Farrell", email = "[email protected]", role = "ctb"),
person(given = "Christoph", family = "Hafemeister", email = "[email protected]", role = "ctb", comment = c(ORCID = "0000-0001-6365-8254")),
person(given = "Yuhan", family = "Hao", email = "[email protected]", role = "ctb", comment = c(ORCID = "0000-0002-1810-0822")),
person(given = "Paul", family = "Hoffman", email = "nygcSatijalab@nygenome.org", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7693-8957")),
person(given = "Paul", family = "Hoffman", email = "seurat@nygenome.org", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7693-8957")),
person(given = "Jaison", family = "Jain", email = "[email protected]", role = "ctb", comment = c(ORCID = "0000-0002-9478-5018")),
person(given = "Efthymia", family = "Papalexi", email = "[email protected]", role = "ctb", comment = c(ORCID = "0000-0001-5898-694X")),
person(given = "Patrick", family = "Roelli", email = "[email protected]", role = "ctb"),
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export("Project<-")
export("SCTResults<-")
export("Tool<-")
export("VariableFeatures<-")
export(AddAzimuthResults)
export(AddMetaData)
export(AddModuleScore)
export(AggregateExpression)
Expand Down Expand Up @@ -360,6 +361,7 @@ importFrom(MASS,lda)
importFrom(Matrix,as.matrix)
importFrom(Matrix,colMeans)
importFrom(Matrix,colSums)
importFrom(Matrix,crossprod)
importFrom(Matrix,readMM)
importFrom(Matrix,rowMeans)
importFrom(Matrix,rowSums)
Expand Down Expand Up @@ -492,6 +494,7 @@ importFrom(ggplot2,guide_legend)
importFrom(ggplot2,guides)
importFrom(ggplot2,labs)
importFrom(ggplot2,layer)
importFrom(ggplot2,layer_scales)
importFrom(ggplot2,margin)
importFrom(ggplot2,position_dodge)
importFrom(ggplot2,position_jitterdodge)
Expand Down
25 changes: 25 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# Seurat 4.0.2 (2020-03-20)
## Added
- New `AddAzimuthScores()` and `AddAzimuthResults()` functions
- Add `shuffle` parameter to `FeatureScatter()` ([#4280](https://github.com/satijalab/seurat/pull/4280))
- Add `lsiproject` and `rpca` options for `FindTransferAnchors()`
- Add `rlsi` option for `FindIntegrationAnchors()`

## Changes
- Preserve feature metadata when converting from `SingleCellExperiment` to `SeuratObject` class
([#4205](https://github.com/satijalab/seurat/issues/4205))
- Preserve multiple assays when converting from `SingleCellExperiment` to `SeuratObject` class
([#3764](https://github.com/satijalab/seurat/issues/3764))
- Fix passing of `score.thresh` parameter in `ScoreJackStraw()` ([#4268](https://github.com/satijalab/seurat/pull/4268))
- Fix FC calculation in `FindMarkers()` non-log transformed data.
- Add umap-learn version >= 0.5.0 compatibility for `RunUMAP()`
- Fix `DotPlot` to use `log1p` when `scale=False`
([#4298](https://github.com/satijalab/seurat/issues/4298))
- Fix split and shuffled `DimPlot`
- Disallow NULL or another length 0 vector for `ident.1` in `FindMarkers()`
- Fix range shift when labeling clusters on a GeomSpatial plot
- Fix SpatialPlot distortion for non-square images.
- Fix future-related warnings in `FindIntegrationAnchors()`
- Fix `fc.name` parameter in `FindMarkers()` ([#4474](https://github.com/satijalab/seurat/issues/4474))
- Deprecate `group.by` parameter in `PlotPerturbScore()` in favor of `mixscape.class`.

# Seurat 4.0.1 (2020-03-17)
## Added
- Add direction option to `PlotClusterTree()`
Expand Down
33 changes: 19 additions & 14 deletions R/differential_expression.R
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,9 @@ FindMarkers.Seurat <- function(
if (!is.null(x = assay) && !is.null(x = reduction)) {
stop("Please only specify either assay or reduction.")
}
if (length(x = ident.1) == 0) {
stop("At least 1 ident must be specified in `ident.1`")
}
# select which data to use
if (is.null(x = reduction)) {
assay <- assay %||% DefaultAssay(object = object)
Expand All @@ -836,6 +839,20 @@ FindMarkers.Seurat <- function(
cells = c(cells$cells.1, cells$cells.2)
)
}
# check normalization method
norm.command <- paste0("NormalizeData.", assay)
if (norm.command %in% Command(object = object) && is.null(x = reduction)) {
norm.method <- Command(
object = object,
command = norm.command,
value = "normalization.method"
)
if (norm.method != "LogNormalize") {
mean.fxn <- function(x) {
return(log(x = rowMeans(x = x) + pseudocount.use, base = base))
}
}
}
de.results <- FindMarkers(
object = data.use,
slot = slot,
Expand All @@ -856,6 +873,7 @@ FindMarkers.Seurat <- function(
pseudocount.use = pseudocount.use,
mean.fxn = mean.fxn,
base = base,
fc.name = fc.name,
...
)
return(de.results)
Expand Down Expand Up @@ -1617,9 +1635,7 @@ MarkerTest <- function(
# @param data.use Data to test
# @param cells.1 Group 1 cells
# @param cells.2 Group 2 cells
# @param latent.vars Confounding variables to adjust for in DE test. Default is
# "nUMI", which adjusts for cellular depth (i.e. cellular detection rate). For
# non-UMI based data, set to nGene instead.
# @param latent.vars Confounding variables to adjust for in DE test
# @param verbose print output
# @param \dots Additional parameters to zero-inflated regression (zlm) function
# in MAST
Expand All @@ -1630,17 +1646,6 @@ MarkerTest <- function(
# genes.
#
#' @importFrom stats relevel
#
# @export
#
# @examples
# \dontrun{
# data("pbmc_small")
# pbmc_small
# MASTDETest(pbmc_small, cells.1 = WhichCells(object = pbmc_small, idents = 1),
# cells.2 = WhichCells(object = pbmc_small, idents = 2))
# }
#
MASTDETest <- function(
data.use,
cells.1,
Expand Down
31 changes: 22 additions & 9 deletions R/dimensional_reduction.R
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ RunUMAP.Graph <- function(
reduction.key = 'UMAP_',
...
) {
CheckDots(...)
#CheckDots(...)
if (umap.method != 'umap-learn') {
warning(
"Running UMAP on Graph objects is only supported using the umap-learn method",
Expand Down Expand Up @@ -1465,7 +1465,7 @@ RunUMAP.Graph <- function(
b <- b %||% ab.params[[2]]
n.epochs <- n.epochs %||% 0L
random.state <- sklearn$utils$check_random_state(seed = as.integer(x = seed.use))
embeddings <- umap$umap_$simplicial_set_embedding(
umap.args <- list(
data = data,
graph = object,
n_components = n.components,
Expand All @@ -1481,6 +1481,18 @@ RunUMAP.Graph <- function(
metric_kwds = metric.kwds,
verbose = verbose
)
if (numeric_version(x = umap$pkg_resources$get_distribution("umap-learn")$version) >=
numeric_version(x = "0.5.0")) {
umap.args <- c(umap.args, list(
densmap = FALSE,
densmap_kwds = NULL,
output_dens = FALSE
))
}
embeddings <- do.call(what = umap$umap_$simplicial_set_embedding, args = umap.args)
if (length(x = embeddings) == 2) {
embeddings <- embeddings[[1]]
}
rownames(x = embeddings) <- colnames(x = data)
colnames(x = embeddings) <- paste0("UMAP_", 1:n.components)
# center the embeddings on zero
Expand Down Expand Up @@ -1658,9 +1670,9 @@ RunUMAP.Seurat <- function(
if (!inherits(x = object[[nn.name]], what = "Neighbor")) {
stop(
"Please specify a Neighbor object name, ",
"instead of the name of a ",
class(object[[nn.name]]),
" object",
"instead of the name of a ",
class(object[[nn.name]]),
" object",
call. = FALSE
)
}
Expand All @@ -1669,9 +1681,9 @@ RunUMAP.Seurat <- function(
if (!inherits(x = object[[graph]], what = "Graph")) {
stop(
"Please specify a Graph object name, ",
"instead of the name of a ",
class(object[[graph]]),
" object",
"instead of the name of a ",
class(object[[graph]]),
" object",
call. = FALSE
)
}
Expand Down Expand Up @@ -1764,7 +1776,7 @@ ScoreJackStraw.DimReduc <- function(object, dims = 1:5, score.thresh = 1e-5, ...
JS(object = object) <- ScoreJackStraw(
object = JS(object = object),
dims = dims,
score.thresh = 1e-5,
score.thresh = score.thresh,
...
)
return(object)
Expand Down Expand Up @@ -1792,6 +1804,7 @@ ScoreJackStraw.Seurat <- function(
object[[reduction]] <- ScoreJackStraw(
object = object[[reduction]],
dims = dims,
score.thresh = score.thresh,
...
)
if (do.plot) {
Expand Down
Loading

0 comments on commit af2925c

Please sign in to comment.