This function fits the Correlation Motif model to multiple RNAseq or ChIPseq 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 SNP to be allelespecific events (allelespecific expression or allelespecific binding).
1  iASeqmotif(exprs,studyid,repid,refid,K,iter.max=100,tol=1e3)

exprs 
A matrix, each row of the matrix corresponds to a heterozygotic SNP and each column of the matrix corresponds to the reads count for either the reference allele or nonreference allele in a replicate of a study. 
studyid 
The group label for each column of exprs matrix. all columns in the same study have the same studyid. 
repid 
The sample label for each column of exprs matrix. The two columns within the same sample, one for reference allele and the other for nonreference allele, have the same repid. In other words, repid discriminates the different replicates within the same study. 
refid 
The reference allele label for each column of exprs matrix. Please code 0 for reference allele columns and 1 for nonreference allele columns to make the interpretation of over expressed(or bound) to be skewing to the reference allele. Otherwise, just interpret the other way round. 
K 
A vector, each element specifing the number of nonnull motifs a model wants to fit. 
tol 
The relative tolerance level of error. 
iter.max 
Maximun number of iterations. 
For the i^th element of K, the function fits total number of K[i]+1 motifs, K[i] nonnull motifs and the null motif, to the data. Each SNP can belong to one of the K[i]+1 possible motifs according to prior probability distribution, motif.prior. For SNPs in motif j (j>=1), the probability that they are over expressed (or bound) for the reference allele in study d is motif.qup(j,d) and the probability that they are under expressed (or bound) is motif.qdown(j,d). One should indicate the studyid, repid and refid for each column clearly.
bestmotif$p.post 
The posterior probability for each SNP to be allelespecific event. A vector whose length correpsonds to the number of SNPs. 
bestmotif$motif.prior 
Fitted values of the probability distribution of the K[i]+1 motifs for the best fitted model, the first element specifies the null motif and the 2nd to K[i]+1th element correspond to the K[i] nonnull motifs. 
bestmotif$motif.qup 
Fitted values of the over expressed (or bound) correlation motif matrix for the best fitted model. Each row corresponds to a nonnull motif and each column corresponds to a study. 
bestmotif$motif.qdown 
Fitted values of the under expressed (or bound) correlation motif matrix for the best fitted model. Each row corresponds to a nonnull motif and each column corresponds to a study. 
bestmotif$clustlike 
Posterior probability for a SNP to belong to a specific motif based on the best fitted model. Each row corresponds to a SNP and each column corresponds to a motif class. 
bestmotif$c0j 
α parameter for the null beta prior distribution for each sample. 
bestmotif$d0j 
β parameter for the null beta prior distribution for each sample. 
bestmotif$loglike 
The loglikelihood for the best fitted model. 
bic 
The BIC values of all fitted models. A matrix whose first column is the same as input motif number vector ('K') and the second column corresponds to the BIC value of model given by the motif number in the first column in the same row. 
loglike 
The loglikelihood of all fitted models. A matrix whose first column is the same as input motif number vector ('K') and the second column corresponds to the log likelihood value of the model given by the motif number in the first column in the same row. 
Yingying Wei, Hongkai Ji
Yingying Wei, Xia Li, Qianfei Wang, Hongkai Ji(2012) iASeq: integrating multiple ChIPseq datasets for detecting allelespecific binding.
plotBIC
, plotMotif
, sampleASE
1 2 3 4  data(sampleASE)
#fit 1 to 2 nonnull correlation motifs to the data
motif.fitted<iASeqmotif(sampleASE_exprs,sampleASE_studyid,sampleASE_repid,sampleASE_refid,
K=1:2,iter.max=2,tol=1e3)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.