This is the accessory documentation of Extendend Data Figure 1.
The Figure can be recreated by running the **R** script `E1.R`:
```sh
cd$WORK/3_figures/F_scripts
Rscript --vanilla E1.R
rm Rplots.pdf
```
## Details of `E1.R`
In the following, the individual steps of the R script are documented.
Is an executable R script that depends on a variety of image manipulation and data managing and genomic data packages.
It Furthermore depends on the R scripts `E1.functions.R`,`E1.plot_fun.R` which themselves depend on `E1.getDXY.R`, `E1.getFSTs.R` and `E1.getGxP.R` (all located under `$WORK/0_data/0_scripts`).
```r
library(grid)
library(gridSVG)
library(grImport2)
library(grConvert)
library(tidyverse)
library(rtracklayer)
library(hrbrthemes)
library(cowplot)
require(rtracklayer)
source('../../0_data/0_scripts/E1.functions.R');
source('../../0_data/0_scripts/E1.plot_fun.R')
```
The script `E1.plot_fun.R`contains a function (`create_K_plot()`) that plots a single genomic range (a single sub figure) as seen in Figure 3.
The Details of this script are explained below.
Here we apply the `create_K_plot()` function one for every subplot (a,b,c & d).
Within the function we specify the current LG, the annotation file, the extend of the region in question, candidate genes, genes of secondary interest, SNP positions of interest, and the outlier region ID as defined in Figure 2.
The actual work for figure 3 is done within the `create_K_plot()` function.
This function loads the data and does the plotting - the `E1.R` script is basically just a wrapper that selects the setting for each subplot and combines the results.
The function starts by importing the functions need to import the different data types (gene models, *F~ST~* values, GxP p values, d~XY~)