Skip to content

Commit

Permalink
Merge pull request #2122 from satijalab/develop
Browse files Browse the repository at this point in the history
Seurat v3.1.1
  • Loading branch information
satijalab committed Oct 4, 2019
2 parents c9f2660 + fb1080f commit fc4a4f5
Show file tree
Hide file tree
Showing 23 changed files with 703 additions and 81 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Expand Up @@ -4,6 +4,7 @@
.git
.travis.yml
appveyor.yml
azure-pipelines.yml
cran-comments.md
travis_setup.sh
CODE_OF_CONDUCT.md
6 changes: 4 additions & 2 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: Seurat
Version: 3.1.0
Date: 2019-08-20
Version: 3.1.1
Date: 2019-09-23
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>, and Butler A and Satija R (2017) <doi:10.1101/164889> for more details.
Authors@R: c(
Expand Down Expand Up @@ -33,6 +33,7 @@ Imports:
graphics,
grDevices,
grid,
httr,
ica,
igraph,
irlba,
Expand Down Expand Up @@ -91,6 +92,7 @@ Suggests:
SingleCellExperiment,
MAST,
DESeq2,
BiocGenerics,
GenomicRanges,
GenomeInfoDb,
IRanges,
Expand Down
8 changes: 8 additions & 0 deletions NAMESPACE
Expand Up @@ -212,6 +212,7 @@ export(FindNeighbors)
export(FindTransferAnchors)
export(FindVariableFeatures)
export(FontSize)
export(GeneSymbolThesarus)
export(GetAssay)
export(GetAssayData)
export(GetIntegrationData)
Expand Down Expand Up @@ -262,6 +263,7 @@ export(ReadAlevin)
export(ReadAlevinCsv)
export(ReadH5AD)
export(Reductions)
export(RegroupIdents)
export(RelativeCounts)
export(RenameCells)
export(RenameIdents)
Expand Down Expand Up @@ -301,6 +303,7 @@ export(TopFeatures)
export(TransferData)
export(UMAPPlot)
export(UpdateSeuratObject)
export(UpdateSymbolList)
export(VariableFeaturePlot)
export(VariableFeatures)
export(VizDimLoadings)
Expand Down Expand Up @@ -438,6 +441,11 @@ importFrom(graphics,smoothScatter)
importFrom(grid,grobName)
importFrom(grid,grobTree)
importFrom(grid,unit)
importFrom(httr,GET)
importFrom(httr,accept_json)
importFrom(httr,content)
importFrom(httr,status_code)
importFrom(httr,timeout)
importFrom(ica,icafast)
importFrom(ica,icaimax)
importFrom(ica,icajade)
Expand Down
20 changes: 18 additions & 2 deletions NEWS.md
Expand Up @@ -2,10 +2,26 @@
All notable changes to Seurat will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)


## [3.1.1] - 2019-09-20
### Added
- New `RegroupIdents` function to reassign idents based on metadata column majority
- `UpdateSymbolList` function to pull new gene names from HGNC
- Added support for H5AD layers as additional assays in a `Seurat` object

### Changed
- Fix rownames issue when running UMAP on dist object
- Add support for new H5AD `obsm` and `varm` stucture
- Fix issue when trying to read non-existent feature-level metadata from an H5AD file
- Fix in integration workflow when using SCTransform
- Improved error checking for `AddModuleScore`
- cbind fix in reference-based integration (`MapQuery`)
- Fix for convenience plots error hanging
- Ensure Seurat objects aren't stored in the command logs

