Skip to content

Commit

Permalink
Merge pull request satijalab#409 from satijalab/fix/subset_features
Browse files Browse the repository at this point in the history
retain Graph and Neighbor objects when only subsetting features
  • Loading branch information
mojaveazure authored Sep 11, 2020
2 parents 361e60a + e42a605 commit 3d29380
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: Seurat
Version: 3.2.1.9001
Version: 3.2.1.9002
Date: 2020-09-11
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 Stuart T, Butler A, et al (2019) <doi:10.1016/j.cell.2019.05.031> for more details.
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### Changes
- Set the seed in `WhichCells` regardless of whether or not `idents` is passed
- Retain Graph and Neighbor objects when subsetting only on features

## [3.2.1] - 2020-09-04
### Added
Expand Down
6 changes: 4 additions & 2 deletions R/objects.R
Original file line number Diff line number Diff line change
Expand Up @@ -7349,6 +7349,10 @@ subset.Seurat <- function(x, subset, cells = NULL, features = NULL, idents = NUL
if (all(cells %in% Cells(x = x)) && length(x = cells) == length(x = Cells(x = x)) && is.null(x = features)) {
return(x)
}
if (!all(colnames(x = x) %in% cells)) {
slot(object = x, name = 'graphs') <- list()
slot(object = x, name = 'neighbors') <- list()
}
assays <- FilterObjects(object = x, classes.keep = 'Assay')
# Filter Assay objects
for (assay in assays) {
Expand Down Expand Up @@ -7394,8 +7398,6 @@ subset.Seurat <- function(x, subset, cells = NULL, features = NULL, idents = NUL
x[[names(x = n.calc)]] <- n.calc
}
}
slot(object = x, name = 'graphs') <- list()
slot(object = x, name = 'neighbors') <- list()
Idents(object = x, drop = TRUE) <- Idents(object = x)[cells]
# subset images
for (image in Images(object = x)) {
Expand Down

0 comments on commit 3d29380

Please sign in to comment.