# Unmodifiable Conditional Analysis Custom Regions Pipeline

## Summary

This pipeline is identical in nature to the [general one](/working-in-the-sandbox/running-analyses-in-sandbox/how-to-run-genome-wide-association-studies-gwas/conditional-analysis/unmodifiable-conditional-analysis-pipeline.md), but it simplifies the generation of the candidate hits. Instead of using automatic region selection to select the regions that will be analysed, the user can pass their own regions and hits, speeding up the process and limiting to only regions of interest

## Summary of Inputs

* `conditional_analysis_custom.prefix` : the prefix for the output files
* `conditional_analysis_custom.cond_regions` : the input file for the conditioning. it should be a tsv with `CHROM\tSTART-END\tVARIANT1,VARIANT2`. E.g.<br>

  ```
  14	80620000-81150000	chr14_81006112_T_A
  3	187000000-189000000	chr3_187951446_C_A
  ```
* `conditional_analysis_custom.is_binary` : `true` or `false`. It tells regenie what kind of phenotype it is
* `conditional_analysis_custom.pheno` : name of phenotype
* `conditional_analysis_custom.sumstats` : path to sumstats. it should be structured as `"gs://finngen-production-library-green/finngen_R13/finngen_R13_analysis_data/summary_stats/release/PHENO.gz"` so that `PHENO` is replaced with the phenotype defined above
* `conditional_analysis_custom.regenie_conditional.null` : path to null file
* `conditional_analysis_custom.pheno_file` : path to pheno file
* `conditional_analysis_custom.conditioning_mlogp_threshold` : Mlogp threshold for the conditioned hit
* `conditional_analysis_custom.regenie_conditional.max_steps` : Maximum number of iterations in the conditional analysis
* `conditional_analysis_custom.regenie_conditional.cpus` : cpus to use (it can speed up the process)
* `conditional_analysis_custom.filter_covariates.threshold_cov_count` : minimum number of samples required for each covariates. It's needed to prevent regenie from failing
* `conditional_analysis_custom.covariates` : list of covariates

\ <br>

## Outputs

There are five outputs, the first two of which are of interest for viewing them and the last 3 are for importing the data to userresults pheweb browser.

