gstud_to_genind: Convert a file from 'gstudio' or 'popgraph' into a genind...

View source: R/gstud_to_genind.R

gstud_to_genindR Documentation

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)

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

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 '_'.

Value

An object of class genind.

Author(s)

P. Savary

Examples

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

graph4lg documentation built on May 18, 2022, 5:09 p.m.