bcm-uga / pcadapt

Performing highly efficient genome scans for local adaptation with R package pcadapt v4
https://bcm-uga.github.io/pcadapt
39 stars 10 forks source link

How to extract genetic matrix from pcadapt object Inbox #75

Closed jpfontenelle closed 2 years ago

jpfontenelle commented 2 years ago

Hello Florian and all.

I am trying to extract the genetic matrix from a pcadapt object that is produced with the function pcadapt() of your package.

I am importing a .bed file generated with vcftools using the read.pcadapt() function with type = "bed", and this object is then provided to the function pcadapt()

I've read on the manual that K is calculated by pcadapt() using a PCA. I wonder if I could access the input matrix for such PCA as I'd like to explore it with a bit more detail, since my simulated data is showing inconsistencies depending on the input I use.

I don't know if you can help me with this but I tried to also use read.pcadapt on a genind@tab, using "lfmm" as the type. It works, but then I see an additional column there that does not correspond to genotype (0/1/2), hence creating some weird noise in the results. Would be appropriate to manually remove those extra columns and just leave the genotype as columns and individuals as rows, as expected for a lfmm matrix?

Thanks for your time and help,

JP

privefl commented 2 years ago

You can use either:

jpfontenelle commented 2 years ago

Thanks Florian! Cheers JP