Skip to content

Commit

Permalink
switch class to inherits
Browse files Browse the repository at this point in the history
  • Loading branch information
RubD committed Oct 29, 2020
1 parent 58f4fe7 commit 97bd2f7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/auxiliary_giotto.R
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,17 @@ logNorm_giotto = function(mymatrix, base, offset) {
#'
pDataDT <- function(gobject) {

if(!class(gobject) %in% c('ExpressionSet', 'SCESet', 'seurat', 'giotto')) {
if(!inherits(gobject, c('ExpressionSet', 'SCESet', 'seurat', 'giotto'))) {
stop('only works with ExpressionSet (-like) objects')
}

if(class(gobject) %in% c('ExpressionSet', 'SCESet')) {
if(inherits(gobject, c('ExpressionSet', 'SCESet'))) {
return(data.table::as.data.table(Biobase::pData(gobject)))
}
else if(class(gobject) == 'giotto') {
else if(inherits(gobject, 'giotto')) {
return(gobject@cell_metadata)
}
else if(class(gobject) == 'seurat') {
else if(inherits(gobject, 'seurat')) {
return(data.table::as.data.table(gobject@meta.data))
}

Expand All @@ -243,10 +243,10 @@ pDataDT <- function(gobject) {
#'
fDataDT <- function(gobject) {

if(!class(gobject) %in% c('ExpressionSet', 'SCESet', 'giotto')) {
if(!inherits(gobject, c('ExpressionSet', 'SCESet', 'giotto'))) {
stop('only works with ExpressionSet (-like) objects')
}
else if(class(gobject) == 'giotto') {
else if(inherits(gobject,'giotto')) {
return(gobject@gene_metadata)
}
return(data.table::as.data.table(Biobase::fData(gobject)))
Expand Down

0 comments on commit 97bd2f7

Please sign in to comment.