[adegenet-forum] 'removing loci with a logical' & 'n.pca for DAPC'

Frederik Van den Broeck Frederik.VandenBroeck at bio.kuleuven.be
Fri Mar 23 11:26:00 CET 2012


I eventually found the problem in my script. This works now:

> keep <- which(summary$Hobs < 0.5)
> keep <- names(keep)
> d.genind[loc=keep]


From: Frederik Van den Broeck
Sent: Thursday, March 22, 2012 1:04 PM
To: adegenet-forum at r-forge.wu-wien.ac.at
Subject: RE: 'removing loci with a logical' & 'n.pca for DAPC'

Dear Dr. Thibaut,

Thank you very much for your answer. All my questions are for genind objects, not for genlight objects.
Sorry for the misunderstanding, I guess observed heterozygosity larger than 0.5 for SNPs is definitely possible, although not likely to occur frequently. However, in my dataset I have about 120 loci / 6000 loci that show an Hobs larger than 0.5. I believe this more likely due to paralogues genes. Therefore, to play safe, I would like to remove these loci from my dataset. When I do the following, it returns an error however:

> keep <- which(summary$Hobs < 0.5)
> d.genind[keep,]
Error in .local(x, i, j, ..., drop = drop) : subscript out of bounds

What went wrong? Possibly my script is not correct?

My second question was similar to the first one. Say out of 6000 loci I have only 2 loci that I want to remove, namely loc3342 and loc5201. How can this be done? In the vignettes the following script can be found for instance:

d.genind[loc = c("locX1","locX2",etc.)]

But this statement keeps loci within the genind object, and removes all the others. But I want to remove 2 out of 6000 loci, it would be much easier to remove these loci than keeping 5998 loci. So I putted a minus '-' before the c(), thinking that would instead of keeping those loci, remove those loci from the genind object.

d.genind[loc = -c("loc3342","loc5201")]

But this returns an error.

Probably I missed something, but I'm already looking for the solution for some time and tried many different things, but it doesn't work. So I hoped you could help and say what is wrong in my scripts?

Thank you very much in advance for your answer.


More information about the adegenet-forum mailing list