## [3.1.0] - 2019-08-20
### Added
- New `PrepSCTIntegrati
- on` function to facilitate integration after `SCTransform`
- New `PrepSCTIntegration` function to facilitate integration after `SCTransform`
- Reference-based integration with the `reference` parameter in `FindIntegrationAnchors`
- Reciprocal PCA as a `reduction` option in `FindIntegrationAnchors`
- New `CollapseEmbeddingOutliers` function
Expand Down
7 changes: 6 additions & 1 deletion R/convenience.R
Expand Up @@ -68,5 +68,10 @@ SpecificDimPlot <- function(object, ...) {
)
reduc <- grep(pattern = DefaultAssay(object = object), x = reduc, value = TRUE)
args$reduction <- ifelse(test = length(x = reduc) == 1, yes = reduc, no = name)
return(do.call(what = 'DimPlot', args = args))
tryCatch(
expr = return(do.call(what = 'DimPlot', args = args)),
error = function(e) {
stop(e)
}
)
}
47 changes: 45 additions & 2 deletions R/data.R
Expand Up @@ -7,9 +7,51 @@
#' \item{s.genes}{Genes associated with S-phase}
#' \item{g2m.genes}{Genes associated with G2M-phase}
#' }
#' @source http://science.sciencemag.org/content/352/6282/189
#' @source \url{http://science.sciencemag.org/content/352/6282/189}
#'
"cc.genes"

#' Cell cycle genes: 2019 update
#'
#' A list of genes used in cell-cycle regression, updated with 2019 symbols
#'
#' @section Updated symbols:
#' The following symbols were updated from \code{\link{cc.genes}}
#' \describe{
#' \item{s.genes}{
#' \itemize{
#' \item \emph{MCM2}: \emph{MCM7}
#' \item \emph{MLF1IP}: \emph{CENPU}
#' \item \emph{RPA2}: \emph{POLR1B}
#' \item \emph{BRIP1}: \emph{MRPL36}
#' }
#' }
#' \item{g2m.genes}{
#' \itemize{
#' \item \emph{FAM64A}: \emph{PIMREG}
#' \item \emph{HN1}: \emph{JPT1}
#' }
#' }
#' }
#'
#' @format A list of two vectors
#' \describe{
#' \item{s.genes}{Genes associated with S-phase}
#' \item{g2m.genes}{Genes associated with G2M-phase}
#' }
#' @source \url{http://science.sciencemag.org/content/352/6282/189}
#'
#' @seealso \code{\link{cc.genes}}
#'
#' @examples
#' \dontrun{
#' cc.genes.updated.2019 <- cc.genes
#' cc.genes.updated.2019$s.genes <- UpdateSymbolList(symbols = cc.genes.updated.2019$s.genes)
#' cc.genes.updated.2019$g2m.genes <- UpdateSymbolList(symbols = cc.genes.updated.2019$g2m.genes)
#' }
#'
"cc.genes.updated.2019"

