From 97bd2f739f04a479a7ec77eb86cd1a51c437d11a Mon Sep 17 00:00:00 2001 From: RubD Date: Thu, 29 Oct 2020 18:49:07 -0400 Subject: [PATCH] switch class to inherits --- R/auxiliary_giotto.R | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/R/auxiliary_giotto.R b/R/auxiliary_giotto.R index 2bde5b7ee..0c0fff496 100644 --- a/R/auxiliary_giotto.R +++ b/R/auxiliary_giotto.R @@ -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)) } @@ -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)))