readSpagedi: Read SPAGeDi input from file and convert to sgsObj object

Description Usage Arguments Value Details Examples

View source: R/dataio.R

Description

This function reads a SPAGeDi formatted text file (tab delimited text) and converts it to an sgsObj.

Usage

1
readSpagedi(path_to_spagedi_file, missing_val = "-999")

Arguments

path_to_spagedi_file

A file path pointing to SPAGeDi input file. Must point to a tab delimited text file in following format in SPAGeDi manual (see details below).

missing_val

Value indidicating missing data. Default is -999

Value

An object of the class sgsObj, which is used for futher sgs analyses.

Details

SPAGeDi (Spatial Pattern Analysis of Genetic Diversity) is a popular program for calculating spatial genetic structure, among other things. More information about SPAGeDi can be found at their hompage here.

Data format should follow the style described in section 3.1 of the SPAGeDi manual.

File should be a tab delimited text file.

Briefly, the first line is a series of 6 numbers separated by tabs: number of individuals, number of categories, number of spatial coordinates, number of loci, number of digits used to code one allele, and ploidy.

The second line indicates the distance intervals (which can be changed after inputting file).

The third line lists the column names for individuals, categories, spatial coordinates, and loci.

The fourth line begins the sample ID, category, spatial coordinate, and genotype data, with each line representing an individual.

END is entered in the line after the last individual.

Note: This function as been tested only for diploid genetic data in 2d coordinate systems.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
## Read in example data provided with package
path_to_example_data <- system.file("extdata", "obataua_spagedi.txt", package = "sgsR")

## Use readSpagedi to read and convert data to sgsObj
dat <- readSpagedi(path_to_example_data, missing_val = "0")

dat

## End(Not run)

lukembrowne/sgsR documentation built on May 21, 2019, 8:58 a.m.