thibautjombart / adegenet

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

snapclust on genlight data #258

Open Ram-Nagar opened 5 years ago

Ram-Nagar commented 5 years ago

Hi Thibaut, I am trying to use snapclust for hybrids identification in a diploid plant pathogenic fungs. I have genome-wide variants data of 110 individuals in a multi-sample vcf file. I read the multisample vcf file into R with vcfR tools reads vcf and then convert it to greenlight objects with the function vcf2genlight (vcfR).

When I use snapclust to find the k, it thows an error the command: a.clust <- snapclust(gl.WGab, k = 6) the error: Error in snapclust(gl.WGab, k = 6) : x is not a valid genind object

So wondering if snapclust can be used for genlight objects or not.

Thanks Ram

zkamvar commented 5 years ago

Hi @Ram-Nagar,

In short, no, snapclust does not support genlight objects, mainly because there's currently no method for converting genlight to genpop. My suggestion would be to use PCA to find the loci that contribute most to the structure of your data and create a genind object from that subset.