R/AllClasses.R

Defines functions .f_checkpackage

# Helper function authored by Brian Ripley, reproduced from
# http://r.789695.n4.nabble.com/checking-if-a-package-is-installed-td2340534.html
.f_checkpackage <- function(pkg) {
  tryCatch(require(pkg, character.only = TRUE), 
           error = function(e) FALSE) 
}

setClass("CMAPCollection",
         contains = "eSet",
         prototype = prototype(
           new("VersionedBiobase",
               versions=c(classVersion("eSet"), CMAPCollection="1.0.0")),
           phenoData = new("AnnotatedDataFrame",
             data=data.frame(),
             varMetadata=data.frame(
               labelDescription=character(0),
               channelDescription=factor())))
         )

setClass("CMAPResults",
         contains="AnnotatedDataFrame",
         representation(
           docs = "character",
           errors = "list"
         ),
         prototype = prototype(
           docs = "",
           errors = list()
           )         
         )

setClass(
         "SignedGeneSet",
         contains = "GeneColorSet",
         validity = function( object ) {
           if (! all(levels( object@geneColor ) %in% c( "down", "up" ) ) )
             return( "Levels for 'geneColor'/'geneSign' factor must be 'down' and/or 'up'." )
           if ( any( is.na( object@geneColor ) ) )
             return( "All 'geneColor'/'geneSign' entries must be 'down' or 'up'." )
           return( TRUE )
         }
         )

## if bigmemory package is unavailable, create dummy Class big.matrix
if (!isClass("big.matrix")){
  setClass(
    "big.matrix", contains="matrix"
  )
}

## if bigmemoryExtras package is unavailable, create dummy Class BigMatrix
if (!isClass("BigMatrix")){
  setClass(
    "BigMatrix"
  )
}

setClassUnion( "matrix_or_big.matrix", c("matrix", "big.matrix"))

Try the gCMAP package in your browser

Any scripts or data that you put into this service are public.

gCMAP documentation built on April 29, 2020, 3:54 a.m.