Skip to content

hailianghuang/efficientPCA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

----------------------
Copyright
----------------------
Copyright (c) 2015, Hailiang Huang and Mark J Daly, Analytic and Translational Genetics Unit, Massachusetts General Hospital, Boston MA
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.

----------------------
Synopsis
----------------------
efficientPCA is a package developed by Hailiang Huang in Mark J Daly's lab. This package efficiently calculates the principal components for controlling population stratification in genetic studies. Please email Hailiang Huang (hhuang AT atgu.mgh.harvard.edu) if you have any question.

----------------------
Prerequisites
----------------------
BLAS and LAPACK packages are needed for compiling efficientPCA.  If you are using a cluster, the two packages may have been installed.  Please contact your system admin if you have problem compiling efficientPCA.  If you are using your own computer, please instal the two packages following instructions on their websites listed below.  For Mac OSX, you may need to install GNU Fortran compiler before you install the two packages (see the third link for more details).

1. BLAS: www.netlib.org/blas/
2. LAPACK: www.netlib.org/lapack/
3. GNU Fortran on Mac OSX: http://hpc.sourceforge.net

----------------------
Compile
----------------------
Once you have installed BLAS and LAPACK, change to the efficientPCA folder and type "make".  Warnings can be safely ignored.  Error messages, if any, are likely due to the fact that BLAS or LAPACK were not properly installed (or installed to a none-standard location).  Please confirm your BLAS and LAPACK installations and compile efficientPCA again.

----------------------
Usage
----------------------
An example dataset was provided to demonstrate how to use efficientPCA.  This example was generated by LD pruning (3 times) the chromosome 22 of all CEU founders (112 samples) in Hapmap3.  PLINK is needed to use this example, which can be downloaded from http://pngu.mgh.harvard.edu/~purcell/plink/.  To run this tutorial, simply type "./example/run.sh" in your terminal.  Detailed explanations are:

1. Generate the correlation matrix for SNPs (in real analysis, this should be done only using controls)
	>mkdir ./example/result/
	>plink --bfile example/dat/example --r --matrix --out example/result/cor

2. Calculate the loadings of SNPs and the axes. The parameters are 1)the number of SNPs, 2) number of principal components and 3) input directory
	> nSNP=`wc -l ./example/dat/example.bim | awk '{print $1}'`
	> ./getPCA $nSNP 100 ./example/result/
	
3. Project the samples to the axes
	> plink --bfile example/dat/example --recodeA --out example/result/geno
	> nSample=`wc -l ./example/dat/example.fam  | awk '{print $1}'`
	> ./getMult $nSNP 100 $nSample ./example/result/

4. Principal components are saved as ./example/result/pcs.txt. 

5. A R script (example/PCA_alt.r) calculates principal components in R and compares the components from effcientPCA.  



About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published