Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gendata.to.genind

Convert Data to genind Format


Description

This is a function for exporting data to the package adegenet.

Usage

gendata.to.genind(object, samples = Samples(object), loci = Loci(object))

Arguments

object

A "genambig" or (preferably) a "genbinary" object.

samples

A character vector indicating the samples to include in the output.

loci

A character vector indicating the loci to include in the output.

Details

gendata.to.genind converts a "genambig" or "genbinary" object to a "genind" object using the package adegenet. Each individual must have a single ploidy. Ploidy and population information are carried over to the new object. Data will be coded as presence/absence in the new object. The locus names in the new object are locus and allele names seperated by a hyphen.

adegenet must be installed in order to use this function.

Value

A genetic dataset in the "genind" class, ready for use in adegenet.

Author(s)

Lindsay V. Clark

References

Jombart, T. (2008) adegenet: a R package for the multivariate analysis of genetic markers. Bioinformatics 24, 1403–1405.

See Also

Examples

# create a "genambig" object
mydata <- new("genambig", samples=c("a","b","c","d"), loci=c("e","f"))
PopNames(mydata) <- c("G","H")
PopInfo(mydata) <- c(1,1,2,2)
mydata <- reformatPloidies(mydata, output="one")
Ploidies(mydata) <- 3
Genotypes(mydata, loci="e") <- list(c(100),c(100,102),
                                    c(98,102,104),c(102,106))
Genotypes(mydata, loci="f") <- list(c(200,202,204),Missing(mydata),
                                    c(210,212),c(204,210,214))

# convert to "genind"
if(require("adegenet")){
  mydata2 <- gendata.to.genind(mydata)
  mydata2@tab
  locNames(mydata2)
  indNames(mydata2)
  popNames(mydata2)
  pop(mydata2)
}

polysat

Tools for Polyploid Microsatellite Analysis

v1.7-4
GPL-2
Authors
Lindsay V. Clark [aut, cre] (<https://orcid.org/0000-0002-3881-9252>), Alistair J. Hall [ctb] (<https://orcid.org/0000-0001-9293-8909>), Handunnethi Nihal de Silva [ctb], Tyler William Smith [ctb] (<https://orcid.org/0000-0001-7683-2653>)
Initial release
2019-03-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.