Skip to content
/ PRSdemo Public

Train and calculate polygenic risk scores using popular PRS methods

Notifications You must be signed in to change notification settings

svdorn/PRSdemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PRSdemo

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

Set up

  • 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
  • PRSdemo is 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.packges if you are able to
  • 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 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
    • Download PLINK

    • Unzip the downloaded file Screenshot 2023-10-17 at 1 00 33 PM

    • Move the downloaded file from your Downloads folder to your PRSdemo folder Screenshot 2023-10-17 at 1 04 53 PM

    • Rename the folder to "plink" Screenshot 2023-10-17 at 1 04 30 PM

    • For macs, you may see the following error message after downloading PLINK:

      Screenshot 2023-10-17 at 2 24 09 PM
    • 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.

      Screenshot 2023-10-17 at 2 22 42 PM

Run

  • 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:

image

About

Train and calculate polygenic risk scores using popular PRS methods

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published