Learn R Programming

strataG (version 2.0.2)

nucleotideDiversity: Nucleotide Diversity

Description

Calculate nucleotide diversity for set of haplotypes.

Usage

nucleotideDiversity(x, bases = c("a", "c", "g", "t"), simplify = TRUE)

Arguments

x

a set of sequences or a '>gtypes object with sequences.

bases

nucleotides to consider when calculating diversity.

simplify

if TRUE and only one loci exists, return a vector, otherwise, a list of vectors with one element per locus will be returned.

Value

Nucleotide diversity by site.

Examples

Run this code
# NOT RUN {
data(dolph.strata)
data(dolph.seqs)
strata <- dolph.strata$fine
names(strata) <- dolph.strata$ids
dloop <- sequence2gtypes(dolph.seqs, strata, seq.names = "dLoop")

nucleotideDiversity(dloop)

# }

Run the code above in your browser using DataLab