\documentclass[a4paper]{article} \usepackage{Sweave} \title{Example analysis} \author{YuriiA} \begin{document} \maketitle \section{Import data to GenABEL} Load library <<>>= library(GenABEL) @ Convert TPED files to GA format <<>>= convert.snp.tped(tped="../usePrimitive/plink.tped",tfam="../usePrimitive/plink.tfam",out="plink.raw") @ Load the data into R <<>>= dta <- load.gwaa.data(pheno="../usePrimitive/phenotypes.txt",geno="plink.raw") @ \section{Quality control} Use following threshold parameters <<>>= thMAF <- 0.01 thHWE <- 1e-6 @ for quality control <<>>= qc <- check.marker(dta,maf=thMAF,p.lev=thHWE) @ summary of excluded snps and ids <<>>= summary(qc) @ clean the data <<>>= dtaQCed <- dta[qc$idok,qc$snpok] @ generate per-snp summary <<>>= smr <- summary(gtdata(dtaQCed)) smr[1:3,] @ draw a hystogram of effect alelle frequency \begin{figure}[t] \centering <>= hist(smr$Q.2) @ \end{figure} \section{Analysis of association} What phenotypes are there? <<>>= phdata(dtaQCed)[1:3,] @ Analyse association using the score test <<>>= qts <- qtscore(coolTrait ~ sex, data = dtaQCed) @ Show top results <<>>= summary(qts) @ Display graphics \begin{figure}[t] \centering <>= plot(qts) abline(h=-log10(5e-8)) @ \end{figure} \end{document}