Skip to content

Commit

Permalink
Merge pull request #4966 from satijalab/develop
Browse files Browse the repository at this point in the history
Seurat v4.0.4
  • Loading branch information
mojaveazure committed Aug 27, 2021
2 parents 9b38929 + c1591c0 commit 13b615c
Show file tree
Hide file tree
Showing 28 changed files with 401 additions and 58 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: Seurat
Version: 4.0.3
Date: 2021-06-10
Version: 4.0.4
Date: 2021-08-19
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 @@ -57,7 +57,7 @@ Imports:
png,
RANN,
RColorBrewer,
Rcpp,
Rcpp (>= 1.0.7),
RcppAnnoy (>= 0.0.18),
reticulate,
rlang,
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Expand Up @@ -264,6 +264,8 @@ export(Read10X)
export(Read10X_Image)
export(Read10X_h5)
export(ReadMtx)
export(ReadParseBio)
export(ReadSTARsolo)
export(ReadSlideSeq)
export(Reductions)
export(RegroupIdents)
Expand Down Expand Up @@ -501,6 +503,7 @@ importFrom(ggplot2,position_jitterdodge)
importFrom(ggplot2,scale_alpha)
importFrom(ggplot2,scale_alpha_ordinal)
importFrom(ggplot2,scale_color_brewer)
importFrom(ggplot2,scale_color_discrete)
importFrom(ggplot2,scale_color_distiller)
importFrom(ggplot2,scale_color_gradient)
importFrom(ggplot2,scale_color_gradientn)
Expand Down
21 changes: 21 additions & 0 deletions NEWS.md
@@ -1,3 +1,24 @@
## Seurat 4.0.4 (2020-08-19)
## Added
- Add `reduction` parameter to `BuildClusterTree()` ([#4598](https://github.com/satijalab/seurat/issues/4598))
- Add DensMAP option to `RunUMAP()` ([#4630](https://github.com/satijalab/seurat/pull/4630))
- Add `image` parameter to `Load10X_Spatial()` and `image.name` parameter to `Read10X_Image()` ([#4641](https://github.com/satijalab/seurat/pull/4641))
- Add `ReadSTARsolo()` function to read output from STARsolo
- Add `densify` parameter to `FindMarkers()`
- Add `ReadParsebio()` function to read output from Parse Biosciences
- Add the `image.alpha` parameter to `SpatialDimPlot()` and `SpatialFeaturePlot()`

## Changes
- Warn and continue rather than erroring if not all features are available in `FindSpatiallyVariableFeatures()` ([#4611](https://github.com/satijalab/seurat/issues/4611))
- Bug fix for SCT-based integration in selecting proper reference model ([#4355](https://github.com/satijalab/seurat/issues/4355))
- Bug fix for reading from absolute paths in ReadMtx ([#4723](https://github.com/satijalab/seurat/issues/4723))
- Bug fix in SingleCellExperiment conversion ([#4633](https://github.com/satijalab/seurat/issues/4633))
- Bug fix in `FindVariableFeatures()` when using `selection.method = "mvp"` and `binning.method = "equal_frequency"` ([#4712](https://github.com/satijalab/seurat/issues/4712))
- Bug fix in `DoHeatmap()` to remove random characters from plot legend([#4660](https://github.com/satijalab/seurat/issues/4660))
- Fix cell renaming in `RunCCA()`
- Fix issue in SingleCellExperiment conversion where the mainExp would not be set properly
- Fix for default dispersion info displayed in `VariableFeaturePlot()`

## Seurat 4.0.3 (2020-06-10)
## Added
- Add `jitter` parameter to `FeatureScatter()`
Expand Down
45 changes: 45 additions & 0 deletions R/convenience.R
Expand Up @@ -52,6 +52,7 @@ SpatialDimPlot <- function(
combine = TRUE,
pt.size.factor = 1.6,
alpha = c(1, 1),
image.alpha = 1,
stroke = 0.25,
label.box = TRUE,
interactive = FALSE,
Expand All @@ -74,6 +75,7 @@ SpatialDimPlot <- function(
combine = combine,
pt.size.factor = pt.size.factor,
alpha = alpha,
image.alpha = image.alpha,
stroke = stroke,
label.box = label.box,
interactive = interactive,
Expand All @@ -98,6 +100,7 @@ SpatialFeaturePlot <- function(
combine = TRUE,
pt.size.factor = 1.6,
alpha = c(1, 1),
image.alpha = 1,
stroke = 0.25,
interactive = FALSE,
information = NULL
Expand All @@ -114,6 +117,7 @@ SpatialFeaturePlot <- function(
combine = combine,
pt.size.factor = pt.size.factor,
alpha = alpha,
image.alpha = image.alpha,
stroke = stroke,
interactive = interactive,
information = information
Expand Down Expand Up @@ -171,3 +175,44 @@ SpecificDimPlot <- function(object, ...) {
}
)
}

#' Read output from Parse Biosciences
#'
#' @param data.dir Directory containing the data files
#' @param ... Extra parameters passed to \code{\link{ReadMtx}}
#' @concept convenience
#' @export
#'
ReadParseBio <- function(data.dir, ...) {
mtx <- file.path(data.dir, "DGE.mtx")
cells <- file.path(data.dir, "cell_metadata.csv")
features <- file.path(data.dir, "genes.csv")
return(ReadMtx(
mtx = mtx,
cells = cells,
features = features,
cell.column = 1,
feature.column = 2,
cell.sep = ",",
feature.sep = ",",
skip.cell = 1,
skip.feature = 1,
mtx.transpose = TRUE
))
}

#' Read output from STARsolo
#'
#' @param data.dir Directory containing the data files
#' @param ... Extra parameters passed to \code{\link{ReadMtx}}
#'
#' @rdname ReadSTARsolo
#' @concept convenience
#' @export
#'
ReadSTARsolo <- function(data.dir, ... ) {
mtx <- file.path(data.dir, "matrix.mtx")
cells <- file.path(data.dir, "barcodes.tsv")
features <- file.path(data.dir, "features.tsv")
return(ReadMtx(mtx = mtx, cells = cells, features = features, ...))
}
35 changes: 26 additions & 9 deletions R/differential_expression.R
Expand Up @@ -64,6 +64,7 @@ FindAllMarkers <- function(
fc.name = NULL,
base = 2,
return.thresh = 1e-2,
densify = FALSE,
...
) {
MapVals <- function(vec, from, to) {
Expand Down Expand Up @@ -139,6 +140,7 @@ FindAllMarkers <- function(
mean.fxn = mean.fxn,
fc.name = fc.name,
base = base,
densify = densify,
...
)
},
Expand Down Expand Up @@ -461,6 +463,8 @@ FindConservedMarkers <- function(
#' @param pseudocount.use Pseudocount to add to averaged expression values when
#' calculating logFC. 1 by default.
#' @param fc.results data.frame from FoldChange
#' @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
#'
#'
#' @importFrom Matrix rowMeans
#' @importFrom stats p.adjust
Expand Down Expand Up @@ -490,6 +494,7 @@ FindMarkers.default <- function(
min.cells.group = 3,
pseudocount.use = 1,
fc.results = NULL,
densify = FALSE,
...
) {
ValidateCellGroups(
Expand Down Expand Up @@ -563,6 +568,7 @@ FindMarkers.default <- function(
verbose = verbose,
min.cells.feature = min.cells.feature,
latent.vars = latent.vars,
densify = densify,
...
)
de.results <- cbind(de.results, fc.results[rownames(x = de.results), , drop = FALSE])
Expand Down Expand Up @@ -608,6 +614,7 @@ FindMarkers.Assay <- function(
mean.fxn = NULL,
fc.name = NULL,
base = 2,
densify = FALSE,
...
) {
data.slot <- ifelse(
Expand Down Expand Up @@ -652,6 +659,7 @@ FindMarkers.Assay <- function(
min.cells.group = min.cells.group,
pseudocount.use = pseudocount.use,
fc.results = fc.results,
densify = densify,
...
)
return(de.results)
Expand Down Expand Up @@ -682,6 +690,7 @@ FindMarkers.DimReduc <- function(
pseudocount.use = 1,
mean.fxn = rowMeans,
fc.name = NULL,
densify = FALSE,
...

) {
Expand Down Expand Up @@ -733,6 +742,7 @@ FindMarkers.DimReduc <- function(
verbose = verbose,
min.cells.feature = min.cells.feature,
latent.vars = latent.vars,
densify = densify,
...
)
de.results <- cbind(de.results, fc.results)
Expand Down Expand Up @@ -802,6 +812,7 @@ FindMarkers.Seurat <- function(
mean.fxn = NULL,
fc.name = NULL,
base = 2,
densify = FALSE,
...
) {
if (!is.null(x = group.by)) {
Expand Down Expand Up @@ -874,6 +885,7 @@ FindMarkers.Seurat <- function(
mean.fxn = mean.fxn,
base = base,
fc.name = fc.name,
densify = densify,
...
)
return(de.results)
Expand Down Expand Up @@ -1760,6 +1772,7 @@ PerformDE <- function(
verbose,
min.cells.feature,
latent.vars,
densify,
...
) {
if (!(test.use %in% DEmethods_latent()) && !is.null(x = latent.vars)) {
Expand All @@ -1773,35 +1786,39 @@ PerformDE <- function(
if (!test.use %in% DEmethods_checkdots()) {
CheckDots(...)
}
data.use <- object[features, c(cells.1, cells.2), drop = FALSE]
if (densify){
data.use <- as.matrix(x = data.use)
}
de.results <- switch(
EXPR = test.use,
'wilcox' = WilcoxDETest(
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
data.use = data.use,
cells.1 = cells.1,
cells.2 = cells.2,
verbose = verbose,
...
),
'bimod' = DiffExpTest(
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
data.use = data.use,
cells.1 = cells.1,
cells.2 = cells.2,
verbose = verbose
),
'roc' = MarkerTest(
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
data.use = data.use,
cells.1 = cells.1,
cells.2 = cells.2,
verbose = verbose
),
't' = DiffTTest(
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
data.use = data.use,
cells.1 = cells.1,
cells.2 = cells.2,
verbose = verbose
),
'negbinom' = GLMDETest(
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
data.use = data.use,
cells.1 = cells.1,
cells.2 = cells.2,
min.cells = min.cells.feature,
Expand All @@ -1810,7 +1827,7 @@ PerformDE <- function(
verbose = verbose
),
'poisson' = GLMDETest(
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
data.use = data.use,
cells.1 = cells.1,
cells.2 = cells.2,
min.cells = min.cells.feature,
Expand All @@ -1819,22 +1836,22 @@ PerformDE <- function(
verbose = verbose
),
'MAST' = MASTDETest(
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
data.use = data.use,
cells.1 = cells.1,
cells.2 = cells.2,
latent.vars = latent.vars,
verbose = verbose,
...
),
"DESeq2" = DESeq2DETest(
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
data.use = data.use,
cells.1 = cells.1,
cells.2 = cells.2,
verbose = verbose,
...
),
"LR" = LRDETest(
data.use = object[features, c(cells.1, cells.2), drop = FALSE],
data.use = data.use,
cells.1 = cells.1,
cells.2 = cells.2,
latent.vars = latent.vars,
Expand Down

0 comments on commit 13b615c

Please sign in to comment.