setGeneric("limmaSelection", function(measurements, ...)

# Matrix of numeric measurements.
setMethod("limmaSelection", "matrix", function(measurements, classes, ...)
  limmaSelection(DataFrame(t(measurements), check.names = FALSE), classes, ...)

# DataFrame of numeric measurements, likely created by runTests or runTest.
setMethod("limmaSelection", "DataFrame",
          function(measurements, classes, datasetName,
                   trainParams, predictParams, resubstituteParams, ...,
                   selectionName = "Moderated t-test", verbose = 3)
  if(!requireNamespace("limma", quietly = TRUE))
    stop("The package 'limma' could not be found. Please install it.")

  fitParams <- list(t(as.matrix(measurements)), model.matrix(~ classes))
    fitParams <- append(fitParams, ...)
  linearModel <- do.call(limma::lmFit, fitParams)
  linearModel <- limma::eBayes(linearModel)
  orderedFeatures <- match(rownames(limma::topTable(linearModel, 2, number = Inf, sort.by = "p")),

  .pickFeatures(measurements, classes,
                datasetName, trainParams, predictParams, resubstituteParams,
                orderedFeatures, selectionName, verbose)  

# One or more omics data sets, possibly with clinical data.
setMethod("limmaSelection", "MultiAssayExperiment", 
          function(measurements, targets = NULL, ...)
    stop("'targets' must be specified but was not.")
  if(length(setdiff(targets, names(measurements))))
    stop("Some values of 'targets' are not names of 'measurements' but all must be.")                            
  tablesAndClasses <- .MAEtoWideTable(measurements, targets)
  measurements <- tablesAndClasses[["dataTable"]]
  classes <- tablesAndClasses[["classes"]]
  limmaSelection(measurements, classes, ...)

Try the ClassifyR package in your browser

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

ClassifyR documentation built on July 8, 2018, 2 a.m.