# How to calculate PRS weights for FinnGen data

There is a pipeline ready in sandbox that allows to calculate PRS weights based on the FG summary statistics. In order to do so we've build a custom LD panel based on the Finnish panel used for imputation. More information on the pipeline can be found from [github](https://github.com/FINNGEN/CS-PRS-pipeline/tree/master/scripts/panel).

**Example:** .`json` and `.wdl`- files for running the pipeline can be found in sandbox at `/finngen/library-green/wdl/PRS/:`

* `.json`- file: `sandbox_fg_weights.json` and
* `.wdl`- file: `sandbox_fg_weights.wdl`

You can copy these files and edit the `.json`- file according to your needs as follow:

* `"finngen_weights.pheno_list"`: **path to a tab- delimited .txt file** including phenotype(s) to run and their sample sizes, each phenotype on its own row, if multiple phenotypes:

```
RX_STATIN    218792
T2D    211766
E4_HYTHY_AI_STRICT    198472
```

* `'finngen_weights.munge_sumstats.file_root':` **Path to summary statistics file(s).** Replace the name of the phenotype with `PHENO` . Example for DF5 summary statistics file: `/finngen/library-green/finngen_R5/finngen_R5_analysis_data/summary_stats/release/finngen_R5_PHENO.gz`

In addition, check the column names in `"finngen.weights.mungesumstats.columns"` to match the ones in your summary statistics file. The ones In the example .json do correspond to the DF5 summary statistics.

Once your .json- file has been edited accordingly, you can submit your job via command line using command:

```
finngen-cli request-workflow --wd /path/to/sandbox_fg_weights.wdl \
    --input /path/to/sandbox_fg_weights.json
```

Remember to save your \[WORKFLOW\_ID] to track your job and check the results!

Once your job is ready, you can find your results in: `/finngen/pipelines/cromwell/workflows/finngen_weights/[WORKFLOW_ID]/call-weights/shard-#`

There you will find two weight files for each endpoint:

* `sandbox_test_RX_STATIN.weights.txt` (variants as chrom\_pos\_ref\_alt) and
* `sandbox_test_RX_STATIN.weights.rsid` (variants as rsid)

Please see also Pietros [presentation and slides](https://tt.eduuni.fi/sites/hy-finngen/All/Shared%20Documents/FinnGen%20Users'%20meetings/Fg_users_mtg_080222) at User's meeting.
