Title: | Correlation Motif Fit |
---|---|
Description: | It fits correlation motif model to multiple studies to detect study specific differential expression patterns. |
Authors: | Hongkai Ji, Yingying Wei |
Maintainer: | Yingying Wei <[email protected]> |
License: | GPL-2 |
Version: | 1.53.0 |
Built: | 2024-12-09 06:30:38 UTC |
Source: | https://github.com/bioc/Cormotif |
These functions are not part of the package application programming interface and are not recommended to be used by the users.
modt.f0.loglike modt.f1.loglike cmfit cmfitall cmfitsep cmfitfull limmafit generatetype
modt.f0.loglike modt.f1.loglike cmfit cmfitall cmfitsep cmfitfull limmafit generatetype
Ji, H., Wei, Y.,(2011) Correlation Motif. Unpublished
This function fits the Correlation Motif model to multiple expression studies. It gives the fitted values for the probability distribution of each motif, the fitted values of the given correlation matrix and the posterior probability for each gene to be differentially expressed in each study.
cormotiffit(exprs,groupid,compid,K=1, tol=1e-3, max.iter=100, BIC=TRUE)
cormotiffit(exprs,groupid,compid,K=1, tol=1e-3, max.iter=100, BIC=TRUE)
exprs |
a matrix, the expression data after normalization that is on log2 scale, each row of the matrix corresponds to a gene and each column of the matrix corresponds to a sample array. |
groupid |
the group label for each sample array, two arrays in the same study with same experinment condition |
compid |
the study design and comparison matrix, each row of the matrix corresponds to one study with the first column being the first experinment condition and the second column being the second experinment condition. |
K |
a vector, each element specifing the number of motifs a model wants to fit. |
tol |
the relative tolerance level of error. |
max.iter |
maximun number of iterations. |
BIC |
default is BIC=TRUE, selecting the model with the lowest BIC value among all fitted models; if BIC=FALSE, selecting the model with the lowest AIC value among all fitted models. |
For the i^th element of , the function fits total number of
motifs to the data. Each gene can belong to one of the
possible motifs according to prior probability distribution,
. For genes in motif
, the probability that they are differentially expressed in study
is
. One should indicate the groupid and compid for each study clearly.
bestmotif$p.post |
the posterior probability for each gene to be differentially expressed in each study for the best fitted model |
bestmotif$motif.prior |
fitted values of the probability distribution of different motifs for the best fitted model |
bestmotif$motif.q |
fitted values of the correlation motif matrix for the best fitted model |
bestmotif$loglike |
log-likelihood of the best fitted model |
bic |
the BIC values of all fitted models |
aic |
the AIC values of all fitted models |
loglike |
log-likelihood of all fitted models |
Hongkai Ji, Yingying Wei
Ji, H., Wei, Y.,(2011) Correlation Motif. Unpublished
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to m exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group label for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit 2 correlation motifs to the data motif.fitted<-cormotiffit(exprs.simu2, simu2_groupid,simu2_compgroup,K=2)
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to m exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group label for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit 2 correlation motifs to the data motif.fitted<-cormotiffit(exprs.simu2, simu2_groupid,simu2_compgroup,K=2)
This function assumes that a gene is either differentially expressed in all studies or is not differentially expressed in any study. It gives the fitted values for the probability distribution of motif (0,0,...0) and motif (1,1,...,1), and the posterior probability for each gene to be differentially expressed in all studies.
cormotiffitall(exprs,groupid,compid, tol=1e-3, max.iter=100)
cormotiffitall(exprs,groupid,compid, tol=1e-3, max.iter=100)
exprs |
a matrix, the expression data after normalization that is on log2 scale, each row of the matrix corresponds to a gene and each column of the matrix corresponds to a sample array. |
groupid |
the group label for each sample array, two arrays in the same study with same experinment condition |
compid |
the study design and comparison matrix, each row of the matrix corresponds to one study with the first column being the first experinment condition and the second column being the second experinment condition |
tol |
the relative tolerance level of error. |
max.iter |
maximun number of iterations. |
The difference between and
is that
forces the motif to be one of the two patterns but
allows motif patterns other than (0,...,0) and (1,..,1).
p.post |
the posterior probability for each gene to be differentially expressed |
motif.prior |
fitted values of the probability distribution of motif (0,0,...0) and motif (1,1,...,1) |
loglike |
log-likelihood of the fitted model |
Hongkai Ji, Yingying Wei
Ji, H., Wei, Y.,(2011) Correlation Motif. Unpublished
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to m exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group label for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit the two motifs (0,0,...0) and (1,1,...,1) to the data motif.fitted.all<-cormotiffitall(exprs.simu2, simu2_groupid,simu2_compgroup)
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to m exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group label for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit the two motifs (0,0,...0) and (1,1,...,1) to the data motif.fitted.all<-cormotiffitall(exprs.simu2, simu2_groupid,simu2_compgroup)
This function fits the data to the model with all possible 0-1 patterns, where
is the number of studies.
cormotiffitfull(exprs,groupid,compid, tol=1e-3, max.iter=100)
cormotiffitfull(exprs,groupid,compid, tol=1e-3, max.iter=100)
exprs |
a matrix, the expression data after normalization that is on log2 scale, each row of the matrix corresponds to a gene and each column of the matrix corresponds to a sample array. |
groupid |
the group label for each sample array, two arrays in the same study with same experinment condition |
compid |
the study design and comparison matrix, each row of the matrix corresponds to one study with the first column being the first experinment condition and the second column being the second experinment condition |
tol |
the relative tolerance level of error. |
max.iter |
maximun number of iterations. |
The difference between and
is that
forces motif to be one of the those 0-1 patterns. For
, the motif does not necessarily to be of either 1 or 0, such as (0,1,..,0). It could be (0.9,0.4,...,0.2).
p.post |
the posterior probability for each gene to be differentially expressed. |
motif.prior |
fitted values of the probability distribution of the |
loglike |
log-likelihood of the fitted model. |
Hongkai Ji, Yingying Wei
Ji, H., Wei, Y.,(2011) Correlation Motif. Unpublished
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to m exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group ID number for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit 2^D 0-1 motifs to the data motif.fitted.sep<-cormotiffitfull(exprs.simu2, simu2_groupid,simu2_compgroup)
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to m exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group ID number for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit 2^D 0-1 motifs to the data motif.fitted.sep<-cormotiffitfull(exprs.simu2, simu2_groupid,simu2_compgroup)
This function fits a mixture modified t-distribution model to each study seperately.
cormotiffitsep(exprs,groupid,compid, tol=1e-3, max.iter=100)
cormotiffitsep(exprs,groupid,compid, tol=1e-3, max.iter=100)
exprs |
a matrix, the expression data after normalization that is on log2 scale, each row of the matrix corresponds to a gene and each column of the matrix corresponds to a sample array. |
groupid |
the group label for each sample array, two arrays in the same study with same experinment condition |
compid |
the study design and comparison matrix, each row of the matrix corresponds to one study with the first column being the first experinment condition and the second column being the second experinment condition |
tol |
the relative tolerance level of error. |
max.iter |
maximun number of iterations. |
p.post |
the posterior probability for each gene to be differentially expressed. |
motif.prior |
fitted values of the probability for genes to be differentially expressed in each study, a |
loglike |
log-likelihood of the fitted model. |
Hongkai Ji, Yingying Wei
Ji, H., Wei, Y.,(2011) Correlation Motif. Unpublished
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to m exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group ID number for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit seperate models to each study motif.fitted.sep<-cormotiffitsep(exprs.simu2, simu2_groupid,simu2_compgroup)
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to m exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group ID number for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit seperate models to each study motif.fitted.sep<-cormotiffitsep(exprs.simu2, simu2_groupid,simu2_compgroup)
This function rank the genes according to the decreasing order of the given statistics.
generank(x)
generank(x)
x |
A |
The function returns a matrix of index of top ranked genes in each study according to the decreasing order of statistics in that study.
Hongkai Ji, Yingying Wei
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to m exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group ID number for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit 2 correlation motif to the data motif.fitted<-cormotiffit(exprs.simu2, simu2_groupid,simu2_compgroup,K=2) #give the gene index list according to the decreasing order of #posterior probability for a gene to be differentially expressed in each study generank(motif.fitted$bestmotif$p.post)
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to m exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group ID number for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit 2 correlation motif to the data motif.fitted<-cormotiffit(exprs.simu2, simu2_groupid,simu2_compgroup,K=2) #give the gene index list according to the decreasing order of #posterior probability for a gene to be differentially expressed in each study generank(motif.fitted$bestmotif$p.post)
This function plots BIC and AIC values for all fitted motif models.
plotIC(fitted_cormotif)
plotIC(fitted_cormotif)
fitted_cormotif |
The object obtained from cormotiffit. |
The left graph is the BIC plot and the right graph is the AIC plot.
Hongkai Ji, Yingying Wei
Ji, H., Wei, Y.,(2011) Correlation Motif. Unpublished
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to \eqn{m} exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group ID number for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit 2 correlation motif to the data motif.fitted<-cormotiffit(exprs.simu2, simu2_groupid,simu2_compgroup,K=2) plotIC(motif.fitted)
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to \eqn{m} exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group ID number for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit 2 correlation motif to the data motif.fitted<-cormotiffit(exprs.simu2, simu2_groupid,simu2_compgroup,K=2) plotIC(motif.fitted)
This function plots the Correlation Motif patterns and the associated prior probability distributions.
plotMotif(fitted_cormotif,title="")
plotMotif(fitted_cormotif,title="")
fitted_cormotif |
The object obtained from cormotiffit. |
title |
The title for the graph. |
Each row in both graphs corresponds to one motif pattern. The left graph shows the correlation motif pattern. The grey color scale of cell indicates the probability that motif
is differentially expressed in study
. Each row of the bar chart corresponds
to the motif pattern in the same row of the left pattern graph. The length of
the bar in the bar chart shows the number of genes of the given pattern in the
dataset, which is equal to
multiplying
the number of total genes.
Hongkai Ji, Yingying Wei
Ji, H., Wei, Y.,(2011) Correlation Motif. Unpublished
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to m exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group ID number for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit 2 correlation motif to the data motif.fitted<-cormotiffit(exprs.simu2, simu2_groupid,simu2_compgroup,K=2) plotMotif(motif.fitted)
data(simudata2) n<-nrow(simudata2) m<-ncol(simudata2) #the expression data is from the second column to m exprs.simu2<-as.matrix(simudata2[,2:m]) #prepare the group ID number for each sample array data(simu2_groupid) #prepare the design matrix for each group of samples data(simu2_compgroup) #fit 2 correlation motif to the data motif.fitted<-cormotiffit(exprs.simu2, simu2_groupid,simu2_compgroup,K=2) plotMotif(motif.fitted)
Here we present three files needed for the various Correlation Motif fit functions.
simudata2 are combined from four studies sharing the same 3,000 genes, each having two experiment conditions and three samples for each condition. simudata2 saves the expression values for all genes and all sample arrays on log2 scale; simu2_groupid prepares the group label for each sample; and simu2_compgroup describes the study design
Ji, H., Wei, Y.,(2011) Correlation Motif. Unpublished