tess2tess3: Import input files from the STRUCTURE and TESS formats

View source: R/utils.R

tess2tess3R Documentation

Import input files from the STRUCTURE and TESS formats

Description

This function converts data imported from the STRUCTURE format or from the TESS 2.3 format to the tess3 matrix format.

Usage

tess2tess3(dataframe = NULL, TESS = TRUE, diploid = TRUE, FORMAT = 1,
  extra.row = 0, extra.column = 0)

Arguments

dataframe

a data frame read from a STRUCTURE or a TESS input file. Missing data must be encoded by "-9" or by any negative value.

TESS

a boolean value set to TRUE if the TESS format is used, FALSE if the STRUCTURE format is used. If TRUE, the geographic coordinates (Longitude, Latitude) must be binded left to the matrix of genetic markers.

diploid

a boolean value set to TRUE for diploids and FALSE for haploids.

FORMAT

an integer value equal to 1 for markers encoded using one row of data for each individual, and 2 for markers encoded using two rows of data for each individual.

extra.row

an integer value indicating the number of extra rows in the header of the input file (marker ids).

extra.column

an integer value indicating the number of extra columns in the input file. Extra columns can include individual ids, pop ids, phenotypes, and they come before the geographic coordinates in TESS input files. Geographic coordinates must be considered as extra columns if the flag TESS is set to TESS = FALSE.

Value

An object of class list containing a genotype matrix (X) and individual geographic coordinates (coord).

X a numeric matrix of genotypes with values 0,1,2 or NA.

coord a numeric matrix of geographic coordinates.

Author(s)

Kevin Caye, Flora Jay, Olivier François

See Also

tess3

Examples

library(tess3r)
data(durand09)
d09tess3 <- tess2tess3(durand09, FORMAT = 2, extra.column = 1)
obj <- tess3(X = d09tess3$X, coord = d09tess3$coord,
             K = 1:3, ploidy = 2, openMP.core.num = 4)
Qmatrix <- qmatrix(obj, K = 3)
barplot(Qmatrix, sort.by.Q = FALSE, border = NA,
        space = 0, xlab = "Individuals", ylab = "Ancestry coefficients") -> bp
axis(1, at = 1:nrow(Qmatrix), labels = bp$order, las = 3, cex.axis = .2)

bcm-uga/TESS3_encho_sen documentation built on June 30, 2023, 3:08 a.m.