Plink: How do I run an association analysis?
0
0
Entering edit mode
2.8 years ago

First, I filtered out SNPs and subjects and then performed MDS analysis.

./plink --file subjects_153 --maf 0.1 --geno 0.1 --mind 0.3 --hwe 0.001 --recode

    ./plink --noweb --file filtered --genome --out filtered
    ./plink --cluster --file filtered --mds-plot 2 --noweb --out filtered --read-genome filtered.genome

Now, I want to run an association analysis using linear regression to identify SNPs associated with bipolar disorder (compare bipolar subjects to the control subjects). I also want to include information regarding primary eigenvector from the MDS calculation, Gender, and Left Brain (fixed/frozen). I want to report the disease status in a separate file).

Essentially, I want to create 3 files:

  • subjects to keep for the study (--keep)
  • covariates (--covar)
  • affected status (--pheno)
`d <- read.table("filtered.mds", header=T)
ann <- read.table("clinical_table.txt", header=T, sep="\t")`


 `# Add hyphens to the Family IDs
 d$FID <- sub("(\\D)(\\d)", "\\1-\\2", d$FID)
ann$Database_ID <- d$FID`

`dat <- as.data.frame(cbind(ann$Profile, d$C1, d$C2))`

`library(data.table)
fwrite(dat, "mycov.txt", sep="\t")`

`./plink --noweb --ped filtered.ped --map filtered.map --logistic --covar mycov.txt
./plink --file filtered --make-bed`

`pheno <- read.table("plink.fam", header=T)
fwrite(pheno, "pheno.txt", sep="\t"`

`library(dplyr)
bdf <- d %>% semi_join(ann %>% filter(Profile=="BP"||Profile==”Unaffected control”), by=c("FID"="Database_ID"))
fwrite(bdf, "keep.txt", sep="\t")
./plink --file plink.fam --keep keep.txt`

Traceback:

Error: Basic file conversions do not support regular filtering operations. Rerun your command with --make-bed.

snps Plink • 561 views
ADD COMMENT

Login before adding your answer.

Traffic: 1964 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