Example

Try AGENT-P on example data in Google Colab, without installing anything, or run the same example on your computer.

1.Run it in Google Colab

The example notebook runs in Google Colab, with nothing to install on your computer. Open the example in Colab, then choose Runtime → Run all. The run takes about 20 minutes and needs a Google account.

The example uses data that comes with AGENT-P:

  • Subjects: 2,000 example subjects, with genotypes (chromosomes 1–22), covariates (age, sex, and 3 genetic principal components), and four brain volumes
  • GWAS: a GWAS of amygdala volume in the same subjects, for the summary-level TWAS
  • Models: a small set of models of caudate gene expression

It tests predicted gene expression in the caudate (JTI models of gene expression) for association with amygdala volume.

2.What the notebook does

StepWhat it does
1. Installdownloads AGENT-P from GitHub and installs it with the programs it needs (about 5–8 minutes)
2. Create the projectloads the example subjects, and quality-controls their genotypes
3. Summary-level TWAScombines the GWAS of amygdala volume with the JTI models of caudate gene expression
4. Genotype-level TWASpredicts caudate gene expression for each subject, then tests it for association with amygdala volume (the longest step)
5. Resultsshows how many genes were tested and the top genes of both TWAS
6. Plotsa Manhattan plot of the genotype-level TWAS, and a Miami plot comparing both TWAS

With only 2,000 subjects, no gene passes the significance threshold; the example shows how AGENT-P works.

3.Try other models or traits

Another model set: in the TWAS cells of the notebook, replace 'JTI' with 'PDX' (PrediXcan), 'UTM' (UTMOST), or 'FUS' (FUSION), and replace JTI_caudate in the results and plot cells with the matching folder name (e.g. PDX_caudate).

Another trait: the genotype-level TWAS can test any of the four example volumes (putamen_volume, amygdala_volume, hippocampus_volume, caudate_volume). The predicted gene expression is reused, so only the association test runs again. Add this cell to the notebook after the genotype-level TWAS (like the other cells, it starts with %%agentp, which runs it with AGENT-P):

Python
%%agentp
from agentp import Project, IndividualTWAS, set_models_dir
set_models_dir('example_models')
project = Project('example_run')

itwas = IndividualTWAS(project, 'JTI', 'caudate')
itwas.run_twas('hippocampus_volume')

The summary-level TWAS needs a GWAS of the trait; the example includes one for amygdala volume only.

4.Run the example on your computer

After installing AGENT-P (the full models of gene expression are not needed), run the same example:

Terminal
conda activate agentp
python ~/agentp/example/run_example.py

It takes about 10 minutes. The results are saved in ~/agentp/example/example_run/, and the plots in ~/agentp/example/example_run/figures/. To analyze your own data, see Full run.