The joint information content (mutual information) for an alignment is computed. Considering the gap problem there are four ways to compute it.
1 
aln 
matrix of which the mutual information will be computed 
method 
method, that is used for the computation (see details) 
gapchar 
symbols of the input matrix that should be handled as gaps. These symbols are omitted in the computations (see details) 
nullmod 
integer specifying how many shuffle runs should be performed 
logMI 
boolean, if TRUE the log(MI) will be calculated, default is FALSE 
Methods: The mutual information (MI) is computed as follows:
I(X,Y)=sum_(x in X) sum_(y in Y) p(x,y) log_2(p(x,y)/(p(x) p(y)))
I(X,Y)=H(X)+H(Y)H(X,Y)
In the ORiginal MI gaps are treated simply as any other character.
The SUbset MI omits for each pair of columns all the rows with at least one gap character for the computation.
In the Delta Entropy MI the entropies for the columns are computed separately by leaving out any gap characters. The joint entropy also considers only rows without any gap character. DEMI follows as H(X)+H(Y)H(X,Y).
The Enhanced Sampling MI omits the gap characters and rows with gaps for the computation of the probabilities. The information content is computed via the probabilites.
The null model is computed by shuffling each column content and computing the resulting MI. Over all shuffle runs the MI values in each entry of the matrix is averaged. The averaged squared MI values and the variance is computed as well.
Return value is the MI matrix per default.
If a null model should be computed the returned value is a list of matrices.

MI matrix 

MI matrix of the null model 

matrix of the averaged MI squared values for the null model 

matrix of the variance of each MI value over the whole shuffle run for the null model 
Franziska Hoffgaard
get.entropy
, get.entropy2p
, freq1p
, freq2p
1 2 3 4 5 6 7 8  seqa<unlist(strsplit("PQITLWQRPLVTIKIGGQL",split=""))
seqb<unlist(strsplit("PQITLWKRPLVTIRIGGQL",split=""))
seqc<unlist(strsplit("PQITLWQRPLVTIKIGGQL",split=""))
a<matrix(c(seqa,seqb,seqc),nrow=3,byrow=TRUE)
mi<get.mie(a)
mi2<get.mie(a, method = "SUMI", gapchar = "")
mi_null<get.mie(a,nullmod=100)
mi2_null<get.mie(a, method = "SUMI", gapchar = "",nullmod=100)

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.