Learn R Programming

graph4lg (version 1.8.0)

gstud_to_genind: Convert a file from gstudio or popgraph into a genind object

Description

The function converts a file formatted to use gstudio or popgraph package into a genind object (adegenet package)

Usage

gstud_to_genind(x, pop_col, ind_col = NULL)

Value

An object of class genind.

Arguments

x

An object of class data.frame with loci columns in format locus (defined in package gstudio) with as many rows as individuals and as many columns in format locus as there are loci and additional columns

pop_col

A character string indicating the name of the column with populations' names in x

ind_col

(optional) A character string indicating the name of the column with individuals' ID in x

Author

P. Savary

Details

This function uses functions from pegas package. It can handle genetic data where alleles codings do not have same length, (99:101, for example). If the names of the loci include '.' characters, they will be replaced by '_'.

Examples

Run this code
data("data_ex_gstud")
x <- data_ex_gstud
pop_col <- "POP"
ind_col <- "ID"
data_genind <- gstud_to_genind(x, pop_col, ind_col)

Run the code above in your browser using DataLab