Learn R Programming

assignPOP (version 1.3.0)

read.Structure: Read Structure format file

Description

This function allows you to import a STRUCTURE format file into R. The first row should be locus name (either with or withour column names for sample ID and population label); the first column should be sample ID; the second column should be population label; the rest are genotype. Use "-9" for missing alleles.

Usage

read.Structure(x, ploidy = 2)

Value

This function returns a list comprising three elements. 1. YOU_NAME_IT$DataMatrix: A matrix of genetic data with a population name label ($popNameVector) in the last column. 2. YOU_NAME_IT$SampleID: A vector of sample ID. 3. YOU_NAME_IT$LocusName: A vector of locus name.

Arguments

x

STRUCTURE file or path to the file. The filename extension (e.g., .txt) should be included.

ploidy

An integer of 1, 2, 3, or 4, to indicate haploid, diploid, triploid, or tetraploid data. Default is 2 (diploid).

References

Pritchard, J.K., Stephens, M. and Donnelly, P., 2000. Inference of population structure using multilocus genotype data. Genetics, 155(2), pp.945-959.

Examples

Run this code
# infile <- read.Structure("Your_Structure_File.txt")

Run the code above in your browser using DataLab