Repository navigation
implement from_SingleCellExperiment() - #72
Conversation
|
This is a different approach from creating an empty object and filling it in #65, in particular it doesn't require a Also, followed |
36490d1 to
5ec34d2
Compare
|
That's an interesting idea! Using From a documentation perspective I never really liked when functions use Solution 1: helper functionsYou could address that by adding a lot of helper functions, e.g.: from_SingleCellExperiment(sce, output_class = c("InMemoryAnnData", "HDF5AnnData", ...) {
stopifnot(
inherits(sce, "SingleCellExperiment")
)
output_class <- match.arg(output_class)
generator <- switch(
output_class,
"InMemoryAnnData" = InMemoryAnnData,
"HDF5AnnData" = HDF5AnnData
)
from_SingleCellExperiment_impl(sce, generator, ...)
}
#' @rdname from_SingleCellExperiment
from_SingleCellExperiment_to_HDF5AnnData <- function(sce, path) {
from_SingleCellExperiment(sce = sce, output_class = "HDF5AnnData", path = path)
}
#' @rdname from_SingleCellExperiment
from_SingleCellExperiment_to_InMemoryAnnData <- function(sce) {
from_SingleCellExperiment(sce = sce, output_class = "InMemoryAnnData")
}(Not saying that this is a good idea, but it would solve my main annoyance with how Solution 2Simply add some documentation to #' @param output_class character(1) abbreviated name for the AnnData
#' class (e.g., `"InMemory"` for an `InMemoryAnnData` object) to
#' create from `sce`. See "Details" for a list of supported output classes and
#' corresponding additional arguments.
#' @param ... additional arguments passed to the generator function
#' (e.g., `InMemoryAnnData$new()`) of `output_class`. See "Details" for a list
#' of supported output classes and corresponding additional arguments.
#'
#' @details
#' Overview of possible output classes and corresponding generator functions:
#'
#' * `"InMemoryAnnData"`: A class for storing the data in memory. Extra arguments: none.
#' * `"HDFAnnData"`: A class for storing the data in memory. Extra arguments: path. |
|
I'm in favor of 'documenting the dots'. |
* use get_generator() helper function * might as well combine * if no assay is found, X should be NULL * fix test
from_SingleCellExperiment#59