Title: | Coordinated Gene Activity in Pattern Sets |
---|---|
Description: | Coordinated Gene Activity in Pattern Sets (CoGAPS) implements a Bayesian MCMC matrix factorization algorithm, GAPS, and links it to gene set statistic methods to infer biological process activity. It can be used to perform sparse matrix factorization on any data, and when this data represents biomolecules, to do gene set analysis. |
Authors: | Jeanette Johnson, Ashley Tsang, Jacob Mitchell, Thomas Sherman, Wai-shing Lee, Conor Kelton, Ondrej Maxian, Jacob Carey, Genevieve Stein-O'Brien, Michael Considine, Maggie Wodicka, John Stansfield, Shawn Sivy, Carlo Colantuoni, Alexander Favorov, Mike Ochs, Elana Fertig |
Maintainer: | Elana J. Fertig <[email protected]>, Thomas D. Sherman <[email protected]>, Jeanette Johnson <[email protected]>, Dmitrijs Lvovs <[email protected]> |
License: | BSD_3_clause + file LICENSE |
Version: | 3.27.0 |
Built: | 2024-11-29 05:12:21 UTC |
Source: | https://github.com/bioc/CoGAPS |
CoGAPS implements a Bayesian MCMC matrix factorization algorithm, GAPS, and links it to gene set statistic methods to infer biological process activity. It can be used to perform sparse matrix factorization on any data, and when this data represents biomolecules, to do gene set analysis.
Package: | CoGAPS |
Type: | Package |
Version: | 2.99.0 |
Date: | 2018-01-24 |
License: | LGPL |
Maintainer: Elana J. Fertig [email protected], Michael F. Ochs [email protected]
Fertig EJ, Ding J, Favorov AV, Parmigiani G, Ochs MF. CoGAPS: an R/C++ package to identify patterns and biological process activity in transcriptomic data. Bioinformatics. 2010 Nov 1;26(21):2792-3
creates a binarized heatmap of the A matrix in which the value is 1 if the value in Amean is greater than threshold * Asd and 0 otherwise
binaryA(object, threshold = 3) ## S4 method for signature 'CogapsResult' binaryA(object, threshold = 3)
binaryA(object, threshold = 3) ## S4 method for signature 'CogapsResult' binaryA(object, threshold = 3)
object |
an object of type CogapsResult |
threshold |
the number of standard deviations above zero that an element of Amean must be to get a value of 1 |
plots a heatmap of the A Matrix
data(GIST) # to expensive to call since it plots # binaryA(GIST.result, threshold=3)
data(GIST) # to expensive to call since it plots # binaryA(GIST.result, threshold=3)
Information About Package Compilation
buildReport()
buildReport()
returns information about how the package was compiled, i.e. which compiler/version was used, which compile time options were enabled, etc...
string containing build report
CoGAPS::buildReport()
CoGAPS::buildReport()
calculates a statistic to determine if a pattern is enriched in a a particular set of measurements or samples.
calcCoGAPSStat( object, sets = NULL, whichMatrix = "featureLoadings", numPerm = 1000, ... ) ## S4 method for signature 'CogapsResult' calcCoGAPSStat( object, sets = NULL, whichMatrix = "featureLoadings", numPerm = 1000, ... )
calcCoGAPSStat( object, sets = NULL, whichMatrix = "featureLoadings", numPerm = 1000, ... ) ## S4 method for signature 'CogapsResult' calcCoGAPSStat( object, sets = NULL, whichMatrix = "featureLoadings", numPerm = 1000, ... )
object |
an object of type CogapsResult |
sets |
list of sets of measurements/samples |
whichMatrix |
either "featureLoadings" or "sampleFactors" indicating which matrix to calculate the statistics for |
numPerm |
number of permutations to use when calculatin p-value |
... |
handles old arguments for backwards compatibility |
gene set statistics for each column of A
calculates the probability that a gene listed in a gene set behaves like other genes in the set within the given data set
calcGeneGSStat( object, GStoGenes, numPerm, Pw = rep(1, ncol(object@featureLoadings)), nullGenes = FALSE ) ## S4 method for signature 'CogapsResult' calcGeneGSStat( object, GStoGenes, numPerm, Pw = rep(1, ncol(object@featureLoadings)), nullGenes = FALSE )
calcGeneGSStat( object, GStoGenes, numPerm, Pw = rep(1, ncol(object@featureLoadings)), nullGenes = FALSE ) ## S4 method for signature 'CogapsResult' calcGeneGSStat( object, GStoGenes, numPerm, Pw = rep(1, ncol(object@featureLoadings)), nullGenes = FALSE )
object |
an object of type CogapsResult |
GStoGenes |
data.frame or list with gene sets |
numPerm |
number of permutations for null |
Pw |
weight on genes |
nullGenes |
logical indicating gene adjustment |
gene similiarity statistic
calculates the Z-score for each element based on input mean and standard deviation matrices
calcZ(object, whichMatrix) ## S4 method for signature 'CogapsResult' calcZ(object, whichMatrix)
calcZ(object, whichMatrix) ## S4 method for signature 'CogapsResult' calcZ(object, whichMatrix)
object |
an object of type CogapsResult |
whichMatrix |
either "featureLoadings" or "sampleFactors" indicating which matrix to calculate the z-score for |
matrix of z-scores
data(GIST) featureZScore <- calcZ(GIST.result, "featureLoadings")
data(GIST) featureZScore <- calcZ(GIST.result, "featureLoadings")
Check if package was built with checkpoints enabled
checkpointsEnabled()
checkpointsEnabled()
true/false if checkpoints are enabled
CoGAPS::checkpointsEnabled()
CoGAPS::checkpointsEnabled()
calls the C++ MCMC code and performs Bayesian matrix factorization returning the two matrices that reconstruct the data matrix
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", ... )
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", ... )
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 |
The supported R types are: matrix, data.frame, SummarizedExperiment, SingleCellExperiment. The supported file types are csv, tsv, and mtx.
CogapsResult object
# 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)
# 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)
create a CogapsParams object
CogapsParams(...)
CogapsParams(...)
... |
parameters for the initialization method |
CogapsParams object
params <- CogapsParams(nPatterns=10) params
params <- CogapsParams(nPatterns=10) params
Encapsulates all parameters for the CoGAPS algorithm
nPatterns
number of patterns CoGAPS will learn
nIterations
number of iterations for each phase of the algorithm
alphaA
sparsity parameter for feature matrix
alphaP
sparsity parameter for sample matrix
maxGibbsMassA
atomic mass restriction for feature matrix
maxGibbsMassP
atomic mass restriction for sample matrix
seed
random number generator seed
sparseOptimization
speeds up performance with sparse data (roughly >80 default uncertainty
distributed
either "genome-wide" or "single-cell" indicating which distributed algorithm should be used
nSets
[distributed parameter] number of sets to break data into
cut
[distributed parameter] number of branches at which to cut dendrogram used in pattern matching
minNS
[distributed parameter] minimum of individual set contributions a cluster must contain
maxNS
[distributed parameter] maximum of individual set contributions a cluster can contain
explicitSets
[distributed parameter] specify subsets by index or name
samplingAnnotation
[distributed parameter] specify categories along the rows (cols) to use for weighted sampling
samplingWeight
[distributed parameter] weights associated with samplingAnnotation
subsetIndices
set of indices to use from the data
subsetDim
which dimension (1=rows, 2=cols) to subset
geneNames
vector of names of genes in data
sampleNames
vector of names of samples in data
fixedPatterns
fix either 'A' or 'P' matrix to these values, in the context of distributed CoGAPS (GWCoGAPS/scCoGAPS), the first phase is skipped and fixedPatterns is used for all sets - allowing manual pattern matching, as well as fixed runs of standard CoGAPS
whichMatrixFixed
either 'A' or 'P', indicating which matrix is fixed
takePumpSamples
whether or not to take PUMP samples
checkpointInterval
how many iterations between each checkpoint (set to 0 to disable)
checkpointInFile
file path to load checkpoint from
checkpointOutFile
file path where checkpoint should be written to
Contains all output from Cogaps run
factorStdDev
std dev of the sampled P matrices
loadingStdDev
std dev of the sampled A matrices
Check if compiler supported OpenMP
compiledWithOpenMPSupport()
compiledWithOpenMPSupport()
true/false if OpenMP was supported
CoGAPS::compiledWithOpenMPSupport()
CoGAPS::compiledWithOpenMPSupport()
Computes the p-value for gene set membership using the CoGAPS-based
statistics developed in Fertig et al. (2012). This statistic refines set
membership for each candidate gene in a set specified in GSGenes
by
comparing the inferred activity of that gene to the average activity of the
set.
computeGeneGSProb( object, GStoGenes, numPerm = 500, Pw = rep(1, ncol(object@featureLoadings)), PwNull = FALSE ) ## S4 method for signature 'CogapsResult' computeGeneGSProb( object, GStoGenes, numPerm = 500, Pw = rep(1, ncol(object@featureLoadings)), PwNull = FALSE )
computeGeneGSProb( object, GStoGenes, numPerm = 500, Pw = rep(1, ncol(object@featureLoadings)), PwNull = FALSE ) ## S4 method for signature 'CogapsResult' computeGeneGSProb( object, GStoGenes, numPerm = 500, Pw = rep(1, ncol(object@featureLoadings)), PwNull = FALSE )
object |
an object of type CogapsResult |
GStoGenes |
data.frame or list with gene sets |
numPerm |
number of permutations for null |
Pw |
weight on genes |
PwNull |
- logical indicating gene adjustment |
A vector of length GSGenes containing the p-values of set membership for each gene containined in the set specified in GSGenes.
find the consensus pattern matrix across all subsets
findConsensusMatrix(unmatchedPatterns, gapsParams)
findConsensusMatrix(unmatchedPatterns, gapsParams)
unmatchedPatterns |
list of all unmatched pattern matrices from initial run of CoGAPS |
gapsParams |
list of all CoGAPS parameters |
matrix of consensus patterns
save as csv
fromCSV(save_location = ".") ## S4 method for signature 'character' fromCSV(save_location = ".")
fromCSV(save_location = ".") ## S4 method for signature 'character' fromCSV(save_location = ".")
save_location |
directory to read from |
CogapsResult object
return Amplitude matrix from CogapsResult object
getAmplitudeMatrix(object) ## S4 method for signature 'CogapsResult' getAmplitudeMatrix(object)
getAmplitudeMatrix(object) ## S4 method for signature 'CogapsResult' getAmplitudeMatrix(object)
object |
an object of type CogapsResult |
amplitude matrix
data(GIST) amplitudeMatrix <- getAmplitudeMatrix(GIST.result)
data(GIST) amplitudeMatrix <- getAmplitudeMatrix(GIST.result)
return clustered patterns from set of all patterns across all subsets
getClusteredPatterns(object) ## S4 method for signature 'CogapsResult' getClusteredPatterns(object)
getClusteredPatterns(object) ## S4 method for signature 'CogapsResult' getClusteredPatterns(object)
object |
an object of type CogapsResult |
CogapsParams object
data(GIST) clusteredPatterns <- getClusteredPatterns(GIST.result)
data(GIST) clusteredPatterns <- getClusteredPatterns(GIST.result)
return correlation between each pattern and the cluster mean
getCorrelationToMeanPattern(object) ## S4 method for signature 'CogapsResult' getCorrelationToMeanPattern(object)
getCorrelationToMeanPattern(object) ## S4 method for signature 'CogapsResult' getCorrelationToMeanPattern(object)
object |
an object of type CogapsResult |
CogapsParams object
data(GIST) corrToMeanPattern <- getCorrelationToMeanPattern(GIST.result)
data(GIST) corrToMeanPattern <- getCorrelationToMeanPattern(GIST.result)
return featureLoadings matrix from CogapsResult object
getFeatureLoadings(object) ## S4 method for signature 'CogapsResult' getFeatureLoadings(object)
getFeatureLoadings(object) ## S4 method for signature 'CogapsResult' getFeatureLoadings(object)
object |
an object of type CogapsResult |
featureLoadings matrix
data(GIST) fLoadings <- getFeatureLoadings(GIST.result)
data(GIST) fLoadings <- getFeatureLoadings(GIST.result)
return chi-sq of final matrices
getMeanChiSq(object) ## S4 method for signature 'CogapsResult' getMeanChiSq(object)
getMeanChiSq(object) ## S4 method for signature 'CogapsResult' getMeanChiSq(object)
object |
an object of type CogapsResult |
chi-sq error
data(GIST) getMeanChiSq(GIST.result)
data(GIST) getMeanChiSq(GIST.result)
return original parameters used to generate this result
getOriginalParameters(object) ## S4 method for signature 'CogapsResult' getOriginalParameters(object)
getOriginalParameters(object) ## S4 method for signature 'CogapsResult' getOriginalParameters(object)
object |
an object of type CogapsResult |
CogapsParams object
data(GIST) params <- getOriginalParameters(GIST.result)
data(GIST) params <- getOriginalParameters(GIST.result)
get the value of a parameter
getParam(object, whichParam) ## S4 method for signature 'CogapsParams' getParam(object, whichParam)
getParam(object, whichParam) ## S4 method for signature 'CogapsParams' getParam(object, whichParam)
object |
an object of type CogapsParams |
whichParam |
a string with the name of the requested parameter |
the value of the parameter
params <- new("CogapsParams") getParam(params, "seed")
params <- new("CogapsParams") getParam(params, "seed")
generate statistics associating patterns with gene sets
getPatternGeneSet( object, gene.sets, method = c("enrichment", "overrepresentation"), ... ) ## S4 method for signature 'CogapsResult,list,character' getPatternGeneSet( object, gene.sets, method = c("enrichment", "overrepresentation"), ... )
getPatternGeneSet( object, gene.sets, method = c("enrichment", "overrepresentation"), ... ) ## S4 method for signature 'CogapsResult,list,character' getPatternGeneSet( object, gene.sets, method = c("enrichment", "overrepresentation"), ... )
object |
an object of type CogapsResult |
gene.sets |
a list of gene sets to test. List names should be the names of the gene sets |
method |
enrichment or overrepresentation. Conducts a test for gene set enrichment using fgsea::gsea ranking features by pattern amplitude or a test for gene set overrepresentation in pattern markers using fgsea::fora, respectively. |
... |
additional parameters passed to patternMarkers if using overrepresentation method |
list of dataframes containing gene set enrichment or gene set overrepresentation statistics
data(GIST) gs.test <- list( "gs1" = c("Hs.2", "Hs.4", "Hs.36", "Hs.96", "Hs.202"), "gs2" = c("Hs.699463", "Hs.699288", "Hs.699280", "Hs.699154", "Hs.697294") ) getPatternGeneSet(object = GIST.result, gene.sets = gs.test, method = "enrichment") getPatternGeneSet(object = GIST.result, gene.sets = gs.test, method = "overrepresentation")
data(GIST) gs.test <- list( "gs1" = c("Hs.2", "Hs.4", "Hs.36", "Hs.96", "Hs.202"), "gs2" = c("Hs.699463", "Hs.699288", "Hs.699280", "Hs.699154", "Hs.697294") ) getPatternGeneSet(object = GIST.result, gene.sets = gs.test, method = "enrichment") getPatternGeneSet(object = GIST.result, gene.sets = gs.test, method = "overrepresentation")
return pattern matrix from CogapsResult object
getPatternMatrix(object) ## S4 method for signature 'CogapsResult' getPatternMatrix(object)
getPatternMatrix(object) ## S4 method for signature 'CogapsResult' getPatternMatrix(object)
object |
an object of type CogapsResult |
pattern matrix
data(GIST) patternMatrix <- getPatternMatrix(GIST.result)
data(GIST) patternMatrix <- getPatternMatrix(GIST.result)
combines retina subsets from extdata directory
getRetinaSubset(n = 1)
getRetinaSubset(n = 1)
n |
number of subsets to use |
matrix of RNA counts
retSubset <- getRetinaSubset() dim(retSubset)
retSubset <- getRetinaSubset() dim(retSubset)
return sampleFactors matrix from CogapsResult object
getSampleFactors(object) ## S4 method for signature 'CogapsResult' getSampleFactors(object)
getSampleFactors(object) ## S4 method for signature 'CogapsResult' getSampleFactors(object)
object |
an object of type CogapsResult |
sampleFactors matrix
data(GIST) sFactors <- getSampleFactors(GIST.result)
data(GIST) sFactors <- getSampleFactors(GIST.result)
return the names of the genes (samples) in each subset
getSubsets(object) ## S4 method for signature 'CogapsResult' getSubsets(object)
getSubsets(object) ## S4 method for signature 'CogapsResult' getSubsets(object)
object |
an object of type CogapsResult |
CogapsParams object
data(GIST) subsets <- getSubsets(GIST.result)
data(GIST) subsets <- getSubsets(GIST.result)
return unmatched patterns from each subset
getUnmatchedPatterns(object) ## S4 method for signature 'CogapsResult' getUnmatchedPatterns(object)
getUnmatchedPatterns(object) ## S4 method for signature 'CogapsResult' getUnmatchedPatterns(object)
object |
an object of type CogapsResult |
CogapsParams object
data(GIST) unmatchedPatterns <- getUnmatchedPatterns(GIST.result)
data(GIST) unmatchedPatterns <- getUnmatchedPatterns(GIST.result)
return version number used to generate this result
getVersion(object) ## S4 method for signature 'CogapsResult' getVersion(object)
getVersion(object) ## S4 method for signature 'CogapsResult' getVersion(object)
object |
an object of type CogapsResult |
version number
data(GIST) getVersion(GIST.result)
data(GIST) getVersion(GIST.result)
GIST gene expression data from Ochs et al. (2009)
GIST gene expression data from Ochs et al. (2009)
GIST gene expression uncertainty matrix from Ochs et al. (2009)
wrapper around genome-wide distributed algorithm for CoGAPS
GWCoGAPS( data, params = new("CogapsParams"), nThreads = 1, messages = TRUE, outputFrequency = 500, uncertainty = NULL, checkpointOutFile = "gaps_checkpoint.out", checkpointInterval = 1000, checkpointInFile = NULL, transposeData = FALSE, BPPARAM = NULL, workerID = 1, asynchronousUpdates = FALSE, ... )
GWCoGAPS( data, params = new("CogapsParams"), nThreads = 1, messages = TRUE, outputFrequency = 500, uncertainty = NULL, checkpointOutFile = "gaps_checkpoint.out", checkpointInterval = 1000, checkpointInFile = NULL, transposeData = FALSE, BPPARAM = NULL, workerID = 1, asynchronousUpdates = FALSE, ... )
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 |
... |
allows for overwriting parameters in params |
CogapsResult object
## Not run: data(GIST) params <- new("CogapsParams") params <- setDistributedParams(params, nSets=2) params <- setParam(params, "nIterations", 100) params <- setParam(params, "nPatterns", 3) result <- GWCoGAPS(GIST.matrix, params, BPPARAM=BiocParallel::SerialParam()) ## End(Not run)
## Not run: data(GIST) params <- new("CogapsParams") params <- setDistributedParams(params, nSets=2) params <- setParam(params, "nIterations", 100) params <- setParam(params, "nPatterns", 3) result <- GWCoGAPS(GIST.matrix, params, BPPARAM=BiocParallel::SerialParam()) ## End(Not run)
constructor for CogapsParams
## S4 method for signature 'CogapsParams' initialize(.Object, distributed = NULL, ...)
## S4 method for signature 'CogapsParams' initialize(.Object, distributed = NULL, ...)
.Object |
CogapsParams object |
distributed |
either "genome-wide" or "single-cell" indicating which distributed algorithm should be used |
... |
initial values for slots |
initialized CogapsParams object
Constructor for CogapsResult
## S4 method for signature 'CogapsResult' initialize( .Object, Amean, Pmean, Asd, Psd, meanChiSq, geneNames, sampleNames, diagnostics = NULL, ... )
## S4 method for signature 'CogapsResult' initialize( .Object, Amean, Pmean, Asd, Psd, meanChiSq, geneNames, sampleNames, diagnostics = NULL, ... )
.Object |
CogapsResult object |
Amean |
mean of sampled A matrices |
Pmean |
mean of sampled P matrices |
Asd |
std dev of sampled A matrices |
Psd |
std dev of sampled P matrices |
meanChiSq |
mean value of ChiSq statistic |
geneNames |
names of genes in data |
sampleNames |
names of samples in data |
diagnostics |
assorted diagnostic reports from the run |
... |
initial values for slots |
initialized CogapsResult object
MANOVA statistical test–wraps base R manova
MANOVA(interestedVariables, object) ## S4 method for signature 'matrix,CogapsResult' MANOVA(interestedVariables, object)
MANOVA(interestedVariables, object) ## S4 method for signature 'matrix,CogapsResult' MANOVA(interestedVariables, object)
interestedVariables |
study design for manova |
object |
CogapsResult object |
list of manova fit results
V1..V20. some variables, for example levels of gene expression
data(modsimdata)
data(modsimdata)
'data.frame': 25 obs. of 20 variables.
Result of applying CoGAPS on the Toy example.
data(modsimresult)
data(modsimresult)
S4 class ‘CogapsResult’ [package “CoGAPS”] with 7 slots.
estimate the most associated pattern for each feature
patternMarkers(object, threshold = "all", lp = NULL, axis = 1) ## S4 method for signature 'CogapsResult' patternMarkers(object, threshold = "all", lp = NULL, axis = 1)
patternMarkers(object, threshold = "all", lp = NULL, axis = 1) ## S4 method for signature 'CogapsResult' patternMarkers(object, threshold = "all", lp = NULL, axis = 1)
object |
an object of type CogapsResult |
threshold |
the type of threshold to be used. The default "all" will
distribute features into patterns with the highest ranking as ranked by the
increasing Euclidian distance between feature loadings and |
lp |
list of vectors of weights for each pattern to be used for finding markers. If NULL, list of synthetic one-hot markers for each pattern will be generated and matched against. |
axis |
controls the matrix to use for ranking. 1 for featureLoadings, 2 for sampleFactors. |
List of: list of marker features for each pattern (best rank first), a matrix of ranks of each feature in each pattern, a matrix of scores for each feature in each pattern.
List of: list of marker features for each pattern (best rank first), and a matrix of ranks of each feature in each pattern.
data(GIST) pm <- patternMarkers(GIST.result)
data(GIST) pm <- patternMarkers(GIST.result)
generate a barchart of most significant hallmark sets for a pattern
plotPatternGeneSet(patterngeneset, whichpattern = 1, padj_threshold = 0.05) ## S4 method for signature 'list,numeric,numeric' plotPatternGeneSet(patterngeneset, whichpattern = 1, padj_threshold = 0.05)
plotPatternGeneSet(patterngeneset, whichpattern = 1, padj_threshold = 0.05) ## S4 method for signature 'list,numeric,numeric' plotPatternGeneSet(patterngeneset, whichpattern = 1, padj_threshold = 0.05)
patterngeneset |
output from getPatternGeneSet |
whichpattern |
which pattern to generate bar chart for |
padj_threshold |
maximum adjusted p-value of gene sets rendered on the resulting plot |
image object of barchart
heatmap of original data clustered by pattern markers statistic
plotPatternMarkers( object, data, patternMarkers, patternPalette, sampleNames, samplePalette = NULL, heatmapCol = bluered, colDendrogram = TRUE, scale = "row", ... )
plotPatternMarkers( object, data, patternMarkers, patternPalette, sampleNames, samplePalette = NULL, heatmapCol = bluered, colDendrogram = TRUE, scale = "row", ... )
object |
an object of type CogapsResult |
data |
the original data as a matrix |
patternMarkers |
pattern markers to be plotted, as generated by the patternMarkers function |
patternPalette |
a vector indicating what color should be used for each pattern |
sampleNames |
names of the samples to use for labeling |
samplePalette |
a vector indicating what color should be used for each sample |
heatmapCol |
pallelet giving color scheme for heatmap |
colDendrogram |
logical indicating whether to display sample dendrogram |
scale |
character indicating if the values should be centered and scaled in either the row direction or the column direction, or none. The default is "row". |
... |
additional graphical parameters to be passed to |
heatmap of the data
values for the patternMarkers
calculate residuals and produce heatmap
plotResiduals(object, data, uncertainty = NULL) ## S4 method for signature 'CogapsResult' plotResiduals(object, data, uncertainty = NULL)
plotResiduals(object, data, uncertainty = NULL) ## S4 method for signature 'CogapsResult' plotResiduals(object, data, uncertainty = NULL)
object |
an object of type CogapsResult |
data |
original data matrix run through GAPS |
uncertainty |
original standard deviation matrix run through GAPS |
creates a residual plot
data(GIST) # to expensive to call since it plots # plotResiduals(GIST.result, GIST.matrix)
data(GIST) # to expensive to call since it plots # plotResiduals(GIST.result, GIST.matrix)
reconstruct gene
reconstructGene(object, genes = NULL) ## S4 method for signature 'CogapsResult' reconstructGene(object, genes = NULL)
reconstructGene(object, genes = NULL) ## S4 method for signature 'CogapsResult' reconstructGene(object, genes = NULL)
object |
an object of type CogapsResult |
genes |
an index of the gene or genes of interest |
the D' estimate of a gene or set of genes
data(GIST) estimatedD <- reconstructGene(GIST.result)
data(GIST) estimatedD <- reconstructGene(GIST.result)
wrapper around single-cell distributed algorithm for CoGAPS
scCoGAPS( data, params = new("CogapsParams"), nThreads = 1, messages = TRUE, outputFrequency = 500, uncertainty = NULL, checkpointOutFile = "gaps_checkpoint.out", checkpointInterval = 1000, checkpointInFile = NULL, transposeData = FALSE, BPPARAM = NULL, workerID = 1, asynchronousUpdates = FALSE, ... )
scCoGAPS( data, params = new("CogapsParams"), nThreads = 1, messages = TRUE, outputFrequency = 500, uncertainty = NULL, checkpointOutFile = "gaps_checkpoint.out", checkpointInterval = 1000, checkpointInFile = NULL, transposeData = FALSE, BPPARAM = NULL, workerID = 1, asynchronousUpdates = FALSE, ... )
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 |
... |
allows for overwriting parameters in params |
CogapsResult object
## Not run: data(GIST) params <- new("CogapsParams") params <- setDistributedParams(params, nSets=2) params <- setParam(params, "nIterations", 100) params <- setParam(params, "nPatterns", 3) result <- scCoGAPS(t(GIST.matrix), params, BPPARAM=BiocParallel::SerialParam()) ## End(Not run)
## Not run: data(GIST) params <- new("CogapsParams") params <- setDistributedParams(params, nSets=2) params <- setParam(params, "nIterations", 100) params <- setParam(params, "nPatterns", 3) result <- scCoGAPS(t(GIST.matrix), params, BPPARAM=BiocParallel::SerialParam()) ## End(Not run)
these parameters are interrelated so they must be set together
setAnnotationWeights(object, annotation, weights) ## S4 method for signature 'CogapsParams' setAnnotationWeights(object, annotation, weights)
setAnnotationWeights(object, annotation, weights) ## S4 method for signature 'CogapsParams' setAnnotationWeights(object, annotation, weights)
object |
an object of type CogapsParams |
annotation |
vector of labels |
weights |
vector of weights |
the modified params object
params <- new("CogapsParams") params <- setAnnotationWeights(params, c('a', 'b', 'c'), c(1,2,1))
params <- new("CogapsParams") params <- setAnnotationWeights(params, c('a', 'b', 'c'), c(1,2,1))
these parameters are interrelated so they must be set together
setDistributedParams( object, nSets = NULL, cut = NULL, minNS = NULL, maxNS = NULL ) ## S4 method for signature 'CogapsParams' setDistributedParams( object, nSets = NULL, cut = NULL, minNS = NULL, maxNS = NULL )
setDistributedParams( object, nSets = NULL, cut = NULL, minNS = NULL, maxNS = NULL ) ## S4 method for signature 'CogapsParams' setDistributedParams( object, nSets = NULL, cut = NULL, minNS = NULL, maxNS = NULL )
object |
an object of type CogapsParams |
nSets |
number of sets to break data into |
cut |
number of branches at which to cut dendrogram used in pattern matching |
minNS |
minimum of individual set contributions a cluster must contain |
maxNS |
maximum of individual set contributions a cluster can contain |
the modified params object
params <- new("CogapsParams") params <- setDistributedParams(params, 5)
params <- new("CogapsParams") params <- setDistributedParams(params, 5)
these parameters are interrelated so they must be set together
setFixedPatterns(object, fixedPatterns, whichMatrixFixed) ## S4 method for signature 'CogapsParams' setFixedPatterns(object, fixedPatterns, whichMatrixFixed)
setFixedPatterns(object, fixedPatterns, whichMatrixFixed) ## S4 method for signature 'CogapsParams' setFixedPatterns(object, fixedPatterns, whichMatrixFixed)
object |
an object of type CogapsParams |
fixedPatterns |
values for either the A or P matrix |
whichMatrixFixed |
either 'A' or 'P' indicating which matrix is fixed |
the modified params object
params <- new("CogapsParams") data(GIST) params <- setFixedPatterns(params, getSampleFactors(GIST.result), 'P')
params <- new("CogapsParams") data(GIST) params <- setFixedPatterns(params, getSampleFactors(GIST.result), 'P')
set the value of a parameter
setParam(object, whichParam, value) ## S4 method for signature 'CogapsParams' setParam(object, whichParam, value)
setParam(object, whichParam, value) ## S4 method for signature 'CogapsParams' setParam(object, whichParam, value)
object |
an object of type CogapsParams |
whichParam |
a string with the name of the parameter to be changed |
value |
the value to set the parameter to |
the modified params object
params <- new("CogapsParams") params <- setParam(params, "seed", 123)
params <- new("CogapsParams") params <- setParam(params, "seed", 123)
save as csv
toCSV(object, save_location = ".") ## S4 method for signature 'CogapsResult,character' toCSV(object, save_location = ".")
toCSV(object, save_location = ".") ## S4 method for signature 'CogapsResult,character' toCSV(object, save_location = ".")
object |
CogapsResult object |
save_location |
directory to write to |
none