[adegenet-forum] df2genind returns wrong number of alleles - genotype code 0(homo), 1(homo), 2(hetero)

Laura Taillebois Laura.Taillebois at cdu.edu.au
Fri Oct 28 04:18:24 CEST 2016


Hi All adegenet guru,

I am having troubles getting df2genind function to find the correct number of alleles in my dataset.

My data are SNPs data (2 alleles at each locus). The genotypes are encoded in one single column such as 0=reference homozygote, 1=SNP homozygote and 2=heterozygote. And I importe them as data frame from a comma separated .csv file.

When I apply the function df2genind,

genind <- df2genind(locus, sep=",", ncode=1, NA.char="NA", ploidy=2)

the genind object returned is as follow:

/// GENIND OBJECT /////////

 // 1 individual; 2,078 loci; 5,752 alleles; size: 1.2 Mb

 // Basic content
   @tab:  1 x 5752 matrix of allele counts
   @loc.n.all: number of alleles per locus (range: 2-3)
   @loc.fac: locus factor for the 5752 columns of @tab
   @all.names: list of allele names for each locus
   @ploidy: ploidy of each individual  (range: 2-2)
   @type:  codom
   @call: .local(x = x, i = i, j = j, drop = drop)

 // Optional content
   - empty -

There should be only 4,158 alleles in the object and not 5,752. Is there a problem with using this type of 0,1,2 code for the genotypes? Should my input have 2 columns for each genotype ?

Thanks for your support!

Cheers, Laura
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20161028/ba8ac996/attachment.html>


More information about the adegenet-forum mailing list