* `all_hits` . A file that merges all pheno chains. This file contains all the steps done for each chain. In this case the first hits did not cause a chain as the new top hits in turn did not have significat pvalues. E.g.<br>

  <table><thead><tr><th width="232.4444580078125">VARIANT</th><th width="128">BETA</th><th width="128">SE</th><th width="128">MLOG10P</th><th>BETA_cond</th><th>SE_cond</th><th>MLOG10P_cond</th><th width="550.2222900390625">VARIANT_cond</th></tr></thead><tbody><tr><td>chr1_17381854_G_A</td><td>-0.0371</td><td>0.0064</td><td>8.2425</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr2_161145756_T_A</td><td>-0.0429</td><td>0.0073</td><td>8.3533</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr2_196338002_G_A</td><td>0.059</td><td>0.0095</td><td>9.2624</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr3_18633152_A_C</td><td>0.044</td><td>0.0067</td><td>10.3279</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr3_16811234_G_A</td><td>-0.0367</td><td>0.0065</td><td>7.7032</td><td>-0.0328</td><td>0.0066</td><td>6.1828</td><td>chr3_18633152_A_C</td></tr><tr><td>chr3_43656252_G_A</td><td>0.0759</td><td>0.01</td><td>13.5747</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr3_44176307_AAAG_A</td><td>0.7812</td><td>0.1679</td><td>5.4822</td><td>0.9816</td><td>0.1974</td><td>6.1793</td><td>chr3_43656252_G_A</td></tr><tr><td>chr3_158237129_A_G</td><td>0.0388</td><td>0.0065</td><td>8.6487</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr3_177171295_G_A</td><td>0.0843</td><td>0.0133</td><td>9.588</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr4_59388159_A_G</td><td>-0.0403</td><td>0.0071</td><td>7.8402</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr5_104451467_A_C</td><td>0.0383</td><td>0.0066</td><td>8.1869</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr5_120730291_A_G</td><td>-0.0437</td><td>0.0066</td><td>10.5128</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr5_121149217_A_C</td><td>0.6199</td><td>0.1257</td><td>6.086</td><td>0.7808</td><td>0.1422</td><td>7.3998</td><td>chr5_120730291_A_G</td></tr><tr><td>chr5_144466903_T_C</td><td>0.0374</td><td>0.0065</td><td>8.1641</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr5_153777668_A_C</td><td>-0.0381</td><td>0.0065</td><td>8.3132</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr5_153129992_T_G</td><td>-0.0329</td><td>0.0065</td><td>6.3568</td><td>-0.032</td><td>0.0065</td><td>6.0592</td><td>chr5_153777668_A_C</td></tr><tr><td>chr6_51715850_T_C</td><td>-0.0567</td><td>0.0103</td><td>7.4145</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr6_151880872_T_C</td><td>-0.0474</td><td>0.0065</td><td>12.4306</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr6_164751626_G_A</td><td>-0.038</td><td>0.0063</td><td>8.717</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr9_36999372_C_T</td><td>0.0348</td><td>0.0063</td><td>7.419</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr9_95537395_T_A</td><td>0.0565</td><td>0.0102</td><td>7.4833</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr10_21600368_A_AAC</td><td>-0.0515</td><td>0.0085</td><td>8.819</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr10_104842738_C_CT</td><td>-0.0411</td><td>0.007</td><td>8.2919</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr11_28582122_A_G</td><td>-0.0389</td><td>0.0066</td><td>8.3234</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr11_99647795_T_C</td><td>0.0431</td><td>0.0069</td><td>9.5016</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr11_113324873_A_G</td><td>-0.038</td><td>0.0064</td><td>8.5837</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr11_115118275_G_A</td><td>-0.0407</td><td>0.007</td><td>8.312</td><td>-0.0398</td><td>0.007</td><td>7.9104</td><td>chr11_113324873_A_G</td></tr><tr><td>chr11_113050349_C_T</td><td>0.0364</td><td>0.0064</td><td>7.8798</td><td>0.0331</td><td>0.0064</td><td>6.5628</td><td>chr11_113324873_A_G,chr11_115118275_G_A</td></tr><tr><td>chr12_60397384_T_A</td><td>-0.0372</td><td>0.0065</td><td>8.0402</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr14_70749996_T_C</td><td>-0.227</td><td>0.0359</td><td>9.5829</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr15_73812581_C_A</td><td>-0.0584</td><td>0.0105</td><td>7.6144</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr16_21667465_T_C</td><td>0.0434</td><td>0.0073</td><td>8.6185</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr16_65751219_A_G</td><td>0.0357</td><td>0.0064</td><td>7.614</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr16_72134342_T_G</td><td>0.0485</td><td>0.0063</td><td>13.8185</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr16_71324662_TCTGCTAATAGGAGTGA_T</td><td>0.0829</td><td>0.0128</td><td>10.054</td><td>0.0728</td><td>0.0131</td><td>7.582</td><td>chr16_72134342_T_G</td></tr><tr><td>chr18_53199573_T_C</td><td>0.0497</td><td>0.0063</td><td>14.3777</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr18_55212207_T_C</td><td>0.0778</td><td>0.0148</td><td>6.843</td><td>0.0759</td><td>0.015</td><td>6.3537</td><td>chr18_53199573_T_C</td></tr><tr><td>chr18_76052843_T_C</td><td>0.0474</td><td>0.0085</td><td>7.6577</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chr19_49457409_G_T</td><td>0.0795</td><td>0.0136</td><td>8.3038</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chrX_93697357_A_G</td><td>0.4882</td><td>0.0889</td><td>7.3997</td><td>nan</td><td>nan</td><td>nan</td><td>nan</td></tr><tr><td>chrX_93934138_A_G</td><td>0.7061</td><td>0.1479</td><td>5.7454</td><td>1.0262</td><td>0.1883</td><td>7.2998</td><td>chrX_93697357_A_G</td></tr></tbody></table>

  `chr3_18633152_A_C` is the first hit to have a validit conditional chain with the secondary hit `chr3_16811234_G_A`, for which `BETA`, `SE` and `MLOG10P` are provided both for the original (input) sumstats and the conditioned one. In this case, one can see that the values did not change significantly after conditioning, but it can happen that variants go from being non significant to significant or that betas change considerably.
* `all_logs`. This file is simply the collection of all regenie outputs and it's meant for debugging in case something went wrong
* `metadata` : metadata file for identifying an existing already imported result in userresults pheweb browser.
* `sql_import` : File for importing the results to userresults pheweb browser
* `import_conditional_files` : conditional results to be imported into puserresults pheweb browser


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.finngen.fi/working-in-the-sandbox/running-analyses-in-sandbox/how-to-run-genome-wide-association-studies-gwas/conditional-analysis/unmodifiable-conditional-analysis-custom-regions-pipeline.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
