coseq {coseq} | R Documentation |
This is the primary user interface for the coseq
package.
Generic S4 methods are implemented to perform co-expression or co-abudance analysis of
high-throughput sequencing data, with or without data transformation, using K-means or mixture models.
The supported classes are matrix
, data.frame
, and DESeqDataSet
.
The output of coseq
is an S4 object of class coseqResults
.
coseq(object, ...) ## S4 method for signature 'matrix' coseq( object, K, subset = NULL, model = "kmeans", transformation = "logclr", normFactors = "TMM", meanFilterCutoff = NULL, modelChoice = ifelse(model == "kmeans", "DDSE", "ICL"), parallel = FALSE, BPPARAM = bpparam(), seed = NULL, ... ) ## S4 method for signature 'data.frame' coseq( object, K, subset = NULL, model = "kmeans", transformation = "logclr", normFactors = "TMM", meanFilterCutoff = NULL, modelChoice = ifelse(model == "kmeans", "DDSE", "ICL"), parallel = FALSE, BPPARAM = bpparam(), seed = NULL, ... ) ## S4 method for signature 'DESeqDataSet' coseq( object, K, model = "kmeans", transformation = "logclr", normFactors = "TMM", meanFilterCutoff = NULL, modelChoice = ifelse(model == "kmeans", "DDSE", "ICL"), parallel = FALSE, BPPARAM = bpparam(), seed = NULL, ... )
object |
Data to be clustered. May be provided as a y (n x q)
matrix or data.frame of observed counts for n
observations and q variables, or an object of class |
... |
Additional optional parameters. |
K |
Number of clusters (a single value or a vector of values) |
subset |
Optional vector providing the indices of a subset of
genes that should be used for the co-expression analysis (i.e., row indices
of the data matrix |
model |
Type of mixture model to use (“ |
transformation |
Transformation type to be used: “ |
normFactors |
The type of estimator to be used to normalize for differences in
library size: (“ |
meanFilterCutoff |
Value used to filter low mean normalized counts if desired (by default, set to a value of 50) |
modelChoice |
Criterion used to select the best model. For Gaussian mixture models,
“ |
parallel |
If |
BPPARAM |
Optional parameter object passed internally to |
seed |
If desired, an integer defining the seed of the random number generator. If
|
An S4 object of class coseqResults
, where conditional
probabilities of cluster membership for each gene in each model is stored as a SimpleList of assay
data, and the corresponding log likelihood, ICL value, number of
clusters, and form of Gaussian model for each model are stored as metadata.
Andrea Rau
## Simulate toy data, n = 300 observations set.seed(12345) countmat <- matrix(runif(300*4, min=0, max=500), nrow=300, ncol=4) countmat <- countmat[which(rowSums(countmat) > 0),] conds <- rep(c("A","B","C","D"), each=2) ## Run the Normal mixture model for K = 2,3,4 run_arcsin <- coseq(object=countmat, K=2:4, iter=5, transformation="arcsin", model="Normal", seed=12345) run_arcsin ## Plot and summarize results plot(run_arcsin) summary(run_arcsin) ## Compare ARI values for all models (no plot generated here) ARI <- compareARI(run_arcsin, plot=FALSE) ## Compare ICL values for models with arcsin and logit transformations run_logit <- coseq(object=countmat, K=2:4, iter=5, transformation="logit", model="Normal") compareICL(list(run_arcsin, run_logit)) ## Use accessor functions to explore results clusters(run_arcsin) likelihood(run_arcsin) nbCluster(run_arcsin) ICL(run_arcsin) ## Examine transformed counts and profiles used for graphing tcounts(run_arcsin) profiles(run_arcsin) ## Run the K-means algorithm for logclr profiles for K = 2,..., 20 run_kmeans <- coseq(object=countmat, K=2:20, transformation="logclr", model="kmeans") run_kmeans