Learn R Programming

strataG (version 2.4.905)

arlequin: 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)

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.

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.

Details

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

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

Run this code
# NOT RUN {
# 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

# }

Run the code above in your browser using DataLab