thibautjombart / adegenet

adegenet: a R package for the multivariate analysis of genetic markers
169 stars 64 forks source link

How to migrate genind objects to newer version of adegenet? #356

Closed romunov closed 10 months ago

romunov commented 1 year ago

Is there a way to migrate genind objects created with older adegenet (say 1.4.1) and preserve the number of alleles?

My initial idea was to use genind2df and dump the data into a tsv file. Then I would upgrade adegenet and import the dataset using df2genind. However, some (empty) loci, due to genind2df design, do not get saved into a data.frame and are lost.

Any thoughts on the subject are welcome.

zkamvar commented 10 months ago

I know this may be a little late for you, but I think you might be able to brute-force it by extracting @tab, multiply it by the ploidy (and convert to integer) to get allele counts (instead of allele fraction) and create a new object using the genind() constructor.