Skip to content

Commit af2925c

Browse files
authored
Merge pull request #4529 from satijalab/develop
Seurat v4.0.2
2 parents 4e868fc + 058325f commit af2925c

26 files changed

+1429
-503
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: Seurat
2-
Version: 4.0.1
3-
Date: 2021-03-17
2+
Version: 4.0.2
3+
Date: 2021-05-20
44
Title: Tools for Single Cell Genomics
55
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.
66
Authors@R: c(
@@ -10,7 +10,7 @@ Authors@R: c(
1010
person(given = "Jeff", family = "Farrell", email = "jfarrell@g.harvard.edu", role = "ctb"),
1111
person(given = "Christoph", family = "Hafemeister", email = "chafemeister@nygenome.org", role = "ctb", comment = c(ORCID = "0000-0001-6365-8254")),
1212
person(given = "Yuhan", family = "Hao", email = "yhao@nygenome.org", role = "ctb", comment = c(ORCID = "0000-0002-1810-0822")),
13-
person(given = "Paul", family = "Hoffman", email = "nygcSatijalab@nygenome.org", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7693-8957")),
13+
person(given = "Paul", family = "Hoffman", email = "seurat@nygenome.org", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7693-8957")),
1414
person(given = "Jaison", family = "Jain", email = "jjain@nygenome.org", role = "ctb", comment = c(ORCID = "0000-0002-9478-5018")),
1515
person(given = "Efthymia", family = "Papalexi", email = "epapalexi@nygenome.org", role = "ctb", comment = c(ORCID = "0000-0001-5898-694X")),
1616
person(given = "Patrick", family = "Roelli", email = "proelli@nygenome.org", role = "ctb"),

NAMESPACE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export("Project<-")
117117
export("SCTResults<-")
118118
export("Tool<-")
119119
export("VariableFeatures<-")
120+
export(AddAzimuthResults)
120121
export(AddMetaData)
121122
export(AddModuleScore)
122123
export(AggregateExpression)
@@ -360,6 +361,7 @@ importFrom(MASS,lda)
360361
importFrom(Matrix,as.matrix)
361362
importFrom(Matrix,colMeans)
362363
importFrom(Matrix,colSums)
364+
importFrom(Matrix,crossprod)
363365
importFrom(Matrix,readMM)
364366
importFrom(Matrix,rowMeans)
365367
importFrom(Matrix,rowSums)
@@ -492,6 +494,7 @@ importFrom(ggplot2,guide_legend)
492494
importFrom(ggplot2,guides)
493495
importFrom(ggplot2,labs)
494496
importFrom(ggplot2,layer)
497+
importFrom(ggplot2,layer_scales)
495498
importFrom(ggplot2,margin)
496499
importFrom(ggplot2,position_dodge)
497500
importFrom(ggplot2,position_jitterdodge)

NEWS.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# Seurat 4.0.2 (2020-03-20)
2+
## Added
3+
- New `AddAzimuthScores()` and `AddAzimuthResults()` functions
4+
- Add `shuffle` parameter to `FeatureScatter()` ([#4280](https://github.com/satijalab/seurat/pull/4280))
5+
- Add `lsiproject` and `rpca` options for `FindTransferAnchors()`
6+
- Add `rlsi` option for `FindIntegrationAnchors()`
7+
8+
## Changes
9+
- Preserve feature metadata when converting from `SingleCellExperiment` to `SeuratObject` class
10+
([#4205](https://github.com/satijalab/seurat/issues/4205))
11+
- Preserve multiple assays when converting from `SingleCellExperiment` to `SeuratObject` class
12+
([#3764](https://github.com/satijalab/seurat/issues/3764))
13+
- Fix passing of `score.thresh` parameter in `ScoreJackStraw()` ([#4268](https://github.com/satijalab/seurat/pull/4268))
14+
- Fix FC calculation in `FindMarkers()` non-log transformed data.
15+
- Add umap-learn version >= 0.5.0 compatibility for `RunUMAP()`
16+
- Fix `DotPlot` to use `log1p` when `scale=False`
17+
([#4298](https://github.com/satijalab/seurat/issues/4298))
18+
- Fix split and shuffled `DimPlot`
19+
- Disallow NULL or another length 0 vector for `ident.1` in `FindMarkers()`
20+
- Fix range shift when labeling clusters on a GeomSpatial plot
21+
- Fix SpatialPlot distortion for non-square images.
22+
- Fix future-related warnings in `FindIntegrationAnchors()`
23+
- Fix `fc.name` parameter in `FindMarkers()` ([#4474](https://github.com/satijalab/seurat/issues/4474))
24+
- Deprecate `group.by` parameter in `PlotPerturbScore()` in favor of `mixscape.class`.
25+
126
# Seurat 4.0.1 (2020-03-17)
227
## Added
328
- Add direction option to `PlotClusterTree()`

R/differential_expression.R

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,9 @@ FindMarkers.Seurat <- function(
813813
if (!is.null(x = assay) && !is.null(x = reduction)) {
814814
stop("Please only specify either assay or reduction.")
815815
}
816+
if (length(x = ident.1) == 0) {
817+
stop("At least 1 ident must be specified in `ident.1`")
818+
}
816819
# select which data to use
817820
if (is.null(x = reduction)) {
818821
assay <- assay %||% DefaultAssay(object = object)
@@ -836,6 +839,20 @@ FindMarkers.Seurat <- function(
836839
cells = c(cells$cells.1, cells$cells.2)
837840
)
838841
}
842+
# check normalization method
843+
norm.command <- paste0("NormalizeData.", assay)
844+
if (norm.command %in% Command(object = object) && is.null(x = reduction)) {
845+
norm.method <- Command(
846+
object = object,
847+
command = norm.command,
848+
value = "normalization.method"
849+
)
850+
if (norm.method != "LogNormalize") {
851+
mean.fxn <- function(x) {
852+
return(log(x = rowMeans(x = x) + pseudocount.use, base = base))
853+
}
854+
}
855+
}
839856
de.results <- FindMarkers(
840857
object = data.use,
841858
slot = slot,
@@ -856,6 +873,7 @@ FindMarkers.Seurat <- function(
856873
pseudocount.use = pseudocount.use,
857874
mean.fxn = mean.fxn,
858875
base = base,
876+
fc.name = fc.name,
859877
...
860878
)
861879
return(de.results)
@@ -1617,9 +1635,7 @@ MarkerTest <- function(
16171635
# @param data.use Data to test
16181636
# @param cells.1 Group 1 cells
16191637
# @param cells.2 Group 2 cells
1620-
# @param latent.vars Confounding variables to adjust for in DE test. Default is
1621-
# "nUMI", which adjusts for cellular depth (i.e. cellular detection rate). For
1622-
# non-UMI based data, set to nGene instead.
1638+
# @param latent.vars Confounding variables to adjust for in DE test
16231639
# @param verbose print output
16241640
# @param \dots Additional parameters to zero-inflated regression (zlm) function
16251641
# in MAST
@@ -1630,17 +1646,6 @@ MarkerTest <- function(
16301646
# genes.
16311647
#
16321648
#' @importFrom stats relevel
1633-
#
1634-
# @export
1635-
#
1636-
# @examples
1637-
# \dontrun{
1638-
# data("pbmc_small")
1639-
# pbmc_small
1640-
# MASTDETest(pbmc_small, cells.1 = WhichCells(object = pbmc_small, idents = 1),
1641-
# cells.2 = WhichCells(object = pbmc_small, idents = 2))
1642-
# }
1643-
#
16441649
MASTDETest <- function(
16451650
data.use,
16461651
cells.1,

R/dimensional_reduction.R

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ RunUMAP.Graph <- function(
14331433
reduction.key = 'UMAP_',
14341434
...
14351435
) {
1436-
CheckDots(...)
1436+
#CheckDots(...)
14371437
if (umap.method != 'umap-learn') {
14381438
warning(
14391439
"Running UMAP on Graph objects is only supported using the umap-learn method",
@@ -1465,7 +1465,7 @@ RunUMAP.Graph <- function(
14651465
b <- b %||% ab.params[[2]]
14661466
n.epochs <- n.epochs %||% 0L
14671467
random.state <- sklearn$utils$check_random_state(seed = as.integer(x = seed.use))
1468-
embeddings <- umap$umap_$simplicial_set_embedding(
1468+
umap.args <- list(
14691469
data = data,
14701470
graph = object,
14711471
n_components = n.components,
@@ -1481,6 +1481,18 @@ RunUMAP.Graph <- function(
14811481
metric_kwds = metric.kwds,
14821482
verbose = verbose
14831483
)
1484+
if (numeric_version(x = umap$pkg_resources$get_distribution("umap-learn")$version) >=
1485+
numeric_version(x = "0.5.0")) {
1486+
umap.args <- c(umap.args, list(
1487+
densmap = FALSE,
1488+
densmap_kwds = NULL,
1489+
output_dens = FALSE
1490+
))
1491+
}
1492+
embeddings <- do.call(what = umap$umap_$simplicial_set_embedding, args = umap.args)
1493+
if (length(x = embeddings) == 2) {
1494+
embeddings <- embeddings[[1]]
1495+
}
14841496
rownames(x = embeddings) <- colnames(x = data)
14851497
colnames(x = embeddings) <- paste0("UMAP_", 1:n.components)
14861498
# center the embeddings on zero
@@ -1658,9 +1670,9 @@ RunUMAP.Seurat <- function(
16581670
if (!inherits(x = object[[nn.name]], what = "Neighbor")) {
16591671
stop(
16601672
"Please specify a Neighbor object name, ",
1661-
"instead of the name of a ",
1662-
class(object[[nn.name]]),
1663-
" object",
1673+
"instead of the name of a ",
1674+
class(object[[nn.name]]),
1675+
" object",
16641676
call. = FALSE
16651677
)
16661678
}
@@ -1669,9 +1681,9 @@ RunUMAP.Seurat <- function(
16691681
if (!inherits(x = object[[graph]], what = "Graph")) {
16701682
stop(
16711683
"Please specify a Graph object name, ",
1672-
"instead of the name of a ",
1673-
class(object[[graph]]),
1674-
" object",
1684+
"instead of the name of a ",
1685+
class(object[[graph]]),
1686+
" object",
16751687
call. = FALSE
16761688
)
16771689
}
@@ -1764,7 +1776,7 @@ ScoreJackStraw.DimReduc <- function(object, dims = 1:5, score.thresh = 1e-5, ...
17641776
JS(object = object) <- ScoreJackStraw(
17651777
object = JS(object = object),
17661778
dims = dims,
1767-
score.thresh = 1e-5,
1779+
score.thresh = score.thresh,
17681780
...
17691781
)
17701782
return(object)
@@ -1792,6 +1804,7 @@ ScoreJackStraw.Seurat <- function(
17921804
object[[reduction]] <- ScoreJackStraw(
17931805
object = object[[reduction]],
17941806
dims = dims,
1807+
score.thresh = score.thresh,
17951808
...
17961809
)
17971810
if (do.plot) {

0 commit comments

Comments
 (0)