Skip to content

Commit

Permalink
Merge pull request satijalab#200 from satijalab/fix/subset_feat
Browse files Browse the repository at this point in the history
Subsetting feature-level metadata fix
  • Loading branch information
Gesmira authored Apr 16, 2024
2 parents 7bb1759 + bad9626 commit 0218527
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: SeuratObject
Type: Package
Title: Data Structures for Single Cell Data
Version: 5.0.1.9007
Version: 5.0.1.9008
Authors@R: c(
person(given = 'Paul', family = 'Hoffman', email = '[email protected]', role = 'aut', comment = c(ORCID = '0000-0002-7693-8957')),
person(given = 'Rahul', family = 'Satija', email = '[email protected]', role = c('aut', 'cre'), comment = c(ORCID = '0000-0001-9448-8833')),
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 @@
- Require R 4.1 (#180)
- Fix errors in `UpdateSeuratObject` (@ddiez, #182)
- Fix bug in `PolyVtx` (#194)
- Fix bug in feature-level subsetting (#200)

# SeuratObject 5.0.1

Expand Down
12 changes: 6 additions & 6 deletions R/assay5.R
Original file line number Diff line number Diff line change
Expand Up @@ -2411,6 +2411,12 @@ subset.StdAssay <- function(
for (lyr in setdiff(x = layers.all, y = layers)) {
LayerData(object = x, layer = lyr) <- NULL
}
# Subset feature-level metadata
mfeatures <- MatchCells(
new = Features(x = x, layer = NA),
orig = features,
ordered = TRUE
)
# Perform the subsets
for (l in layers) {
lcells <- MatchCells(
Expand Down Expand Up @@ -2442,12 +2448,6 @@ subset.StdAssay <- function(
for (i in c('cells', 'features')) {
slot(object = x, name = i) <- droplevels(x = slot(object = x, name = i))
}
# Subset feature-level metadata
mfeatures <- MatchCells(
new = Features(x = x, layer = NA),
orig = features,
ordered = TRUE
)
slot(object = x, name = 'meta.data') <- slot(
object = x,
name = 'meta.data'
Expand Down

0 comments on commit 0218527

Please sign in to comment.