LTPI
(Liability Threshold-based Phenotype Integration) is a statistical framework designed to predict genetic liability for diseases by leveraging related phenotypes in EHR. The risk score construction utilizes the GHK algorithm and maximum likelihood estimation, with efficacy that can be further enhanced through automated feature selection.
LTPI
operates through three analysis modes:
- Binary phenotype analysis (
--bin
): Merges all binary traits to estimate genetic liability. - Continuous phenotype analysis (
--con
): Combines the results from--bin
with continuous traits to generate the final LTPI score. - Trait selection optimization (
--pick
): Identifies and selects the most important traits based on ther2_o
criterion, refining the analysis for optimal results.
Important: Two steps—--bin
and --con
—must be run sequentially to obtain the final LTPI score. Skipping any step may result in incomplete analysis. --pick
is optional, but it usually improves the performance.
- GHK Algorithm and Maximum Likelihood Estimation: Provides accurate genetic liability estimates.
- Covariance Shrinkage: Enhances model stability by applying shrinkage to covariance matrices, especially when analyzing a large number of traits.
- Automated Trait Selection: Utilizes the
r2_o
criterion to automatically select the most relevant non-target traits, enhancing prediction accuracy.
To install LTPI
using a conda environment, follow these steps:
-
Clone the repository:
git clone https://github.com/cuelee/LTPI.git cd LTPI
-
Create the conda environment from the
environment.yml
file:conda env create -f environment.yml
-
Activate the environment:
conda activate LTPI
If you prefer to manually install the dependencies, follow these steps:
-
Clone the repository:
git clone https://github.com/cuelee/LTPI.git cd LTPI
-
Install the required dependencies manually using
pip
:pip install numpy pandas scipy scikit-learn numba argparse
LTPI
provides three analysis modes depending on the input data:
- Binary Phenotype Analysis (
--bin
): Estimates genetic liability based on binary traits. Requires binary input, prevalence data, and covariance matrices (--gencov
,--envcov
). - Continuous Phenotype Analysis (
--con
): Integrates continuous traits with the results from binary trait analysis. Requires the binary output from--bin
(--bout
), continuous input, and covariance matrices. - Trait Selection Optimization (
--pick
): Optionally selects the most relevant non-target traits to enhance genetic liability prediction. Requires a disease of interest (--pi
) and genetic covariance matrices (--gencov
), applicable to either--bin
or--con
.
Specify the required core arguments for each mode and optional parameters like covariance matrices to fine-tune the analysis.
Argument | Description | Required? |
---|---|---|
--bin |
Path to binary phenotype input file. | Yes |
--prevalence |
Path to disease prevalence file. | Yes |
--gencov |
Path to genetic covariance matrix. | Yes |
--envcov |
Path to environmental covariance matrix. | Optional |
Argument | Description | Required? |
---|---|---|
--con |
Path to continuous phenotype input file. | Yes |
--bout |
--out from previous binary analysis. |
Yes |
--gencov |
Path to genetic covariance matrix. | Yes |
--envcov |
Path to environmental covariance matrix. | Optional |
Argument | Description | Required? |
---|---|---|
--pick |
Optimize non-target trait selection based on r2_o . |
Yes |
--gencov |
Path to genetic covariance matrix. | Yes |
--pi |
Target column name for trait selection. | Yes |
--Q |
Number of non-target traits to select (default: 30). | No |
Argument | Description | Required? |
---|---|---|
--gencov |
Path to genetic covariance matrix. | Optional |
--envcov |
Path to environmental covariance matrix. | Optional |
--shrink |
Apply covariance shrinkage: G for gencov , E for envcov , B for both. |
Optional |
--shrink_target |
Target condition number for covariance shrinkage (default: 1.5). | No |
Argument | Description | Default |
---|---|---|
--rint |
Apply rank-based inverse normal transformation to LTPI scores. | False |
--nsample |
Number of samples for GHK algorithm. | 50000 |
--r2 |
Threshold value for trait selection analysis. | 0.0 |
Argument | Description | Default |
---|---|---|
--out |
Prefix for output files. | LTPI |
(Used with --bin
, --con
)
A tab-delimited text file where the first column must be labeled IID
for individual IDs, followed by columns for each trait.
- Binary traits are coded as
1
(case) and0
(control), withNA
for missing values. - Continuous traits should follow a standard normal distribution with a mean of
0
and variance of1
. Missing phenotypes should be labeled asNA
. If your data does not meet these criteria, you can use the Rank-Based Inverse Normal Transformation (RINT) for normalization. This is optional but recommended for continuous data.
You can find the RINT.py
script for performing this transformation in the utility folder of the repository LINK.
(Used with --gencov
, --envcov
)
A tab-delimited matrix file where the first row contains trait IDs, and the subsequent rows form an n x n
matrix of covariance values for n
traits. Missing values (NA
) are not allowed.
(Used with --prevalence
)
A two-column tab-delimited file with TID
for trait IDs and prev
for disease prevalence. This file is required for binary traits.
Note: We assume that the biobank EHR data approximates population prevalence. However, users should consider potential biases introduced by the biobank's data collection process, especially if the data contains sampling bias.
After running the LTPI analysis, the following output files will be generated with the corresponding suffixes:
-
{out}.config_summary
Contains three columns:CONF
: Configurations (case-control status).EG
: Estimated genetic liabilities.G_SE
: Standard error of EG.
-
{out}.ltpi_scores.gz
Contains three columns:IID
: Individual ID.LTPI
: LTPI score for each individual.CONF
: Configurations (case-control status).
-
{out}.shrinkage_value
Contains a single value representing the shrinkage value used in the ATSA analysis. -
{out}.r2_summary
A three-column file with multiple rows, where each row represents a trait:TID
: Trait IDR2
: Cumulative R2 for the trait and all traits listed above it.COND
: Estimated condition number for the genetic covariance matrix corresponding to the cumulative R2.
-
{out}.selected_traits
A single-column file listing the traits selected by ATSA.
LTPI
includes a runnable example script (runexample.bash
). To run all analysis modes:
bash runexample.bash
python LTPI.py --bin example/binput.txt --gencov example/genetic_covariance_bin.txt --prevalence example/prevalence.txt --out test_bin
python LTPI.py --con example/qinput.txt --gencov example/genetic_covariance_con.txt --bout test_bin --out test_con
python LTPI.py --pick --pi trait_C --gencov example/genetic_covariance_bin.txt --out test_pick
For inquiries, support, or feedback, submit an issue on GitHub or contact:
Cue Hyunkyu Lee
Columbia University
Email: hl3565@cumc.columbia.edu