Skip to content

Commit

Permalink
fix: dimnames/colnames generics
Browse files Browse the repository at this point in the history
  • Loading branch information
jiajic committed Aug 30, 2024
1 parent 8c1c4f3 commit 56f92a1
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
1 change: 0 additions & 1 deletion R/join.R
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,6 @@ joinGiottoObjects <- function(gobject_list,




## spatial locations
vmsg(.v = verbose, "3. spatial locations")

Expand Down
28 changes: 27 additions & 1 deletion R/methods-names.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#' @include generics.R
NULL

# NOTE:
# dimnames MUST be provided for rownames and colnames methods to be well
# behaved

#' @title Row and column names
#' @name row-plus-colnames-generic
#' @aliases colnames rownames
#' @description Retrieve or set the row or column names of an object
#' @param x object
#' @return A character vector of row or col names
#' @keywords internal
#' @examples
#' g <- GiottoData::loadSubObjectMini("exprObj")
#'
Expand All @@ -19,6 +24,7 @@ NULL
#' Retrieve or set the dimnames of an object
#' @param x object
#' @returns character
#' @keywords internal
#' @examples
#' g <- GiottoData::loadSubObjectMini("exprObj")
#'
Expand Down Expand Up @@ -60,7 +66,9 @@ setMethod("rownames", signature(x = "exprObj"), function(x) rownames(x[]))
#' @export
setMethod("rownames", signature(x = "dimObj"), function(x) rownames(x[]))


#' @rdname row-plus-colnames-generic
#' @export
setMethod("rownames", signature(x = "metaData"), function(x) rownames(x[]))



Expand All @@ -71,3 +79,21 @@ setMethod("dimnames", signature(x = "exprObj"), function(x) dimnames(x[]))
#' @rdname dimnames
#' @export
setMethod("dimnames", signature(x = "dimObj"), function(x) dimnames(x[]))

#' @rdname dimnames
#' @export
setMethod("dimnames", signature(x = "spatLocsObj"), function(x) dimnames(x[]))

#' @rdname dimnames
#' @export
setMethod("dimnames", signature(x = "metaData"), function(x) dimnames(x[]))

#' @rdname dimnames
#' @export
setMethod("dimnames", signature(x = "enrData"), function(x) dimnames(x[]))

#' @rdname dimnames
#' @export
setMethod("dimnames", signature(x = "dimObj"), function(x) dimnames(x[]))


2 changes: 1 addition & 1 deletion R/methods-rbind.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ setMethod(
stop("rbind: `spatLocsObj` with the same IDs cannot be joined",
call. = FALSE)
}

# if one is 3d, ensure both are 3d
x3 <- .is_3d_spatlocs(x)
y3 <- .is_3d_spatlocs(y)
Expand Down
12 changes: 12 additions & 0 deletions man/dimnames.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions man/row-plus-colnames-generic.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 56f92a1

Please sign in to comment.