R/getSubtype.R

########################
## Benjamin Haibe-Kains
## All rights Reserved
## September 1, 2013
########################


## FIXME 
## the package should properly extend the expressionSet class to add a slot for subtyping information
## the current workaround is using the experimentData slot
`getSubtype` <- 
function (eset, method=c("class", "crisp", "fuzzy")) {
  method <- match.arg(method)
  if (class(eset) != "ExpressionSet") {
    stop("eset should be an expressionSet object")
  }
  # if (length(Biobase::experimentData(eset)@other) == 0) { return (NULL) }
  switch(method,
    "class" = {
      res <- experimentData(eset)@other$class
    },
    "crisp" = {
      res <- experimentData(eset)@other$crisp
    },
    "fuzzy" = {
      res <- experimentData(eset)@other$fuzzy
    }  
  )
  return (res)
}
bhklab/MetaGx documentation built on May 12, 2019, 8:25 p.m.