fn.ab {QSutils} | R Documentation

## Vector of abundances with different methods

### Description

Function to simulate haplotype abundances in the quasispecies.

### Usage

    fn.ab(n, h = 10000, r = 0.5,fn="pcf")

### Arguments

`n` | Number of counts to compute.
`h` | Highest abundance value.
`r` | A number to compute the abundance. See details.
`fn` | Character indicating which function to use to compute the abundances "pf","pcf" or "dfp", see details. By default "pcf".

### Details

The abundances computed as a power of fractions, when fn is "pf", are computed according to the following equation, taking the integer part:

max(h r^{(i-1)},1); ~~ 0<r<1; ~~ i=1..n

The lower `r`, the faster the decrease in abundance, `r` is in the range 0 < r < 1.

With "pcf" the abundances are computed by a power of decreasing fractions, as counts, according to the following equation, taking the integer part:

max(h ~ ≤ft( \frac{1}{i} \right) ^r,1); ~~ r>0; ~~i=1..n

The higher `r,` the faster the decrease in abundances. In this case `r` corresponds to the power of the function, a value larger than 0, usually in the range 0.5 < r < 4.

If fn is equal to "dfp", the abundances are computed by increasing root powers according to the following equation,taking the integer part:

max(h^{(1/i)},1); ~~ i=1..n

### Value

Numeric vector with `n` decreasing counts, where the first element equals `h`, and no element is lower than 1.

### Author(s)

Mercedes Guerrero-Murillo and Josep Gregori

### See Also

`geom.series`,`GetRandomSeq`, `GenerateVars`,`Diverge`

### Examples

    # Simulate a quasispecies alignment.
    m1 <- GetRandomSeq(50)
    v1 <- GenerateVars(m1,50,2,c(10,1))
    qs <- c(m1,v1)
    w_pf <- fn.ab(length(qs),h=1000,r=1.5,fn="pf")
    w_pf
    w_pcf <- fn.ab(length(qs),h=1000,r=1.5,fn="pcf")
    w_pcf
    w_dfp <- fn.ab(length(qs),h=1000,fn="dfp")
    w_dfp

[Package QSutils version 1.2.0 Index]