Last updated: 2021-03-04

Checks: 2 0

Knit directory: fitnessGWAS/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 3f847f8. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rapp.history
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    .httr-oauth
    Ignored:    .pversion
    Ignored:    analysis/.DS_Store
    Ignored:    analysis/correlations_SNP_effects_cache/
    Ignored:    analysis/plot_models_variant_effects_cache/
    Ignored:    code/.DS_Store
    Ignored:    code/Drosophila_GWAS.Rmd
    Ignored:    data/.DS_Store
    Ignored:    data/derived/
    Ignored:    data/input/.DS_Store
    Ignored:    data/input/.pversion
    Ignored:    data/input/dgrp.fb557.annot.txt
    Ignored:    data/input/dgrp2.bed
    Ignored:    data/input/dgrp2.bim
    Ignored:    data/input/dgrp2.fam
    Ignored:    data/input/huang_transcriptome/
    Ignored:    figures/.DS_Store

Untracked files:
    Untracked:  data/argweaver/
    Untracked:  data/input/TF_binding_sites.csv

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/index.Rmd) and HTML (docs/index.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 3f847f8 lukeholman 2021-03-04 big first commit 2021
html f5c3861 lukeholman 2021-03-04 Build site.
Rmd 937e1ee lukeholman 2021-03-04 big first commit 2021
html 871ae81 lukeholman 2021-03-04 Build site.
html e112260 lukeholman 2021-03-04 Build site.
html 836a780 lukeholman 2021-03-04 Build site.
html 359ff37 lukeholman 2021-03-04 Build site.
html 5506c4b lukeholman 2021-03-04 Build site.
Rmd 390a393 lukeholman 2021-03-04 big first commit 2021
Rmd 8d54ea5 Luke Holman 2018-12-23 Initial commit
html 8d54ea5 Luke Holman 2018-12-23 Initial commit

Running quantitative genetic analyses

1. Setting up a database to hold variant/gene annotations and GWAS results

This script creates a SQLite3 database holding two tables: one with annotations for each variant (provided by the Mackay lab), and one with annotations for each gene (from annotation hub). In step 3, we also add the GWAS results to this database, allowing memory-efficient handling of the results. Using this database also avoids having to load Bioconductor packages that conflict with dplyr::select(), etc.

2. Estimating line mean fitness using Bayesian models

This script uses Bayesian mixed models implemented in brms to estimate the line means for our four fitness traits.

3. Calculating quantitative genetic parameters

Using linear mixed models implemented in the R package sommer to estimate the heritability of, and genetic covariance among, our four fitness traits.

4. Running the GWAS

The script first performs quality control and imputation on the dataset of SNPs and indels for the DGRP. Second, it runs association tests on our four phenotypes using the software command-line software GEMMA. Third, it uses PLINK to identify groups of loci that are in complete linkage disequilibrium (‘SNP clumps’).

5. Applying adaptive shrinkage to the GWAS results

Here, we use the R package mashr to perform multivariate adaptive shrinkage on the results of the GWAS. We ran mashr using both possible modes: canonical, and data-driven. The canonical approach is useful for testing hypotheses about the relative abundance of different types of fitness-affecting SNPs, e.g. sexually antagonistic, sexually concordant, sex-limited, or null. The data-driven approach adjusts the GWAS estimates most accurately, as it estimates the patterns of covariances in the SNPs’ effects on the 4 traits from the data; this is useful for deriving shrinked estimates of all the SNPs’ effect sizes.

6. Plots illustrating how adaptive shrinkage affected the results

This script generates some plots of the SNP effect sizes under the two forms of shrinkage (canonical and data-driven) to check that mashr is performing as expected.

7. Running the TWAS, identifying eQTLs, and applying mashr to the TWAS results

This script uses the transcriptomic data from Huang et al. 2015 PNAS on the DGRP. In this script, we

  • Calculate the average expression and sex bias in expression for each transcript in Huang et al.
  • Identify loci that associated with fitness in our GWAS, and which were also identified as eQTLs in Huang et al.
  • Perform ‘TWAS’, i.e. searching for transcripts whose expression correlates with our fitness measures across lines
  • Adjust the results of the TWAS linear models using mashr in canonical and data-driven modes.

Plots, tables, and analyses of the results

12. Plot and model the variant effect sizes

Here, we plot the correlations in the estimated effects of each variant (or group of variants in perfect linkage disequilibrium with one another). For the GWAS results, we run linear models to test whether variants differ in their effect on fitness according to chromosome, site class, and minor allele frequency. For the TWAS results, we run linear models to test whether transcripts differ in their effect on fitness according to chromosome, average expression level, and the sex bias in expression.