Learn R Programming

gtx (version 0.0.8)

read.snpdata.plink: Read genotype dosages in the format output by PLINK.

Description

Reads genotype dosages as output by PLINK using the --recodeA option, and combines these with information about coded and noncoded alleles from information output by PLINK using the --freq option.

Usage

read.snpdata.plink(fileroot, tol.af = 0.01, phenotypes = NULL)

Arguments

fileroot
a filename root to which .frq and .raw extensions will be appended
tol.af
a tolerence for checking allele frequencies between the two files read
phenotypes
if not null, a data frame of phenotypes to be merged with the genotypes; must contain columns called FID and IID

Value

Returns a list with snpinfo and data slots, see snpdata.

Details

Run PLINK twice, once with --freq and once with --recodeA, and with otherwise identical options for e.g. individual and SNP inclusions and exclusions, in order to make suitable files for this function to read.

References

Information about PLINK and its input and output data formats can be found at http://pngu.mgh.harvard.edu/~purcell/plink.

Examples

Run this code
## Not run: 
# mypheno <- read.table("MYPHENO.dat", header = TRUE,
#                       as.is = TRUE, na.strings = c("NA", "-9"))
# system("plink --bfile MYBED --freq --out MYEXPORT")
# system("plink --bfile MYBED --recodeA --out MYEXPORT")
# mydata <- read.snpdata.plink("MYEXPORT", phenotypes = mypheno)
# ## End(Not run)

Run the code above in your browser using DataLab