base.freq: Base frequencies from DNA Sequences

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

View source: R/DNA.R

Description

base.freq computes the frequencies (absolute or relative) of the four DNA bases (adenine, cytosine, guanine, and thymidine) from a sample of sequences.

GC.content computes the proportion of G+C (using the previous function). All missing or unknown sites are ignored.

Ftab computes the contingency table with the absolute frequencies of the DNA bases from a pair of sequences.

Usage

1
2
3
base.freq(x, freq = FALSE, all = FALSE)
GC.content(x)
Ftab(x, y = NULL)

Arguments

x

a vector, a matrix, or a list which contains the DNA sequences.

y

a vector with a single DNA sequence.

freq

a logical specifying whether to return the proportions (the default) or the absolute frequencies (counts).

all

a logical; by default only the counts of A, C, G, and T are returned. If all = TRUE, all counts of bases, ambiguous codes, missing data, and alignment gaps are returned.

Details

The base frequencies are computed over all sequences in the sample.

For Ftab, if the argument y is given then both x and y are coerced as vectors and must be of equal length. If y is not given, x must be a matrix or a list and only the two first sequences are used.

Value

A numeric vector with names c("a", "c", "g", "t") (and possibly "r", "m", ..., a single numeric value, or a four by four matrix with similar dimnames.

Author(s)

Emmanuel Paradis

See Also

seg.sites, nuc.div (in pegas), DNAbin

Examples

1
2
3
4
5
6
7
8

Example output

        a         c         g         t 
0.3065414 0.2613083 0.1260264 0.3061239 
   a    c    g    t 
4405 3755 1811 4399 
   a    c    g    t    r    m    w    s    k    y    v    h    d    b    n    - 
4405 3755 1811 4399    0    0    0    0    0    0    0    0    0    0  105    0 
   ? 
   0 
[1] 0.3873347
    a   c   g   t
a 287   0   2   0
c   0 247   0   5
g   5   0 119   0
t   0   4   0 290
    a   c   g   t
a 287   0   2   0
c   0 247   0   5
g   5   0 119   0
t   0   4   0 290
    a   c   g   t
a 292   1   1   0
c   0 246   0   3
g   1   0 120   1
t   0  10   0 283

ape documentation built on April 25, 2021, 9:06 a.m.