How do I use PLINK to filter out SNPs?
1
0
Entering edit mode
2.2 years ago

I want to run analysis to filter out SNPs based on the following criteria: (a) <5% missingness rate per SNP (b) MAF >10% (c) <20% missingness rate per subject (d) HWE significance at p<.001

# Load the ped and map files
library(snpStats)
dat <- snpStats::read.pedfile(file = "./data/ped_final_re_MHC_mod.ped", snps = "./data/ped_final_re_MHC_mod.map")

library(plink)
plink --noweb --file ped_final_re_MHC_mod --geno 0.05 --maf 0.1 --mind 0.2 --hwe 0.001 --recode 

Traceback:

Error: unexpected symbol in "plink --noweb --file ped_final_re_MHC_mod"

PLINK r SNPS • 970 views
ADD COMMENT
0
Entering edit mode
2.2 years ago
Sam ★ 4.7k

Why don't you just run the script with bash instead of using it in R? Pretty sure you can't just type the plink code in R (unless you are just extracting part of your code, which make it difficult for us to know what's going on).

As for the error message, assuming your code is calling the plink execution via the command line, it is likely that your plink executable is not available in ${PATH} so you might need to either install plink in your ${PATH} or give the full path of plink to your command.

Side note: Your plink version is also very old (don't think --noweb is required for 1.9 onwards). Latest plink can be downloaded here: https://www.cog-genomics.org/plink/1.9/

ADD COMMENT
0
Entering edit mode

why important snps remove in --geno 0.2 filter steps ? i have gwas study in plink but remove important snps in alzheimer disease ( rs429358) --geno step. pls explain @Sam

ADD REPLY

Login before adding your answer.

Traffic: 2616 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6