Skip to content

Commit 87e2454

Browse files
authored
Merge pull request #2605 from satijalab/develop
Seurat v3.1.3
2 parents 49a1be0 + c772da1 commit 87e2454

25 files changed

+509
-218
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: 3.1.2
3-
Date: 2019-12-12
2+
Version: 3.1.3
3+
Date: 2020-02-07
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>, and Butler A and Satija R (2017) <doi:10.1101/164889> for more details.
66
Authors@R: c(
@@ -57,7 +57,6 @@ Imports:
5757
Rtsne,
5858
scales,
5959
sctransform (>= 0.2.0),
60-
SDMTools,
6160
stats,
6261
tools,
6362
tsne,
@@ -86,6 +85,7 @@ Encoding: UTF-8
8685
biocViews:
8786
Suggests:
8887
loomR,
88+
SDMTools,
8989
testthat,
9090
hdf5r,
9191
S4Vectors,

NAMESPACE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ export(DefaultAssay)
199199
export(DietSeurat)
200200
export(DimHeatmap)
201201
export(DimPlot)
202+
export(DiscretePalette)
202203
export(DoHeatmap)
203204
export(DotPlot)
204205
export(ElbowPlot)
@@ -357,7 +358,6 @@ importFrom(RcppAnnoy,AnnoyEuclidean)
357358
importFrom(RcppAnnoy,AnnoyHamming)
358359
importFrom(RcppAnnoy,AnnoyManhattan)
359360
importFrom(Rtsne,Rtsne)
360-
importFrom(SDMTools,pnt.in.poly)
361361
importFrom(ape,as.phylo)
362362
importFrom(ape,drop.tip)
363363
importFrom(ape,nodelabels)
@@ -379,6 +379,7 @@ importFrom(ggplot2,coord_cartesian)
379379
importFrom(ggplot2,coord_fixed)
380380
importFrom(ggplot2,coord_flip)
381381
importFrom(ggplot2,cut_number)
382+
importFrom(ggplot2,discrete_scale)
382383
importFrom(ggplot2,dup_axis)
383384
importFrom(ggplot2,element_blank)
384385
importFrom(ggplot2,element_line)

NEWS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22
All notable changes to Seurat will be documented in this file.
33
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
44

5+
## [3.1.3] = 2020-02-07
6+
### Added
7+
- New system agnostic `Which` function to address problems with FItSNE on Windows
8+
9+
### Changes
10+
- Export `CellsByIdentities` and `RowMergeSparseMatrices` functions
11+
- nCount and nFeature metadata variables retained after subset and updated properly with `UpdateSeuratObject`
12+
- Fix uwot support for running directly on feature matrices
13+
- Fixes for keys with underscores
14+
- Fix issue with leiden option for `FindClusters`
15+
- Fix for data transfer when using sctransform
16+
- SDMTools moved to Suggests as package is orphaned
517

618
## [3.1.2] - 2019-12-11
719
### Added

R/clustering.R

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -713,29 +713,35 @@ RunLeiden <- function(
713713
call. = FALSE
714714
)
715715
}
716-
if (method %in% c("matrix", "igraph")) {
717-
if (method == "igraph") {
718-
object <- graph_from_adjacency_matrix(adjmatrix = object)
719-
}
720-
} else {
721-
warning(
722-
"method for Leiden recommended as 'matrix' or 'igraph'",
723-
call. = FALSE,
724-
immediate. = TRUE
725-
)
726-
}
727-
input <- if (inherits(x = object, what = 'list')) {
728-
graph_from_adj_list(adjlist = object)
729-
} else if (inherits(x = object, what = c('dgCMatrix', 'matrix', "Matrix"))) {
730-
graph_from_adjacency_matrix(adjmatrix = object)
731-
} else if (inherits(x = object, what = 'igraph')) {
732-
object
733-
} else {
734-
stop(
735-
paste("method for Leiden not found for class", class(x = object)),
736-
call. = FALSE
737-
)
738-
}
716+
switch(
717+
EXPR = method,
718+
"matrix" = {
719+
input <- as(object = object, Class = "matrix")
720+
},
721+
"igraph" = {
722+
input <- if (inherits(x = object, what = 'list')) {
723+
if (is.null(x = weights)) {
724+
graph_from_adj_list(adjlist = object)
725+
} else {
726+
graph_from_adj_list(adjlist = object)
727+
}
728+
} else if (inherits(x = object, what = c('dgCMatrix', 'matrix', "Matrix"))) {
729+
if (is.null(x = weights)) {
730+
graph_from_adjacency_matrix(adjmatrix = object)
731+
} else {
732+
graph_from_adjacency_matrix(adjmatrix = object, weighted = TRUE)
733+
}
734+
} else if (inherits(x = object, what = 'igraph')) {
735+
object
736+
} else {
737+
stop(
738+
"Method for Leiden not found for class", class(x = object),
739+
call. = FALSE
740+
)
741+
}
742+
},
743+
stop("Method for Leiden must be either 'matrix' or igraph'")
744+
)
739745
#run leiden from CRAN package (calls python with reticulate)
740746
partition <- leiden(
741747
object = input,

R/differential_expression.R

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ FindConservedMarkers <- function(
437437
#' @param pseudocount.use Pseudocount to add to averaged expression values when
438438
#' calculating logFC. 1 by default.
439439
#'
440-
#' @importFrom Matrix rowSums
440+
#' @importFrom Matrix rowSums rowMeans
441441
#' @importFrom stats p.adjust
442442
#'
443443
#' @rdname FindMarkers
@@ -540,25 +540,18 @@ FindMarkers.default <- function(
540540
switch(
541541
EXPR = slot,
542542
'data' = function(x) {
543-
return(log(x = mean(x = expm1(x = x)) + pseudocount.use))
543+
return(log(x = rowMeans(x = expm1(x = x)) + pseudocount.use))
544544
},
545545
function(x) {
546-
return(log(x = mean(x = x) + pseudocount.use))
546+
return(log(x = rowMeans(x = x) + pseudocount.use))
547547
}
548548
)
549549
} else {
550-
mean
550+
rowMeans
551551
}
552-
data.1 <- apply(
553-
X = data[features, cells.1, drop = FALSE],
554-
MARGIN = 1,
555-
FUN = mean.fxn
556-
)
557-
data.2 <- apply(
558-
X = data[features, cells.2, drop = FALSE],
559-
MARGIN = 1,
560-
FUN = mean.fxn
561-
)
552+
data.1 <- mean.fxn(data[features, cells.1, drop = FALSE])
553+
data.2 <- mean.fxn(data[features, cells.2, drop = FALSE])
554+
562555
total.diff <- (data.1 - data.2)
563556
if (is.null(x = reduction) && slot != "scale.data") {
564557
features.diff <- if (only.pos) {

R/dimensional_reduction.R

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ RunPCA.default <- function(
861861
return(reduction.data)
862862
}
863863

864-
#' @param features Features to compute PCA on. If features=NULL, PCA will be run
864+
#' @param features Features to compute PCA on. If features=NULL, PCA will be run
865865
#' using the variable features for the Assay. Note that the features must be present
866866
#' in the scaled data. Any requested features that are not scaled or have 0 variance
867867
#' will be dropped, and the PCA will be run using the remaining features.
@@ -1456,10 +1456,30 @@ RunUMAP.Seurat <- function(
14561456
stop("Please specify only one of the following arguments: dims, features, or graph")
14571457
}
14581458
if (!is.null(x = features)) {
1459-
data.use <- t(x = GetAssayData(object = object, slot = 'data', assay = assay)[features, ])
1459+
data.use <- as.matrix(x = t(x = GetAssayData(object = object, slot = 'data', assay = assay)[features, , drop = FALSE]))
1460+
if (ncol(x = data.use) < n.components) {
1461+
stop(
1462+
"Please provide as many or more features than n.components: ",
1463+
length(x = features),
1464+
" features provided, ",
1465+
n.components,
1466+
" UMAP components requested",
1467+
call. = FALSE
1468+
)
1469+
}
14601470
} else if (!is.null(x = dims)) {
14611471
data.use <- Embeddings(object[[reduction]])[, dims]
14621472
assay <- DefaultAssay(object = object[[reduction]])
1473+
if (length(x = dims) < n.components) {
1474+
stop(
1475+
"Please provide as many or more dims than n.components: ",
1476+
length(x = dims),
1477+
" dims provided, ",
1478+
n.components,
1479+
" UMAP components requested",
1480+
call. = FALSE
1481+
)
1482+
}
14631483
} else if (!is.null(x = graph)) {
14641484
data.use <- object[[graph]]
14651485
} else {
@@ -1703,7 +1723,12 @@ fftRtsne <- function(X,
17031723
result_path <- tempfile(pattern = 'fftRtsne_result_', fileext = '.dat')
17041724
}
17051725
if (is.null(x = fast_tsne_path)) {
1706-
suppressWarnings(expr = fast_tsne_path <- system2(command = 'which', args = 'fast_tsne', stdout = TRUE))
1726+
# suppressWarnings(expr = fast_tsne_path <- system2(command = 'which', args = 'fast_tsne', stdout = TRUE))
1727+
fast_tsne_path <- SysExec(progs = ifelse(
1728+
test = .Platform$OS.type == 'windows',
1729+
yes = 'FItSNE.exe',
1730+
no = 'fast_tsne'
1731+
))
17071732
if (length(x = fast_tsne_path) == 0) {
17081733
stop("no fast_tsne_path specified and fast_tsne binary is not in the search path")
17091734
}

R/generics.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -764,9 +764,6 @@ RunALRA <- function(object, ...) {
764764
#'
765765
#' @return Returns a combined Seurat object with the CCA results stored.
766766
#'
767-
#' @rdname RunCCA
768-
#' @export RunCCA
769-
#'
770767
#' @seealso \code{\link{merge.Seurat}}
771768
#'
772769
#' @examples

0 commit comments

Comments
 (0)