CoGAPS: CoGAPS Matrix Factorization Algorithm

View source: R/CoGAPS.R

CoGAPSR Documentation

CoGAPS Matrix Factorization Algorithm

Description

calls the C++ MCMC code and performs Bayesian matrix factorization returning the two matrices that reconstruct the data matrix

Usage

CoGAPS(
  data,
  params = new("CogapsParams"),
  nThreads = 1,
  messages = TRUE,
  outputFrequency = 1000,
  uncertainty = NULL,
  checkpointOutFile = "gaps_checkpoint.out",
  checkpointInterval = 0,
  checkpointInFile = NULL,
  transposeData = FALSE,
  BPPARAM = NULL,
  workerID = 1,
  asynchronousUpdates = TRUE,
  nSnapshots = 0,
  snapshotPhase = "sampling",
  ...
)

Arguments

data

File name or R object (see details for supported types)

params

CogapsParams object

nThreads

maximum number of threads to run on

messages

T/F for displaying output

outputFrequency

number of iterations between each output (set to 0 to disable status updates, other output is controlled by @code messages)

uncertainty

uncertainty matrix - either a matrix or a supported file type

checkpointOutFile

name of the checkpoint file to create

checkpointInterval

number of iterations between each checkpoint (set to 0 to disable checkpoints)

checkpointInFile

if this is provided, CoGAPS runs from the checkpoint contained in this file

transposeData

T/F for transposing data while reading it in - useful for data that is stored as samples x genes since CoGAPS requires data to be genes x samples

BPPARAM

BiocParallel backend

workerID

if calling CoGAPS in parallel the worker ID can be specified, only worker 1 prints output and each worker outputs when it finishes, this is not neccesary when using the default parallel methods (i.e. distributed CoGAPS) but only when the user is manually calling CoGAPS in parallel

asynchronousUpdates

enable asynchronous updating which allows for multi-threaded runs

nSnapshots

how many snapshots to take in each phase, setting this to 0 disables snapshots

snapshotPhase

which phase to take snapsjots in e.g. "equilibration", "sampling", "all"

...

allows for overwriting parameters in params

Details

The supported R types are: matrix, data.frame, SummarizedExperiment, SingleCellExperiment. The supported file types are csv, tsv, and mtx.

Value

CogapsResult object

Examples

# Running from R object
data(GIST)
resultA <- CoGAPS(GIST.data_frame, nIterations=25)

# Running from file name
gist_path <- system.file("extdata/GIST.mtx", package="CoGAPS")
resultB <- CoGAPS(gist_path, nIterations=25)

# Setting Parameters
params <- new("CogapsParams")
params <- setParam(params, "nPatterns", 3)
resultC <- CoGAPS(GIST.data_frame, params, nIterations=25)

CoGAPS/CoGAPS documentation built on April 12, 2024, 3:12 a.m.