Skip to content

Commit 12c77a8

Browse files
authored
Merge pull request #14 from satijalab/develop
SeuratData v0.2.1
2 parents 6bb99eb + 00aa5be commit 12c77a8

File tree

6 files changed

+76
-54
lines changed

6 files changed

+76
-54
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: SeuratData
22
Type: Package
33
Title: Install and Manage Seurat Datasets
4-
Version: 0.2.0
5-
Date: 2019-11-15
4+
Version: 0.2.1
5+
Date: 2019-12-09
66
Authors@R: c(
77
person(given = 'Rahul', family = 'Satija', email = 'rsatija@nygenome.org', role = 'aut', comment = c(ORCID = '0000-0001-9448-8833')),
88
person(given = 'Paul', family = 'Hoffman', email = 'phoffman@nygenome.org', role = c('aut', 'cre'), comment = c(ORCID = '0000-0002-7693-8957')),
@@ -17,7 +17,7 @@ BugReports: https://github.com/satijalab/seurat-data/issues
1717
License: GPL-3 | file LICENSE
1818
Encoding: UTF-8
1919
LazyData: true
20-
RoxygenNote: 6.1.1
20+
RoxygenNote: 7.0.2
2121
Depends:
2222
R (>= 3.5.0)
2323
Imports:

R/seurat_data.R

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,19 @@ InstalledData <- function() {
120120

121121
#' Modularly load a dataset
122122
#'
123-
#' @inheritParams LoadH5Seurat
123+
# @inheritParams LoadH5Seurat
124124
#' @param ds Optional name of dataset to load
125-
#' @param type How to load the \code{Seurat} object; choose from
126-
#' \describe{
127-
#' \item{info}{Information about the object and what's stored in it}
128-
#' \item{raw}{The raw form of the dataset, no other options are evaluated}
129-
#' \item{processed}{The proccessed data, modular loading avaible by setting other parameters}
130-
#' }
131-
#'
132-
#' @inherit LoadH5Seurat return
125+
#' @param type How to load the \code{Seurat} object; choose from either
126+
#' 'default' for the default dataset or any dataset listed in the
127+
#' \code{other.datasets} section of the data manifest
128+
# \describe{
129+
# \item{info}{Information about the object and what's stored in it}
130+
# \item{raw}{The raw form of the dataset, no other options are evaluated}
131+
# \item{processed}{The proccessed data, modular loading avaible by setting other parameters}
132+
# }
133+
#'
134+
# @inherit LoadH5Seurat return
135+
#' @return A \code{Seurat} object with the dataset asked for
133136
#'
134137
#' @importFrom utils data
135138
#'
@@ -139,39 +142,59 @@ InstalledData <- function() {
139142
#'
140143
LoadData <- function(
141144
ds,
142-
type = c('info', 'raw', 'processed'),
143-
assays = NULL,
144-
reductions = NULL,
145-
graphs = NULL,
146-
verbose = TRUE
145+
type = 'default'
146+
# assays = NULL,
147+
# reductions = NULL,
148+
# graphs = NULL,
149+
# verbose = TRUE
147150
) {
148-
.NotYetImplemented()
149151
installed <- InstalledData()
150152
if (!NameToPackage(ds = ds) %in% rownames(x = installed)) {
151153
stop("Cannot find dataset ", ds, call. = FALSE)
152154
}
153155
ds <- NameToPackage(ds = ds)
154-
type <- match.arg(arg = tolower(x = type), choices = c('info', 'raw', 'processed'))
155-
if (type == 'raw') {
156+
datasets <- c(
157+
installed[ds, 'default.dataset', drop = TRUE],
158+
trimws(x = unlist(x = strsplit(
159+
x = installed[ds, 'other.datasets', drop = TRUE], split = ','
160+
)))
161+
)
162+
type <- match.arg(
163+
arg = tolower(x = type),
164+
choices = c('raw', 'default', datasets)
165+
)
166+
if (type %in% c('raw', 'default')) {
167+
type <- gsub(pattern = pkg.key, replacement = '', x = ds)
168+
} else if (type == 'final') {
169+
type <- paste0(gsub(pattern = pkg.key, replacement = '', x = ds), '.final')
170+
}
171+
if (type %in% data(package = ds)$results[, 'Item', drop = TRUE]) {
156172
e <- new.env()
157-
ds <- gsub(pattern = '\\.SeuratData', replacement = '', x = ds)
158-
data(list = ds, envir = e)
159-
return(e[[ds]])
173+
data(list = type, package = ds, envir = e)
174+
# ds <- gsub(pattern = '\\.SeuratData', replacement = '', x = ds)
175+
# data(list = ds, envir = e)
176+
return(e[[type]])
160177
}
178+
stop(
179+
"Could not find dataset '",
180+
type,
181+
"', please check manifest and try again",
182+
call. = FALSE
183+
)
161184
.NotYetImplemented()
162-
type <- match.arg(arg = type, choices = c('info', 'processed'))
163-
return(LoadH5Seurat(
164-
file = system.file(
165-
file.path('extdata', 'processed.h5Seurat'),
166-
package = ds,
167-
mustWork = TRUE
168-
),
169-
type = ifelse(test = type == 'processed', yes = 'object', no = type),
170-
assays = assays,
171-
reductions = reductions,
172-
graphs = graphs,
173-
verbose = verbose
174-
))
185+
# type <- match.arg(arg = type, choices = c('info', 'processed'))
186+
# return(LoadH5Seurat(
187+
# file = system.file(
188+
# file.path('extdata', 'processed.h5Seurat'),
189+
# package = ds,
190+
# mustWork = TRUE
191+
# ),
192+
# type = ifelse(test = type == 'processed', yes = 'object', no = type),
193+
# assays = assays,
194+
# reductions = reductions,
195+
# graphs = graphs,
196+
# verbose = verbose
197+
# ))
175198
}
176199

177200
#' Remove a dataset

R/zzz.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,12 +448,12 @@ UpdateManifest <- function() {
448448
x = avail.pkgs$InstalledVersion,
449449
strict = FALSE
450450
)
451-
# TODO: remove these when we allow loading of processed datasets
452-
cols.remove <- c('default.dataset', 'other.datasets')
453-
if (any(cols.remove %in% colnames(x = avail.pkgs))) {
454-
ds.index <- which(x = colnames(x = avail.pkgs) %in% cols.remove)
455-
avail.pkgs <- avail.pkgs[, -ds.index]
456-
}
451+
# # TODO: remove these when we allow loading of processed datasets
452+
# cols.remove <- c('default.dataset', 'other.datasets')
453+
# if (any(cols.remove %in% colnames(x = avail.pkgs))) {
454+
# ds.index <- which(x = colnames(x = avail.pkgs) %in% cols.remove)
455+
# avail.pkgs <- avail.pkgs[, -ds.index]
456+
# }
457457
pkg.env$manifest <- avail.pkgs
458458
# Cache the manifest
459459
if (getOption(x = 'SeuratData.manifest.cache', default = FALSE)) {

man/LoadData.Rd

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/SeuratData-package.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/UpdateData.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)