Skip to content

Commit 13b615c

Browse files
authored
Merge pull request satijalab#4966 from satijalab/develop
Seurat v4.0.4
2 parents 9b38929 + c1591c0 commit 13b615c

28 files changed

+401
-58
lines changed

DESCRIPTION

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: Seurat
2-
Version: 4.0.3
3-
Date: 2021-06-10
2+
Version: 4.0.4
3+
Date: 2021-08-19
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(
@@ -57,7 +57,7 @@ Imports:
5757
png,
5858
RANN,
5959
RColorBrewer,
60-
Rcpp,
60+
Rcpp (>= 1.0.7),
6161
RcppAnnoy (>= 0.0.18),
6262
reticulate,
6363
rlang,

NAMESPACE

+3
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ export(Read10X)
264264
export(Read10X_Image)
265265
export(Read10X_h5)
266266
export(ReadMtx)
267+
export(ReadParseBio)
268+
export(ReadSTARsolo)
267269
export(ReadSlideSeq)
268270
export(Reductions)
269271
export(RegroupIdents)
@@ -501,6 +503,7 @@ importFrom(ggplot2,position_jitterdodge)
501503
importFrom(ggplot2,scale_alpha)
502504
importFrom(ggplot2,scale_alpha_ordinal)
503505
importFrom(ggplot2,scale_color_brewer)
506+
importFrom(ggplot2,scale_color_discrete)
504507
importFrom(ggplot2,scale_color_distiller)
505508
importFrom(ggplot2,scale_color_gradient)
506509
importFrom(ggplot2,scale_color_gradientn)

NEWS.md

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
## Seurat 4.0.4 (2020-08-19)
2+
## Added
3+
- Add `reduction` parameter to `BuildClusterTree()` ([#4598](https://github.com/satijalab/seurat/issues/4598))
4+
- Add DensMAP option to `RunUMAP()` ([#4630](https://github.com/satijalab/seurat/pull/4630))
5+
- Add `image` parameter to `Load10X_Spatial()` and `image.name` parameter to `Read10X_Image()` ([#4641](https://github.com/satijalab/seurat/pull/4641))
6+
- Add `ReadSTARsolo()` function to read output from STARsolo
7+
- Add `densify` parameter to `FindMarkers()`
8+
- Add `ReadParsebio()` function to read output from Parse Biosciences
9+
- Add the `image.alpha` parameter to `SpatialDimPlot()` and `SpatialFeaturePlot()`
10+
11+
## Changes
12+
- Warn and continue rather than erroring if not all features are available in `FindSpatiallyVariableFeatures()` ([#4611](https://github.com/satijalab/seurat/issues/4611))
13+
- Bug fix for SCT-based integration in selecting proper reference model ([#4355](https://github.com/satijalab/seurat/issues/4355))
14+
- Bug fix for reading from absolute paths in ReadMtx ([#4723](https://github.com/satijalab/seurat/issues/4723))
15+
- Bug fix in SingleCellExperiment conversion ([#4633](https://github.com/satijalab/seurat/issues/4633))
16+
- Bug fix in `FindVariableFeatures()` when using `selection.method = "mvp"` and `binning.method = "equal_frequency"` ([#4712](https://github.com/satijalab/seurat/issues/4712))
17+
- Bug fix in `DoHeatmap()` to remove random characters from plot legend([#4660](https://github.com/satijalab/seurat/issues/4660))
18+
- Fix cell renaming in `RunCCA()`
19+
- Fix issue in SingleCellExperiment conversion where the mainExp would not be set properly
20+
- Fix for default dispersion info displayed in `VariableFeaturePlot()`
21+
122
## Seurat 4.0.3 (2020-06-10)
223
## Added
324
- Add `jitter` parameter to `FeatureScatter()`

R/convenience.R

+45
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ SpatialDimPlot <- function(
5252
combine = TRUE,
5353
pt.size.factor = 1.6,
5454
alpha = c(1, 1),
55+
image.alpha = 1,
5556
stroke = 0.25,
5657
label.box = TRUE,
5758
interactive = FALSE,
@@ -74,6 +75,7 @@ SpatialDimPlot <- function(
7475
combine = combine,
7576
pt.size.factor = pt.size.factor,
7677
alpha = alpha,
78+
image.alpha = image.alpha,
7779
stroke = stroke,
7880
label.box = label.box,
7981
interactive = interactive,
@@ -98,6 +100,7 @@ SpatialFeaturePlot <- function(
98100
combine = TRUE,
99101
pt.size.factor = 1.6,
100102
alpha = c(1, 1),
103+
image.alpha = 1,
101104
stroke = 0.25,
102105
interactive = FALSE,
103106
information = NULL
@@ -114,6 +117,7 @@ SpatialFeaturePlot <- function(
114117
combine = combine,
115118
pt.size.factor = pt.size.factor,
116119
alpha = alpha,
120+
image.alpha = image.alpha,
117121
stroke = stroke,
118122
interactive = interactive,
119123
information = information
@@ -171,3 +175,44 @@ SpecificDimPlot <- function(object, ...) {
171175
}
172176
)
173177
}
178+
179+
#' Read output from Parse Biosciences
180+
#'
181+
#' @param data.dir Directory containing the data files
182+
#' @param ... Extra parameters passed to \code{\link{ReadMtx}}
183+
#' @concept convenience
184+
#' @export
185+
#'
186+
ReadParseBio <- function(data.dir, ...) {
187+
mtx <- file.path(data.dir, "DGE.mtx")
188+
cells <- file.path(data.dir, "cell_metadata.csv")
189+
features <- file.path(data.dir, "genes.csv")
190+
return(ReadMtx(
191+
mtx = mtx,
192+
cells = cells,
193+
features = features,
194+
cell.column = 1,
195+
feature.column = 2,
196+
cell.sep = ",",
197+
feature.sep = ",",
198+
skip.cell = 1,
199+
skip.feature = 1,
200+
mtx.transpose = TRUE
201+
))
202+
}
203+
204+
#' Read output from STARsolo
205+
#'
206+
#' @param data.dir Directory containing the data files
207+
#' @param ... Extra parameters passed to \code{\link{ReadMtx}}
208+
#'
209+
#' @rdname ReadSTARsolo
210+
#' @concept convenience
211+
#' @export
212+
#'
213+
ReadSTARsolo <- function(data.dir, ... ) {
214+
mtx <- file.path(data.dir, "matrix.mtx")
215+
cells <- file.path(data.dir, "barcodes.tsv")
216+
features <- file.path(data.dir, "features.tsv")
217+
return(ReadMtx(mtx = mtx, cells = cells, features = features, ...))
218+
}

R/differential_expression.R

+26-9
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ FindAllMarkers <- function(
6464
fc.name = NULL,
6565
base = 2,
6666
return.thresh = 1e-2,
67+
densify = FALSE,
6768
...
6869
) {
6970
MapVals <- function(vec, from, to) {
@@ -139,6 +140,7 @@ FindAllMarkers <- function(
139140
mean.fxn = mean.fxn,
140141
fc.name = fc.name,
141142
base = base,
143+
densify = densify,
142144
...
143145
)
144146
},
@@ -461,6 +463,8 @@ FindConservedMarkers <- function(
461463
#' @param pseudocount.use Pseudocount to add to averaged expression values when
462464
#' calculating logFC. 1 by default.
463465
#' @param fc.results data.frame from FoldChange
466+
#' @param densify Convert the sparse matrix to a dense form before running the DE test. This can provide speedups but might require higher memory; default is FALSE
467+
#'
464468
#'
465469
#' @importFrom Matrix rowMeans
466470
#' @importFrom stats p.adjust
@@ -490,6 +494,7 @@ FindMarkers.default <- function(
490494
min.cells.group = 3,
491495
pseudocount.use = 1,
492496
fc.results = NULL,
497+
densify = FALSE,
493498
...
494499
) {
495500
ValidateCellGroups(
@@ -563,6 +568,7 @@ FindMarkers.default <- function(
563568
verbose = verbose,
564569
min.cells.feature = min.cells.feature,
565570
latent.vars = latent.vars,
571+
densify = densify,
566572
...
567573
)
568574
de.results <- cbind(de.results, fc.results[rownames(x = de.results), , drop = FALSE])
@@ -608,6 +614,7 @@ FindMarkers.Assay <- function(
608614
mean.fxn = NULL,
609615
fc.name = NULL,
610616
base = 2,
617+
densify = FALSE,
611618
...
612619
) {
613620
data.slot <- ifelse(
@@ -652,6 +659,7 @@ FindMarkers.Assay <- function(
652659
min.cells.group = min.cells.group,
653660
pseudocount.use = pseudocount.use,
654661
fc.results = fc.results,
662+
densify = densify,
655663
...
656664
)
657665
return(de.results)
@@ -682,6 +690,7 @@ FindMarkers.DimReduc <- function(
682690
pseudocount.use = 1,
683691
mean.fxn = rowMeans,
684692
fc.name = NULL,
693+
densify = FALSE,
685694
...
686695

687696
) {
@@ -733,6 +742,7 @@ FindMarkers.DimReduc <- function(
733742
verbose = verbose,
734743
min.cells.feature = min.cells.feature,
735744
latent.vars = latent.vars,
745+
densify = densify,
736746
...
737747
)
738748
de.results <- cbind(de.results, fc.results)
@@ -802,6 +812,7 @@ FindMarkers.Seurat <- function(
802812
mean.fxn = NULL,
803813
fc.name = NULL,
804814
base = 2,
815+
densify = FALSE,
805816
...
806817
) {
807818
if (!is.null(x = group.by)) {
@@ -874,6 +885,7 @@ FindMarkers.Seurat <- function(
874885
mean.fxn = mean.fxn,
875886
base = base,
876887
fc.name = fc.name,
888+
densify = densify,
877889
...
878890
)
879891
return(de.results)
@@ -1760,6 +1772,7 @@ PerformDE <- function(
17601772
verbose,
17611773
min.cells.feature,
17621774
latent.vars,
1775+
densify,
17631776
...
17641777
) {
17651778
if (!(test.use %in% DEmethods_latent()) && !is.null(x = latent.vars)) {
@@ -1773,35 +1786,39 @@ PerformDE <- function(
17731786
if (!test.use %in% DEmethods_checkdots()) {
17741787
CheckDots(...)
17751788
}
1789+
data.use <- object[features, c(cells.1, cells.2), drop = FALSE]
1790+
if (densify){
1791+
data.use <- as.matrix(x = data.use)
1792+
}
17761793
de.results <- switch(
17771794
EXPR = test.use,
17781795
'wilcox' = WilcoxDETest(
1779-
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
1796+
data.use = data.use,
17801797
cells.1 = cells.1,
17811798
cells.2 = cells.2,
17821799
verbose = verbose,
17831800
...
17841801
),
17851802
'bimod' = DiffExpTest(
1786-
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
1803+
data.use = data.use,
17871804
cells.1 = cells.1,
17881805
cells.2 = cells.2,
17891806
verbose = verbose
17901807
),
17911808
'roc' = MarkerTest(
1792-
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
1809+
data.use = data.use,
17931810
cells.1 = cells.1,
17941811
cells.2 = cells.2,
17951812
verbose = verbose
17961813
),
17971814
't' = DiffTTest(
1798-
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
1815+
data.use = data.use,
17991816
cells.1 = cells.1,
18001817
cells.2 = cells.2,
18011818
verbose = verbose
18021819
),
18031820
'negbinom' = GLMDETest(
1804-
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
1821+
data.use = data.use,
18051822
cells.1 = cells.1,
18061823
cells.2 = cells.2,
18071824
min.cells = min.cells.feature,
@@ -1810,7 +1827,7 @@ PerformDE <- function(
18101827
verbose = verbose
18111828
),
18121829
'poisson' = GLMDETest(
1813-
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
1830+
data.use = data.use,
18141831
cells.1 = cells.1,
18151832
cells.2 = cells.2,
18161833
min.cells = min.cells.feature,
@@ -1819,22 +1836,22 @@ PerformDE <- function(
18191836
verbose = verbose
18201837
),
18211838
'MAST' = MASTDETest(
1822-
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
1839+
data.use = data.use,
18231840
cells.1 = cells.1,
18241841
cells.2 = cells.2,
18251842
latent.vars = latent.vars,
18261843
verbose = verbose,
18271844
...
18281845
),
18291846
"DESeq2" = DESeq2DETest(
1830-
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
1847+
data.use = data.use,
18311848
cells.1 = cells.1,
18321849
cells.2 = cells.2,
18331850
verbose = verbose,
18341851
...
18351852
),
18361853
"LR" = LRDETest(
1837-
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
1854+
data.use = data.use,
18381855
cells.1 = cells.1,
18391856
cells.2 = cells.2,
18401857
latent.vars = latent.vars,

0 commit comments

Comments
 (0)