GeneticResources / polyfun

PolyFun (POLYgenic FUNctionally-informed fine-mapping)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PolyFun, PolyLoc and PolyPred

PolyFun (POLYgenic FUNctionally-informed fine-mapping)
PolyLoc (POLYgenic LOCalization of complex trait heritability)
PolyPred (POLYgenic Prediction of complex traits)

This page contains the code of the methods PolyFun for functionally-informed fine-mapping, PolyLoc for polygenic localization of complex trait heritability, and PolyPred for complex trait prediction. PolyFun and PolyLoc are described in Weissbrod et al. 2020 Nat Genet. PolyPred is described in Weissbrod*, Kanai*, Shi* et al. 2021 medRxiv.

PolyFun estimates prior causal probabilities for SNPs, which can then be used by fine-mapping methods like SuSiE or FINEMAP. Unlike previous methods for functionally-informed fine-mapping, PolyFun can aggregate polygenic data from across the entire genome and hundreds of functional annotations.

PolyLoc generalizes fine-mapping by constructing minimal sets of SNPs that causally explain a given proportion (e.g. 50%) of SNP heritability.

PolyPred exploits fine-mapping to improve trans-ethnic polygenic risk scores, by predicting using causal effect estimates intead of tagging effect estimates.

We also provide a script called finemapper that facilitates fine-mapping with methods like SuSiE, saving many of the preprocessing steps often required to perform fine-mapping (e.g. handling allelic flips between the summary statistics and reference genotypes).

The files in the ldstore directory are an adaptation of the ldstore package (written by Christian Benner) to Python 3.



Manual

We provide a detailed manual of PolyFun, PolyLoc and PolyPred in the Wiki page. If you run into any issues, please check the FAQ first.



Installation

We provide several installation options.

Install option 1: Create an Anaconda environment

The easiest way to install polyfun is by creating a dedicated environment through the Anaconda Python distribution. To do this, please install Anaconda on your machine and then type the following commands:

git clone https://github.com/omerwe/polyfun
cd polyfun
conda env create -f polyfun.yml
conda activate polyfun

This will install all the dependencies except for SuSiE, FINEMAP, and LDstore You can use PolyFun without these packages to compute prior causal probabilities, but you won't be able to apply the actual fine-mapping. Please see installation instructions for these three packages below.

After the installation, you can always invoke the PolyFun environment with the command conda activate polyfun. We recommend that you frequently make sure you have the latest version of polyfun installed by going to the polyfun directory and typing git pull.

Install option 2: Manually install packages

PolyFun and PolyLoc are designed for Python >=3.6 and require the following freely available Python packages:

It is recommended (but not required) to also install the following:

If rpy2 or Ckmeans.1d.dp are not installed, PolyFun and PolyLoc will fallback to suboptimal clustering via scikit-learn.

The finemapper script also requires the following:

  1. A fine-mapping package you'd like to use. At the moment we support susieR and FINEMAP v1.4. Please see installation instructions for these packages below.
  2. (optional) The program LDstore 2.0 for computing LD directly from .bgen files (imputed genotypes)

We recommend running PolyFun/PolyLoc via the Anaconda Python distribution. In Anaconda, you can install all the Python packages with the command "conda install <package_name>". Alternatively, the Python packages can be installed with the command "pip install --user <package_name>".

Once all the prerequisite packages are installed, you can install PolyFun/PolyLoc on a git-enabled machine by typing:

git clone https://github.com/omerwe/polyfun

We recommend that you frequently make sure you have the latest version of polyfun installed by going to the polyfun directory and typing git pull.

Installing SuSiE

To install SuSiE, please start an R shell (usually by typing R) and then type:

devtools::install_github("stephenslab/susieR@0.8.0",build_vignettes=FALSE)

If this doesn't work, please refer to the SuSiE website for more information, or contact the SuSiE authors through the SuSiE Github page.

Installing FINEMAP v1.4

To install FINEMAP v1.4, please type one of the following two commands:
If you use Linux:

wget http://www.christianbenner.com/finemap_v1.4_x86_64.tgz
tar xvf finemap_v1.4_x86_64.tgz

If you use Mac OS X :

wget http://www.christianbenner.com/finemap_v1.4_MacOSX.tgz
tar xvf finemap_v1.4_MacOSX.tgz

Installing LDstore 2.0

To install LDstore, please type one of the following two commands:
If you use Linux:

wget http://www.christianbenner.com/ldstore_v2.0_x86_64.tgz
tar xzvf ldstore_v2.0_x86_64.tgz

If you use Mac OS X :

wget http://www.christianbenner.com/ldstore_v2.0_MacOSX.tgz
tar xzvf ldstore_v2.0_MacOSX.tgz



Testing the installation

We recommend testing PolyFun by invoking the script:

python test_polyfun.py --python3 <python3_exe>

where python3_exe (optional) is the command you type to start a python3 session (default is python). If the script completes without an error, everything is fine. If you see any errors, please consult the FAQ.



Contact

For questions and comments, please open a Github issue (preferred) or contact Omer Weissbrod at oweissbrod[at]hsph.harvard.edu

About

PolyFun (POLYgenic FUNctionally-informed fine-mapping)

License:MIT License


Languages

Language:Python 99.8%Language:MATLAB 0.2%