Skip to content

Commit

Permalink
CRAN release
Browse files Browse the repository at this point in the history
  • Loading branch information
mojaveazure committed Jan 19, 2021
1 parent 22109ac commit bec3990
Show file tree
Hide file tree
Showing 46 changed files with 168 additions and 642 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@
^.*\.h5Seurat$
^.*\.rds$
^.*\.Rds$
^LICENSE$
^data-raw$
^inst$
^tests$
14 changes: 9 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: SeuratObject
Type: Package
Title: Data Structures for Single Cell Data
Version: 0.0.0.9000
Date: 2020-08-10
Version: 4.0.0
Date: 2021-01-07
Authors@R: c(
person(given = 'Rahul', family = 'Satija', email = 'rsatija@nygenome.org', role = 'aut', comment = c(ORCID = '0000-0001-9448-8833')),
person(given = 'Andrew', family = 'Butler', email = 'abutler@nygenome.org', role = 'aut', comment = c(ORCID = '0000-0003-3608-0463')),
Expand All @@ -17,12 +17,16 @@ Authors@R: c(
Description: Defines S4 classes for single-cell genomic data and associated
information, such as dimensionality reduction embeddings, nearest-neighbor
graphs, and spatially-resolved coordinates. Provides data access methods and
R-native hooks to ensure the Seurat object is familiar to other R users.
URL: http://www.satijalab.org/seurat,
R-native hooks to ensure the Seurat object is familiar to other R users. 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.
URL: https://satijalab.org/seurat,
https://github.com/mojaveazure/seurat-object
BugReports:
https://github.com/mojaveazure/seurat-object/issues
License: GPL-3 | file LICENSE
License: GPL-3
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
Expand Down
10 changes: 10 additions & 0 deletions R/assay.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ Assay <- setClass(
#' @param min.features Include cells where at least this many features are
#' detected.
#'
#' @return A \code{\link{Assay}} object
#'
#' @importFrom methods as
#' @importFrom Matrix colSums rowSums
#'
Expand Down Expand Up @@ -1173,6 +1175,8 @@ setMethod(
#'
#' @keywords internal
#'
#' @noRd
#'
#' @examples
#' \donttest{
#' calcn <- SeuratObject:::CalcN(pbmc_small[["RNA"]])
Expand All @@ -1197,6 +1201,8 @@ CalcN <- function(object) {
#'
#' @keywords internal
#'
#' @noRd
#'
IsSCT <- function(assay) {
if (is.list(x = assay)) {
sct.check <- lapply(X = assay, FUN = function(x) {
Expand All @@ -1215,6 +1221,8 @@ IsSCT <- function(assay) {
#'
#' @keywords internal
#'
#' @noRd
#'
SubsetVST <- function(sct.info, cells, features) {
cells.keep <- intersect(x = cells, y = rownames(x = sct.info$cell_attr))
sct.info$cell_attr <- sct.info$cell_attr[cells.keep, ]
Expand All @@ -1241,6 +1249,8 @@ SubsetVST <- function(sct.info, cells, features) {
#'
#' @keywords internal
#'
#' @noRd
#'
ValidateDataForMerge <- function(assay, slot) {
mat <- GetAssayData(object = assay, slot = slot)
if (any(dim(x = mat) == c(0, 0))) {
Expand Down
4 changes: 4 additions & 0 deletions R/dimreduc.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ DimReduc <- setClass(
#' @param misc list for the user to store any additional information associated
#' with the dimensional reduction
#'
#' @return A \code{\link{DimReduc}} object
#'
#' @aliases SetDimReduction
#'
#' @export
Expand Down Expand Up @@ -777,6 +779,8 @@ setMethod(
#'
#' @keywords internal
#'
#' @noRd
#'
Projected <- function(object) {
return(!IsMatrixEmpty(x = Loadings(object = object, projected = TRUE)))
}
25 changes: 24 additions & 1 deletion R/generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ NULL
#' variance). To add cell level information, add to the Seurat object. If adding
#' feature-level metadata, add to the Assay object (e.g. \code{object[["RNA"]]})
#'
#' @inheritParams .AddMetaData
#' @param object An object
#' @param metadata A vector, list, or data.frame with metadata to add
#' @param col.name A name for meta data if not a named list or data.frame
#'
#' @return \code{object} with metadata added
#'
Expand Down Expand Up @@ -79,6 +81,8 @@ as.Neighbor <- function(x, ...) {
#' @param x An object to convert to class \code{Seurat}
#' @param ... Arguments passed to other methods
#'
#' @return A \code{\link{Seurat}} object generated from \code{x}
#'
#' @rdname as.Seurat
#' @export as.Seurat
#'
Expand Down Expand Up @@ -218,6 +222,8 @@ DefaultAssay <- function(object, ...) {
#' @param object An object
#' @param ... Arguments passed to other methods
#'
#' @return The distance matrix
#'
#' @rdname Distances
#' @export Distances
#'
Expand All @@ -232,6 +238,8 @@ Distances <- function(object, ...) {
#' @param object An object
#' @param ... Arguments passed to other methods
#'
#' @return The embeddings matrix
#'
#' @rdname Embeddings
#' @export Embeddings
#'
Expand Down Expand Up @@ -475,6 +483,9 @@ IsGlobal <- function(object, ...) {
#' @param object An object
#' @param ... Arguments passed to other methods
#'
#' @return \code{JS}: either a \code{\link{JackStrawData}} object or the
#' specified jackstraw data
#'
#' @rdname JS
#' @export JS
#'
Expand All @@ -486,6 +497,8 @@ JS <- function(object, ...) {

#' @param value JackStraw information
#'
#' @return \code{JS<-}: \code{object} with the update jackstraw information
#'
#' @rdname JS
#' @export JS<-
#'
Expand All @@ -498,6 +511,8 @@ JS <- function(object, ...) {
#' @param object An object
#' @param ... Arguments passed to other methods
#'
#' @return \code{Key}: the object key
#'
#' @rdname Key
#' @export Key
#'
Expand All @@ -509,6 +524,8 @@ Key <- function(object, ...) {

#' @param value Key value
#'
#' @return \code{Key<-}: \code{object} with an updated key
#'
#' @rdname Key
#' @export Key<-
#'
Expand All @@ -523,6 +540,8 @@ Key <- function(object, ...) {
#' @param object An object
#' @param ... Arguments passed to other methods
#'
#' @return \code{Loadings}: the feature loadings for \code{object}
#'
#' @rdname Loadings
#' @export Loadings
#'
Expand All @@ -534,6 +553,8 @@ Loadings <- function(object, ...) {

#' @param value Feature loadings to add
#'
#' @return \code{Loadings<-}: \code{object} with the updated loadings
#'
#' @rdname Loadings
#' @export Loadings<-
#'
Expand Down Expand Up @@ -724,6 +745,8 @@ StashIdent <- function(object, save.name, ...) {
#' @param object An object
#' @param ... Arguments passed to other methods
#'
#' @return The standard deviations
#'
#' @rdname Stdev
#' @export Stdev
#'
Expand Down
16 changes: 15 additions & 1 deletion R/seurat.R
Original file line number Diff line number Diff line change
Expand Up @@ -2990,6 +2990,8 @@ setMethod(
#'
#' @keywords internal
#'
#' @noRd
#'
#' @examples
#' \donttest{
#' SeuratObject:::Collections(pbmc_small)
Expand Down Expand Up @@ -3022,6 +3024,8 @@ Collections <- function(object) {
#'
#' @keywords internal
#'
#' @noRd
#'
DefaultImage <- function(object) {
object <- UpdateSlots(object = object)
images <- Images(object = object, assay = DefaultAssay(object = object))
Expand All @@ -3041,6 +3045,8 @@ DefaultImage <- function(object) {
#'
#' @keywords internal
#'
#' @noRd
#'
FilterObjects <- function(object, classes.keep = c('Assay', 'DimReduc')) {
object <- UpdateSlots(object = object)
slots <- na.omit(object = Filter(
Expand Down Expand Up @@ -3080,6 +3086,8 @@ FilterObjects <- function(object, classes.keep = c('Assay', 'DimReduc')) {
#'
#' @keywords internal
#'
#' @noRd
#'
#' @examples
#' \donttest{
#' SeuratObject:::FindObject(pbmc_small, name = "RNA")
Expand Down Expand Up @@ -3133,6 +3141,8 @@ FindObject <- function(object, name) {
#'
#' @seealso \code{\link[sctransform]{get_residuals}}
#'
#' @noRd
#'
#' @examples
#' \dontrun{
#' pbmc_small <- SCTransform(pbmc_small, variable.features.n = 20)
Expand Down Expand Up @@ -3377,6 +3387,8 @@ GetResidualVstOut <- function(
#'
#' @keywords internal
#'
#' @noRd
#'
UpdateAssay <- function(old.assay, assay) {
cells <- colnames(x = old.assay@data)
counts <- old.assay@raw.data
Expand Down Expand Up @@ -3405,7 +3417,7 @@ UpdateAssay <- function(old.assay, assay) {
#'
#' @rdname V2Update
#'
#' @keywords internal
#' @noRd
#'
UpdateDimReduction <- function(old.dr, assay) {
new.dr <- list()
Expand Down Expand Up @@ -3453,6 +3465,8 @@ UpdateDimReduction <- function(old.dr, assay) {
#'
#' @keywords internal
#'
#' @noRd
#'
UpdateJackstraw <- function(old.jackstraw) {
if (is.null(x = old.jackstraw)) {
new.jackstraw <- new(
Expand Down
2 changes: 2 additions & 0 deletions R/spatial.R
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ setMethod(
#'
#' @keywords internal
#'
#' @noRd
#'
NullImage <- function(mode = c('grob', 'raster', 'plotly', 'raw')) {
mode <- mode[1]
mode <- match.arg(arg = mode)
Expand Down
22 changes: 22 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ S4ToList.list <- function(object) {
#'
#' @keywords internal
#'
#' @noRd
#'
CheckDots <- function(..., fxns = NULL) {
args.names <- names(x = list(...))
if (length(x = list(...)) == 0) {
Expand Down Expand Up @@ -460,6 +462,8 @@ CheckDots <- function(..., fxns = NULL) {
#'
#' @keywords internal
#'
#' @noRd
#'
CheckDuplicateCellNames <- function(object.list, verbose = TRUE, stop = FALSE) {
cell.names <- unlist(x = lapply(X = object.list, FUN = colnames))
if (any(duplicated(x = cell.names))) {
Expand Down Expand Up @@ -497,6 +501,8 @@ CheckDuplicateCellNames <- function(object.list, verbose = TRUE, stop = FALSE) {
#'
#' @keywords internal
#'
#' @noRd
#'
#' @examples
#' \donttest{
#' SeuratObject:::ExtractField('Hello World', field = 1, delim = '_')
Expand Down Expand Up @@ -526,6 +532,8 @@ ExtractField <- function(string, field = 1, delim = "_") {
#'
#' @keywords internal
#'
#' @noRd
#'
#' @examples
#' \donttest{
#' SeuratObject:::IsMatrixEmpty(new("matrix"))
Expand Down Expand Up @@ -553,6 +561,8 @@ IsMatrixEmpty <- function(x) {
#'
#' @keywords internal
#'
#' @noRd
#'
IsNullPtr <- function(x) {
stopifnot(is(object = x, class2 = 'externalptr'))
return(.Call('isnull', x))
Expand All @@ -572,6 +582,8 @@ IsNullPtr <- function(x) {
#'
#' @keywords internal
#'
#' @noRd
#'
#' @examples
#' \dontrun{
#' set.seed(42L)
Expand Down Expand Up @@ -608,6 +620,8 @@ RandomName <- function(length = 5L, ...) {
#'
#' @seealso \code{\link{s4list}}
#'
#' @noRd
#'
SwapClassPkg <- function(x, from = NULL, to = NULL) {
if (!inherits(x = x, what = 'list')) {
return(x)
Expand Down Expand Up @@ -659,6 +673,8 @@ SwapClassPkg <- function(x, from = NULL, to = NULL) {
#'
#' @keywords internal
#'
#' @noRd
#'
Top <- function(data, num = 20, balanced = FALSE) {
nr <- nrow(x = data)
if (num > nr) {
Expand Down Expand Up @@ -699,6 +715,8 @@ Top <- function(data, num = 20, balanced = FALSE) {
#'
#' @keywords internal
#'
#' @noRd
#'
UpdateClassPkg <- function(object, from = NULL, to = NULL) {
if (!isS4(object)) {
return(object)
Expand All @@ -719,6 +737,8 @@ UpdateClassPkg <- function(object, from = NULL, to = NULL) {
#'
#' @keywords internal
#'
#' @noRd
#'
UpdateSlots <- function(object) {
object.list <- sapply(
X = slotNames(x = object),
Expand Down Expand Up @@ -759,6 +779,8 @@ UpdateSlots <- function(object) {
#'
#' @keywords internal
#'
#' @noRd
#'
UpdateKey <- function(key) {
if (grepl(pattern = '^[[:alnum:]]+_$', x = key)) {
return(key)
Expand Down
Loading

0 comments on commit bec3990

Please sign in to comment.