This is a demo of a PRS script that allows you to automatically train and run PRS scores across all popular PRS methods. Currently the demo will only work for LDpred2 and a simple PRS scoring method so the demo can be done in a timely fashion.
Used for a workshop titled Frontiers of PGS Construction, and Use in the Social Sciences, Integrating Genetics and the Social Sciences 2023 Conference, Boulder, CO link
- Clone this repo into a folder on your local computer
git clone https://github.com/svdorn/PRSdemo.git
- Change directory into PRSdemo folder
cd PRSdemo
-
PRSdemois developed using R. The statistical computing software R (>=4.3) is required.- The following packages are necessary for running
PRSdemo, but they will be automatically installed for you when you run the demo if you don't already have them installed. Required R packages: tidyverse, data.table, R.utils, plyr, bigsnpr, bigreadr, optparse, foreach, rngtools- Please download these R packages ahead of the demo using
install.packgesif you are able to
- Please download these R packages ahead of the demo using
- The following packages are necessary for running
-
Make output folder for PRS weights
mkdir weights
- Download LD and GWAS data and put it in the input folder
If you don't already have wget downloaded on your computer, follow the following tutorials to download it on your machine.
- Download and Install wget on Mac
- Download and Install wget on Linux
- Download and Install wget on Windows
Download the LD and GWAS data using wget
wget -nd -r -P ./input ftp://ftp.biostat.wisc.edu/pub/lu_group/Projects/PRS_demo/input
- Download PLINK
-
Move the downloaded file from your Downloads folder to your
PRSdemofolder
-
For macs, you may see the following error message after downloading PLINK:
-
If you get this error go to System Settings -> Privacy & Security and scroll down until you get to this section. Allow PLINK to be downloaded and try downloading again.
- To run the script to get PRS scores, run
bash calculate_prs.sh \
-s ./input/gwas_train.txt.gz \
-l ./input/1kg_hm3_QCed_noM \
-g ./input/1kg_hm3_QCed_noM \
-p ./plink \
-m ldpred2,prs \
-o mac
Where flags are
- -s: path to sumstats_file
- -l: path to LD files
- -g: path to genotype file
- -p: path to PLINK software
- -m: PRS methods you want to run
- -o: opterating system (mac, windows, or linux)
If you are using a Windows machine, follow this tutorial for running .sh scripts in Windows
Output will be written to prs_scores.txt and the first few rows of data will look like:


