Learn R Programming

BioPhysConnectoR (version 1.6-5)

get.freqs: Compute the Frequencies in an Alignment

Description

One and two point frequencies of a specified column or specified columns are computed for a given alignment.

Usage

freq1p(aln, i = NULL)

freq2p(i, aln, j2 = NULL, lett = NULL, cluster = NULL)

Arguments

aln
alignment
i
reference column for the frequency computation
j2
columns to compute the two point frequency together with column i
lett
character vector containing the unique alphabet of the alignment
cluster
snow cluster object created with makeCluster()

Value

  • A matrix is returned for the freq2p(). For freq1p(), if no i is specified, a matrix containing the frequencies of the symbols in the alignment is returned. For a certain i a vector with the respective frequencies of the symbols is the result.

Details

The columns j2 are the specified columns (not i) to compute the frequencies and the rows represent all possible two letter pairs according to the alphabet. The computation of freq2p() is parallelized using parLapply() from the package snow. If cluster is left at its default value the computation is carried out in serial.

References

Tierney, Rossini, Li (2009) Int J Parallel Proc 37, 78--90.

See Also

get.entropy, get.mie

Examples

Run this code
seqa<-unlist(strsplit("PQITLWQRPLVTIKIGGQL",split=""))
seqb<-unlist(strsplit("PQITLWKRPLVTIRIGGQL",split=""))
seqc<-unlist(strsplit("PQITLWQRPLVTIKIGGQL",split=""))
aln<-matrix(c(seqa,seqb,seqc),nrow=3,byrow=TRUE)
f1<-freq1p(aln)
f1a<-freq1p(aln, 1)
f2<-freq2p(1, aln, 2:10)
## Cluster example
clu<-makeCluster(2)
f2<-freq2p(1, aln, 2:10, cluster=clu)
stopCluster(clu)

Run the code above in your browser using DataLab