[adegenet-forum] Removing Non-biallelic samples
Zhian Kamvar
zkamvar at gmail.com
Tue Nov 21 16:29:23 CET 2017
Hi Sheena,
The solution to your question is the following (change "dat" to whatever you named your genind):
loci_to_keep <- nAll(dat) < 3
trimmed_dat <- dat[loc = loci_to_keep]
The reason why this works:
nAll() gives you the number of alleles per locus in your genind object. The vector loci_to_keep is a logical vector specifying which loci have fewer than three alleles. When used with the loc subsettor for the genind object, it will remove all the loci where the corresponding entry in loci_to_keep is FALSE.
Hope that helps,
Zhian
-----
Zhian N. Kamvar, Ph. D.
Postdoctoral Researcher (Everhart Lab)
Department of Plant Pathology
University of Nebraska-Lincoln
ORCID: 0000-0003-1458-7108
>
> Date: Tue, 21 Nov 2017 11:49:36 +0200
> From: sheena talma <sheenatalma at gmail.com>
> To: adegenet-forum at lists.r-forge.r-project.org
> Subject: [adegenet-forum] Removing Non-biallelic samples
> Message-ID: <8F2E6BCC-85AA-4DFC-ACF0-1454F1B9A2C0 at gmail.com>
> Content-Type: text/plain; charset=us-ascii
>
> Hi,
>
> I am new to R and programming.
>
> Does any one know whether there is a way to remove non- biallelic SNPs using R?
>
> Thanks
>
> Sheena
>
> ------------------------------
>
> _______________________________________________
> adegenet-forum mailing list
> adegenet-forum at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171121/eb67e7b0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171121/eb67e7b0/attachment.sig>
More information about the adegenet-forum
mailing list