[adegenet-forum] extracting subset of SNPs with the highest weight

Jean-Luc LEGRAS legrasjl at supagro.inra.fr
Wed Jun 24 16:04:41 CEST 2015

I am using adegenet 1.4-2 on a set of genomic data. I have convert my data to  the plink raw format, in 326000 snp for 82 diploid individuals. All variant position have an ID chromosomenumber+coordinates.
I performed a PCA on genotypes which separates nicely the main groups and I wanted to extract snps which have the highest  contribution  (5%) of the PCA to make a subset of the initial genotypes matrix. I can obtain the list of snps with the highest loadings but I cannot The problem is that when using subset I obtain an empty list:. Is this wrong? Do you have any suggestions?

Thank you in advance.
Best regards.
here is the code I used:

GWEVariant <- read.PLINK(file="GWE.raw",map.file = "GWE.map",multicore= FALSE)

GWEVariant.PCA <-glPca(GWEVariant, center = TRUE, scale = FALSE, nf = 7, loadings = TRUE, alleleAsUnit = FALSE, useC = TRUE,n.cores = 4, returnDotProd=FALSE, matDotProd=NULL)
DTloadings<- data.frame(GWEVariant at loc.names,GWEVariant.PCA$loadings)

top <-matrix(nrow=7,ncol=2)
liste <-list()
for (i in 1:7) {
top[i,1]<-quantile(DTloadings[, i+1], probs = .025)
top[i,2]<-quantile(DTloadings[, i+1], probs = .975)
liste <-  which(DTloadings[,i+1]<top[i,1] | DTloadings[,i+1]>top[i,2])

Mqdiscriminants <-unique(Mqdiscriminants)


More information about the adegenet-forum mailing list