#' A small example version of the PBMC dataset
#'
#' A subsetted version of 10X Genomics' 3k PBMC dataset
Expand All @@ -32,5 +74,6 @@
#' \item{version}{Seurat version used to create the object}
#' \item{commands}{Command history}
#' }
#' @source https://support.10xgenomics.com/single-cell-gene-expression/datasets/1.1.0/pbmc3k
#' @source \url{https://support.10xgenomics.com/single-cell-gene-expression/datasets/1.1.0/pbmc3k}
#'
"pbmc_small"
16 changes: 14 additions & 2 deletions R/dimensional_reduction.R
Expand Up @@ -1152,6 +1152,7 @@ RunUMAP.default <- function(
negative.sample.rate = 5,
a = NULL,
b = NULL,
uwot.sgd = FALSE,
seed.use = 42,
metric.kwds = NULL,
angular.rp.forest = FALSE,
Expand All @@ -1162,7 +1163,6 @@ RunUMAP.default <- function(
CheckDots(...)
if (!is.null(x = seed.use)) {
set.seed(seed = seed.use)
py_set_seed(seed = seed.use)
}
if (umap.method != 'umap-learn' && getOption('Seurat.warn.umap.uwot', TRUE)) {
warning(
Expand All @@ -1180,6 +1180,9 @@ RunUMAP.default <- function(
if (!py_module_available(module = 'umap')) {
stop("Cannot find UMAP, please install through pip (e.g. pip install umap-learn).")
}
if (!is.null(x = seed.use)) {
py_set_seed(seed = seed.use)
}
if (typeof(x = n.epochs) == "double") {
n.epochs <- as.integer(x = n.epochs)
}
Expand Down Expand Up @@ -1229,13 +1232,18 @@ RunUMAP.default <- function(
negative_sample_rate = negative.sample.rate,
a = a,
b = b,
fast_sgd = uwot.sgd,
verbose = verbose
)
},
stop("Unknown umap method: ", umap.method, call. = FALSE)
)
colnames(x = umap.output) <- paste0(reduction.key, 1:ncol(x = umap.output))
rownames(x = umap.output) <- rownames(x = object)
if (inherits(x = object, what = 'dist')) {
rownames(x = umap.output) <- attr(x = object, "Labels")
} else {
rownames(x = umap.output) <- rownames(x = object)
}
umap.reduction <- CreateDimReducObject(
embeddings = umap.output,
key = reduction.key,
Expand Down Expand Up @@ -1264,6 +1272,7 @@ RunUMAP.Graph <- function(
negative.sample.rate = 5L,
a = NULL,
b = NULL,
uwot.sgd = FALSE,
seed.use = 42L,
metric.kwds = NULL,
verbose = TRUE,
Expand Down Expand Up @@ -1379,6 +1388,7 @@ RunUMAP.Graph <- function(
#' @param b More specific parameters controlling the embedding. If NULL, these values are set
#' automatically as determined by min. dist and spread. Parameter of differentiable approximation of
#' right adjoint functor.
#' @param uwot.sgd Set \code{uwot::umap(fast_sgd = TRUE)}; see \code{\link[uwot]{umap}} for more details
#' @param metric.kwds A dictionary of arguments to pass on to the metric, such as the p value for
#' Minkowski distance. If NULL then no arguments are passed on.
#' @param angular.rp.forest Whether to use an angular random projection forest to initialise the
Expand Down Expand Up @@ -1417,6 +1427,7 @@ RunUMAP.Seurat <- function(
negative.sample.rate = 5L,
a = NULL,
b = NULL,
uwot.sgd = FALSE,
seed.use = 42L,
metric.kwds = NULL,
angular.rp.forest = FALSE,
Expand Down Expand Up @@ -1456,6 +1467,7 @@ RunUMAP.Seurat <- function(
negative.sample.rate = negative.sample.rate,
a = a,
b = b,
uwot.sgd = uwot.sgd,
seed.use = seed.use,
metric.kwds = metric.kwds,
angular.rp.forest = angular.rp.forest,
Expand Down
6 changes: 3 additions & 3 deletions R/integration.R
Expand Up @@ -674,6 +674,7 @@ IntegrateData <- function(
data = GetAssayData(object = object.list[[i]], assay = assay, slot = "scale.data")
)
}
slot(object = anchorset, name = "object.list") <- object.list
}
# perform pairwise integration of reference objects
reference.integrated <- PairwiseIntegrateReference(
Expand All @@ -692,7 +693,6 @@ IntegrateData <- function(
eps = eps,
verbose = verbose
)

if (length(x = reference.datasets) == length(x = object.list)) {
if (normalization.method == "SCT") {
reference.integrated <- SetAssayData(
Expand Down Expand Up @@ -973,7 +973,8 @@ MapQuery <- function(
object = reference,
slot = 'data'
)[features.to.integrate, ]
all.integrated <- do.call(cbind, c(reference.integrated, query.corrected))
query.corrected[[length(x = query.corrected) + 1]] <- reference.integrated
all.integrated <- do.call(cbind, query.corrected)
return(all.integrated)
}

Expand Down Expand Up @@ -1188,7 +1189,6 @@ PairwiseIntegrateReference <- function(
suppressWarnings(object.2[["ToIntegrate"]] <- object.2[[DefaultAssay(object = object.2)]])
DefaultAssay(object = object.2) <- "ToIntegrate"
object.2 <- DietSeurat(object = object.2, assays = "ToIntegrate")

datasets <- ParseMergePair(sample.tree, ii)
if (verbose) {
message(
Expand Down

0 comments on commit fc4a4f5

Please sign in to comment.