Skip to content

Commit 1e835a7

Browse files
committed
Updates the docs to reflect new functionality. Fixes #7
1 parent 6b8f38d commit 1e835a7

File tree

6 files changed

+80
-23
lines changed

6 files changed

+80
-23
lines changed

docs/description.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,10 @@ The average absolute difference between AAF<sub>present</sub> and AAF<sub>future
5252

5353
The RONA method as implemented in *pyRona* is not performed exactly as the original from [Rellstab et al. 2016](doi.wiley.com/10.1111/mec.13889).
5454

55-
Instead of relying on LFFM like the original, *pyRona* is instead prepared to get association data from the software [*Baypass*](http://www1.montpellier.inra.fr/CBGP/software/baypass/). The method can be red about in [Gautier 2015](https://www.ncbi.nlm.nih.gov/pubmed/26482796). Being able to use output from LFMM is also in the [future plans](https://github.com/StuntsPT/pyRona/issues/7).
56-
57-
This means the instead of using allele frequencies, *pyRona* uses the normalized allele frequencies outputted by *Baypass*. This is in our opinion superior to using the allele frequencies directly, since it removes any potential effect of population structuring.
58-
5955
Instead of ranking the environmental factors by *p*-value of the difference teste between present and future values, *pyRona* will calculate the RONA value for the "N" environmental variables ranked by the number of associated loci. By default "N" is 3, but *pyRona* can take any user provided value.
6056

6157
*pyRona* offers an option to remove outliers before calculating the regression. This removal uses the ["Mahalanobis distance"](https://en.wikipedia.org/wiki/Mahalanobis_distance) to remove 0, 1 or "all" the outliers in the data. By default, no outlier removal is performed.
6258

59+
In addition to relying on LFFM like the original, *pyRona* is also prepared to get association data from the software [*Baypass*](http://www1.montpellier.inra.fr/CBGP/software/baypass/). The method can be red about in [Gautier 2015](https://www.ncbi.nlm.nih.gov/pubmed/26482796). When *Baypass* results are provided as input, instead of using allele frequencies, *pyRona* uses the normalized allele frequencies calculated by *Baypass*. This is in our opinion superior to using the allele frequencies directly, since it removes any potential effect of population structuring.
60+
6361
Finally, similar to the original method, *pyRona* provides an average RONA value for each selected environmental variable, but unlike the the original method,our implementation will calculate the average RONA weighted by the regression R² value. This means that associations with a lower regression coefficient will contribute less to the final RONA value than those with higher R² values.

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ A python implementation of "Risk of non Adaptedness" method (with a bit of R too
2626
* [Method description](description.md)
2727
* [Usage](usage.md)
2828
* [Wrapping BayPass](baypass.md)
29+
* [Wrapping LFMM](lfmm.md)
2930
* [Output](output.md)
3031
* [Citation](citation.md)
3132
* [Future Plans](future.md)

docs/install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Due to the way different Operating Systems handle dependencies specific instruct
3030

3131
## Important note
3232

33-
Note that *pyRona* will also automatically install an *R* script called `Baypass_workflow.R` under `~/.local/bin` that can be used to automate the usage of the software *BayPass*, whose output can be used as input for *pyRona*. For more information on this script, please see the [baypass section](baypass.md).
33+
Note that *pyRona* will also automatically install two *R* scripts called `Baypass_workflow.R` and `LFMM_workflow.R` under `~/.local/bin` that can be used to automate the usage of the upstream software *BayPass* and *LFMM*, whose output can be used as input for *pyRona*. For more information on these scripts, please see the [baypass](baypass.md) and [LFMM](lfmm.md) sections.
3434

3535

3636
## Alternative methods (AKA 'expert mode')

docs/lfmm.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Wrapping LFMM
2+
3+
*pyRona* can take the output of *LFMM* as input to calculate the RONA values. Due to this, *pyRona* includes an `R` script named `LFMM_workflow.R` that can be used to automate and wrap *LFMM* analyses.
4+
Not that it is highly recommended that you give *LFMM*'s [manual](https://bcm-uga.github.io/lfmm/reference/index.html), [tutorial](https://bcm-uga.github.io/lfmm/articles/lfmm), and [paper](http://dx.doi.org/10.1093%2Fmolbev%2Fmst063) a through read before using this script.
5+
6+
7+
## LFMM_workflow.R
8+
9+
This script will automate the workflow for the [LFMM](https://bcm-uga.github.io/lfmm/index.html)
10+
software by Olivier François and Kevin Caye, which is described in [this paper](http://dx.doi.org/10.1093%2Fmolbev%2Fmst063).
11+
It does **no error handling** of any kind, nor any logging. It just automates
12+
the procedures outlined in the manual with some degrees of freedom.
13+
Please be careful when using it. It may kill your kittens and/or burn your
14+
house down, but worst of all, it will tend to make you lazy regarding the inner
15+
workings of *LFMM*.
16+
The script takes no arguments, but all the variables you should need to edit
17+
are presented at the start of the script, coupled with a short description.
18+
19+
20+
### Variables
21+
22+
In the beginning of the script there are several line with empty variables. You should fill in the correct values for your case in order to use it.
23+
Each option is pretty much self documented with both an explanation of what is expected and an example.
24+
25+
26+
### Functions
27+
28+
The rest of the script is comprised of functions to wrap the LFMM functionality. You should not have to change anything here to get a complete run as all the parameters that are likely be changed can be from the "Variables" section.
29+
30+
31+
### Running the script
32+
33+
Simply enter values for the variables at the beginning of the script and run it in R. It is recommended that you take a close look at the "PCA variance explained" plot to choose the best "K" to use, which will likely mean perform multiple runs.

docs/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pages:
66
- 'Method description': 'description.md'
77
- 'Usage': 'usage.md'
88
- 'Wrapping BayPass': 'baypass.md'
9+
- 'Wrapping LFMM': 'lfmm.md'
910
- 'Output': 'output.md'
1011
- 'Citation': 'citation.md'
1112
- 'Future Plans': 'future.md'

docs/usage.md

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,56 @@ This section describes how to use *pyRona*. All options as of version 0.2.0 are
77
* Getting help
88
- Simply calling the program, or issuing the single argument `-h` will print all the available options on the console
99

10+
* Positional arguments:
11+
- The first argument should be the name of the program whose results you wish to analyse. *pyRona* can take one of two options here:
12+
- `baypass`:Process Baypass results
13+
- `lfmm`:Process LFMM results
14+
15+
- Depending on which you choose, some of the other options will be different.
16+
1017
* I/O options
11-
- *pyRona* **requires** several files as input, that should be specified inn the following options:
12-
- `-pc`: File containing current environmental variables (formatted as per *BayPass* input)
13-
- `-fc`: File containing future environmental variables (formatted the same as the present conditions file)
14-
- `-pop`: File with names of populations (one population per line)
15-
- `-beta`: *BayPass* output "summary_betai"
16-
- `-pij`: *BayPass* output "PIJ"
17-
- Furthermore, *pyRona* also requires an output to be specified, for saving the RONA plot.
18-
- `-out`: File where the plot will be saved. This option is extension aware, and entering the extension as "PDF", "SVG" or "PNG", will make *pyRona* save the plot in the respective format.
18+
- *pyRona* **requires** several files as input, that should be specified in the following options:
19+
- Common options to both *Baypass* and *LFMM*:
20+
- `-pc`: File containing current environmental variables, formatted as per the upstream program input (*Baypass* or *LFMM*)
21+
- `-fc`: File containing future environmental variables, formatted as per the upstream program input (*Baypass* or *LFMM*)
22+
- `-out`: File where the plot will be saved. This option is extension aware, and entering the extension as "PDF", "SVG" or "PNG", will make *pyRona* save the plot in the respective format
23+
- *Baypass* specific options:
24+
- `-pop`: File with names of populations (one population per line)
25+
- `-beta`: *BayPass* output "summary_betai"
26+
- `-pij`: *BayPass* output "PIJ"
27+
- *LFMM* specific options:
28+
- `-assoc`: File containing a matrix of *p*-values as outputted by *LFMM*
29+
- `-geno`: The input file used for *LFMM*. Should be in the *LFMM* format
30+
1931
* Parameters
2032
- *pyRona* requires some parameters to be set in order to perform the analysis. These are:
21-
- `-bf`: Bayes Factor threshold. This is the value above which associations are considered significant.
22-
- `-covars`: [**optional**] Number of covars to calculate the RONA for (default: 3)
23-
- `-outliers`: [**optional**] Number of outliers to remove - "0" skips outlier removal, "1" removes a maximum of 1 outlier (if there is one), "2" removes any number of markers considered outliers (default: 2)
24-
- `-immutables`: Number of covariates to skip from the environmental variables file. Usefull to skip variables that are the same in te present covars and future covars file, such as latitude (default: 3).
25-
- `-ronatype`: Defines the RONA is calculated. `absdiff` performs calculations as described in Rellstab et al. 2016 - using the absolute value of the differences, `diff` uses the differences without modulus, and `dist` accounts simply for the distance between the future condition and the trendline (default: `absdiff`).
33+
- Common options to both *Baypass* and *LFMM*:
34+
- `-covars`: [**optional**] Number of covars to calculate the RONA for (default: 3)
35+
- `-outliers`: [**optional**] Number of outliers to remove - "0" skips outlier removal, "1" removes a maximum of 1 outlier (if there is one), "2" removes any number of markers considered outliers (default: 2)
36+
- `-immutables`: Covariates to skip from the environmental variables file. Useful to skip variables that are the same in te present covars and future covars file, such as latitude (default: 1 2 3)
37+
- `-ronatype`: Defines the RONA is calculated. `absdiff` performs calculations as described in Rellstab et al. 2016 - using the absolute value of the differences, `diff` uses the differences without modulus, and `dist` accounts simply for the distance between the future condition and the trendline (default: `absdiff`)
38+
- *Baypass* specific options:
39+
- `-bf`: Bayes Factor threshold. This is the value above which associations are considered significant
40+
- *LFMM* specific options:
41+
- `-P`: *p*-value threshold. This is the value below which associations are considered significant
42+
2643
* Other options (**all optional**)
2744
- *pyRona* allows for setting some further miscellaneous options:
28-
- `-no-plots`: Do not draw the individual regression plots.
29-
- `-no-weighted-means`: Use this option if you wish to use *means* instead of *weighted means* for the RONA calculation.
45+
- `-no-plots`: Do not draw the individual regression plots. This is the default, and you should set it to "0" or "False" to draw the individual plots
46+
- `-no-weighted-means`: Set this option to "1" or "True" if you wish to use *means* instead of *weighted means* for the RONA calculation
47+
48+
49+
## Example runs:
50+
51+
```
52+
pyRona baypass -pc Popfiles/ENVFILE -fc Popfiles/ENVFILE_rpc26 -beta Analyses/Baypass/mcmc_aux/Qsuber_GBS_07_loki_mcmc_aux_summary_betai.out -pij Analyses/Baypass/mcmc_aux/Qsuber_GBS_07_loki_mcmc_aux_summary_pij.out -pop Popfiles/popnames_single_GEO.txt -bf 15 -outliers 0 -out ~/Desktop/rpc26.pdf -covars 4
53+
```
3054

55+
This command will execute *pyRona* set to analyse *Baypass* output using the input files specified by `-pc`, `-fc`, `-beta`, `-pij` and `-pop`, using the value `15` as the BF threshold, skipping outlier removal and calculating the RONA value for the most frequent 4 associated environmental variables. The plot will be saved as a PDF under `~/Desktop/rpc26.pdf`.
3156

32-
## Example run:
3357

3458
```
35-
pyRona -pc Popfiles/ENVFILE -fc Popfiles/ENVFILE_rpc26 -be Analyses/Baypass/mcmc_aux/Qsuber_GBS_07_loki_mcmc_aux_summary_betai.out -pij Analyses/Baypass/mcmc_aux/Qsuber_GBS_07_loki_mcmc_aux_summary_pij.out -pop Popfiles/popnames_single_GEO.txt -bf 15 -outliers 0 -out ~/Desktop/rpc26.pdf -covars 4
59+
pyRona lfmm -pc ~/aa/present_covars.txt -fc ~/aa/RCP26_covars.txt -out ~/Desktop/LFMM_rpc26.pdf -P 0.01 -assoc ~/aa/scaled_lfmm_results.csv -geno ~/aa/qsuber.lfmm
3660
```
3761

38-
This command will execute *pyRona* using the input files specified by `-pc`, `-fc`, `-be`, `-pij` and `-pop`, using the value `15` as the BF threshold, skipping outlier removal and calculating the RONA value for the most frequent 4 associated environmental variables. The plot will be saved as a PDF under `~/Desktop/rpc26.pdf`.
62+
This command will execute *pyRona* set to analyse *LFMM* output using the input files specified by `-pc`, `-fc`, `-assoc` and `-geno`, using the value `0.01` as the *p*-value threshold, skipping outlier removal (default) and calculating the RONA value for the most frequent 3 associated environmental variables (default). The plot will be saved as a PDF under `~/Desktop/LFMM_rpc26.pdf`.

0 commit comments

Comments
 (0)