[adegenet-forum] data file import

Jombart, Thibaut t.jombart at imperial.ac.uk
Wed Aug 17 22:55:27 CEST 2011

Hello Chris, 

that's a tricky bit, since genind/genpop objects were not originally designed to handle different ploidy in the same dataset. However, genind codes allele data as frequencies, so in principle it can store data with heterogeneous ploidy.

It is a kludge, but the simplest way to proceed is probably to recode your haploid loci as diploid with twice the same allele. Then read the entire dataset as a table and use df2genind to convert it, specifying "ploidy=2". It is not pretty, but will do the job.

Note that you can duplicate the alleles for your haploid loci easily using paste; for instance:
> x <- c("111","100","80","88","101") # x replaces the haploid locus - say a microsat
> y <- paste(x,x,sep="/")
> y
[1] "111/111" "100/100" "80/80"   "88/88"   "101/101"

(use whatever you used in the diploid dataset as a separator)

All the best


From: adegenet-forum-bounces at r-forge.wu-wien.ac.at [adegenet-forum-bounces at r-forge.wu-wien.ac.at] on behalf of Christopher Balakrishnan [cbala at igb.uiuc.edu]
Sent: 17 August 2011 17:35
To: adegenet-forum at r-forge.wu-wien.ac.at
Subject: [adegenet-forum] data file import

Hi everyone,

I am trying to import a dataset into adegenet and am having some

The issue I think stems from the fact that I have both haploid and
diploid data.   I have the diploid portion of the data in genepop
format and can import with no problem. Is there a way to add a single
haploid locus to that?

I also have all of the data in a structure file. For the haploid locus
the second allele is coded as missing (-9) following the structure
convention. I can't seem to import the data this way (possibly
unrelated "unexpected symbol" error) and I'm not sure it would be
appropriate to code the data this way in adegenet anyway?

Lastly, I've tried to import the data as a simple table (read.table),
but the portion of the manual that describes how to specify ploidy
(and populations) is a bit unclear to me.

Thanks very much for any help (or pointing to previous posts).

adegenet-forum mailing list
adegenet-forum at lists.r-forge.r-project.org

More information about the adegenet-forum mailing list