rarefaction: Rarefaction curves for a pan-genome

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

View source: R/rarefaction.R

Description

Computes rarefaction curves for a number of random permutations of genomes.

Usage

1
rarefaction(pan.matrix, n.perm = 1)

Arguments

pan.matrix

A pan-matrix, see panMatrix for details.

n.perm

The number of random genome orderings to use. If n.perm=1 the fixed order of the genomes in pan.matrix is used.

Details

A rarefaction curve is simply the cumulative number of unique gene clusters we observe as more and more genomes are being considered. The shape of this curve will depend on the order of the genomes. This function will typically compute rarefaction curves for a number of (n.perm) orderings. By using a large number of permutations, and then averaging over the results, the effect of any particular ordering is smoothed.

The averaged curve illustrates how many new gene clusters we observe for each new genome. If this levels out and becomes flat, it means we expect few, if any, new gene clusters by sequencing more genomes. The function heaps can be used to estimate population openness based on this principle.

Value

A table with the curves in the columns. The first column is the number of genomes, while all other columns are the cumulative number of clusters, one column for each permutation.

Author(s)

Lars Snipen and Kristian Hovde Liland.

See Also

heaps, panMatrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Loading a pan-matrix in this package 
data(xmpl.panmat)

# Rarefaction
rar.tbl <- rarefaction(xmpl.panmat, n.perm = 1000)

## Not run: 
# Plotting
library(ggplot2)
library(tidyr)
rar.tbl %>% 
  gather(key = "Permutation", value = "Clusters", -Genome) %>% 
  ggplot(aes(x = Genome, y = Clusters, group = Permutation)) +
    geom_line()

## End(Not run)

micropan documentation built on July 15, 2020, 5:08 p.m.