Skip to content

Repository files navigation

PRS Pipeline for Multiple Ancestries

This repository contains a set of Python scripts to:

  • prepare and filter VCF files by chromosome;
  • harmonize summary statistics with VCF variants;
  • run PRSice for one or more ancestries;
  • standardize PRS scores;
  • run logistic regression and generate ROC curves.

The main workflow is:

  1. prepare the configuration file;
  2. process the VCFs by chromosome;
  3. merge the harmonized files and sumstats by ancestry using merge_harmonized.py;
  4. run PRSice;
  5. standardize the PRS scores;
  6. run the regression with multiple PRS.

Environment Installation

In the project directory, run:

conda env create -f environment.yml
conda activate prs_env

If needed, also install manually:

pip install pandas pysam matplotlib scikit-learn statsmodels scipy

Configuration File

Edit the main configuration file:

config.ini

Example structure:

[Project]
PROJECT_NAME = Epigen

[Paths]
PRSICE = /path/to/PRSice_linux
VCF_FILE = /path/to/VCF/file_chr@.vcf.gz
MSP_FILE = /path/to/file_chr@.msp
SUMSTATS_FILE_ANCESTRY = /path/to/sumstats1.txt:AFR,/path/to/sumstats2.txt:EUR
OUTPUT_DIR = /path/to/Results

[PRS]
LD_POP = LD_POP = /path/to_LD_file/afr_all:AFR,/path/to_LD_file/eur_all:EUR
PHENO_FILE = /path/to/phenfile.tsv
BINARY_TARGET = T
COVARIATE_FILE = None
COVARIATE_TO_INCLUDE = None
PRS_MISSING = SET_ZERO
SCORE_PRS = sum

Important Notes

  • The LD_POP field can be None if there are no LD reference files.
  • The phenotype file must have at least the following columns:
    • FID
    • IID
    • status
  • The status value must be 0 or 1.
  • If there are no covariates, keep:
    • COVARIATE_FILE = None
    • COVARIATE_TO_INCLUDE = None

Script Structure

1. orquestrador.py

Responsible for:

  • splitting the VCF by chromosome;
  • generating VCFs by ancestry;
  • filtering variants against the sumstats;

Example execution:

python orquestrador.py --chroms 1 3 21 22

or

python orquestrador.py --chrom-range 1 22

2. merge_harmonized.py

Responsible for:

  • locating all harmonized VCFs by ancestry;
  • concatenating the VCFs into a single file per ancestry;
  • combining the filtered sumstats into a single consolidated file;
  • generating the .bed/.bim/.fam files required for PRSice.

Example execution:

python merge_harmonized.py

3. prs_run.py

Runs PRSice for each ancestry defined in SUMSTATS_FILE_ANCESTRY.

Example:

python prs_run.py

4. standardize_prs.py

Standardizes the PRS scores generated by PRSice and creates a file with the extension:

*.best.standardized

Example:

python standardize_prs.py

5. regression_multi_prs.py

Combines the PRS from different ancestries and performs:

  • logistic regression;
  • AUC calculation;
  • ROC curve generation;
  • combined score distribution plots.

Example:

python regression_multi_prs.py

Output Files

Results are saved in folders inside Results/, for example:

Results/
  AFR/
  EUR/
  combined/

Typical generated files:

  • *_PRS_run.best
  • *_PRS_run.best.standardized
  • *_PRS_run.summary
  • *_PRS_total_roc_curve.png
  • *_PRS_total_distribuicao_prs.png
  • *_comparacao_estatistica_*.txt

Complete Workflow Example

conda activate prs_env
python orquestrador.py --chrom-range 1 22
python merge_harmonized.py
python prs_run.py
python standardize_prs.py
python regression_multi_prs.py

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages