freq2p: Compute the Frequencies in an Alignment

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/freqs.r

Description

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

Usage

1
2
3
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()

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.

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.

Author(s)

Franziska Hoffgaard, Philipp Weil

References

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

See Also

get.entropy, get.mie

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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)
## Not run: 
## Cluster example
clu<-makeCluster(2)
f2<-freq2p(1, aln, 2:10, cluster=clu)
stopCluster(clu)

## End(Not run)

BioPhysConnectoR documentation built on May 30, 2017, 6:46 a.m.