arlequin: Read and Write Arlequin Files

arlequinR Documentation

Read and Write Arlequin Files

Description

Read an Arlequin-formatted project input file (.arp). Convert .arp data into gtypes object. Write an input file from a gtypes object.

Usage

arlequinRead(file)

arp2gtypes(arp, avoid.dups = FALSE)

arlequinWrite(g, file = NULL, locus = 1, haploid.microsat = FALSE)

read.arlequin(file)

write.arlequin(g, file = NULL, locus = 1)

Arguments

file

filename of an arlequin project (.arp) file. See Notes for details on how .arp files are parsed.

arp

a list of arlequin profile information and data as returned from arlequinRead.

avoid.dups

logical. Should sample identifiers be combined with strata names to avoid duplicate identifiers between strata? If set to FALSE, ids will be left unchanged, but an error will be thrown when the gtypes object is created if duplicated ids are found.

g

a gtypes object.

locus

numeric or character designation of which locus to write for haploid data.

haploid.microsat

logical. If g is a haploid object (ploidy = 1), but a DataType=MICROSAT .arp file should be written, set this to TRUE. If FALSE (default) all haploid objects will be written as DataType=FREQUENCY if no sequences are present or DataType=DNA if sequences are present.

Details

arlequinRead parses a .arp file.
arp2gtypes converts list from parsed .arp file to gtypes.
arlequinWrite writes gtypes to .arp file.

Value

arlequinRead

a list containing:

file name and full path of .arp file that was read.
profile.info list containing parameters in [[Profile]] section of .arp file. All parameters are provided. Parameters unset in .arp file are set to default values.
data.info list containing data from [[Data]] section of .arp file. Can contain elements for haplotype.definition (a data.frame), distance.matrix (a matrix), sample.data (a data.frame), or genetic.structure (a list).
arp2gtypes

a gtypes object.

arlequinWrite

the filename of the .arp file that was written.

Note

arp2gtypes() will not create a gtypes object for Arlequin projects with relative frequency data (DataType=FREQUENCY and FREQUENCY=REL). If DataType=DNA and GenotypicData=0, sequences for each haplotype or individual are assumed to be from a single locus.

Author(s)

Eric Archer eric.archer@noaa.gov

References

Excoffier, L.G. Laval, and S. Schneider (2005) Arlequin ver. 3.0: An integrated software package for population genetics data analysis. Evolutionary Bioinformatics Online 1:47-50.
Available at http://cmpg.unibe.ch/software/arlequin3/

Examples

# write test microsat data .arp file
f <- arlequinWrite(msats.g, tempfile())

# read .arp file and show structure
msats.arp <- arlequinRead(f)
print(str(msats.arp))

# convert parsed data to gtypes object
msats.arp.g <- arp2gtypes(msats.arp)
msats.arp.g

# compare to original
msats.g


EricArcher/strataG documentation built on Feb. 12, 2023, 4:11 a.m.