Last updated: 2023-05-15

Checks: 7 0

Knit directory: fitnessGWAS/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0.4). 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 job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20180914) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

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 efa957c. 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:    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
    Ignored:    old_analyses/.DS_Store

Untracked files:
    Untracked:  figures/Figure 2 edited.pptx
    Untracked:  figures/fig1.pdf
    Untracked:  figures/fig1_font.pdf
    Untracked:  figures/fig2_SNPs_manhattan_plot_edited.png
    Untracked:  old_analyses/Data for old analyses/
    Untracked:  old_analyses/eQTL_analysis.Rmd
    Untracked:  old_analyses/fitness_data.csv
    Untracked:  old_analyses/gcta_quant_genetics_OLD.Rmd
    Untracked:  old_analyses/quantitative_genetics_OLD_brms.Rmd

Unstaged changes:
    Modified:   code/main_paper_figures.Rmd
    Modified:   code/main_paper_figures.docx
    Modified:   code/pdf_supp_material.Rmd
    Modified:   code/pdf_supp_material.pdf
    Modified:   figures/fig2_SNPs_manhattan_plot.png
    Modified:   figures/fig3_boyle_plot.pdf
    Modified:   figures/fig4_mutation_load.pdf
    Modified:   figures/fig5_quartiles_plot.pdf
    Modified:   figures/fig6_antagonism_ratios.pdf
    Modified:   figures/fig7_models.pdf
    Deleted:    output/README.md

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/raw_data_and_line_means.Rmd) and HTML (docs/raw_data_and_line_means.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 efa957c lukeholman 2023-05-15 wflow_publish("analysis/raw_data_and_line_means.Rmd")
html 7d3c2ef lukeholman 2023-05-15 Build site.
Rmd 03df599 lukeholman 2023-05-15 wflow_publish("analysis/raw_data_and_line_means.Rmd")
html 4fc3c4f lukeholman 2023-04-10 Build site.
Rmd 501f3d4 lukeholman 2023-04-10 wflow_publish("analysis/raw_data_and_line_means.Rmd")
html 2f5aeaf lukeholman 2023-04-10 Build site.
Rmd fece779 lukeholman 2023-04-10 wflow_publish("analysis/raw_data_and_line_means.Rmd")
html afeb987 lukeholman 2023-03-21 Build site.
Rmd b14f397 lukeholman 2023-03-21 wflow_publish("analysis/raw_data_and_line_means.Rmd")

library(tidyverse)
library(DT)

# Create a function to build HTML searchable tables
my_data_table <- function(df, filename){
  datatable(
    df, rownames=FALSE,
    autoHideNavigation = TRUE,
    extensions = c("Scroller",  "Buttons"),
    options = list(
      autoWidth = TRUE,
      dom = 'Bfrtip',
      deferRender=TRUE,
      scrollX=TRUE, scrollY=1000,
      scrollCollapse=TRUE,
      buttons =
        list('pageLength', 
             list(extend = 'csv',
                  filename = filename)),
      pageLength = 10
    )
  )
}

# Load the raw data collected during the experiments (clean up in get_predicted_line_means.Rmd)
raw_female_fitness <- read_csv("data/input/female_fitness_CLEANED.csv") %>% 
  select(vial, everything()) %>% 
  rename_all(~ str_to_sentence(str_replace_all(.x, "[.]", " ")))
raw_male_fitness <- read_csv("data/input/male_fitness_CLEANED.csv") %>% 
  select(vial, everything(), -num.GFP.males) %>% 
  rename_all(~ str_to_sentence(str_replace_all(.x, "[.]", " ")))

# Load the predicted line means, as calculated in get_predicted_line_means.Rmd
predicted_line_means <- read_csv("data/derived/predicted_line_means.csv") %>% 
  mutate(female.fitness.early = round(female.fitness.early, 3),
         female.fitness.late = round(female.fitness.late, 3),
         male.fitness.early = round(male.fitness.early, 3),
         male.fitness.late = round(male.fitness.late, 3)) %>% 
  rename_all(~ str_to_sentence(str_replace_all(.x, "[.]", " "))) %>% 
  select(-Block) 

To facilitate data re-use, we here provide tables showing the raw data (i.e. the measurements of male and female fitness that were collected on each individual replicate vial), as well as the estimated line means that were calculated in this script. Press the CSV button to download a particular table as a .csv file.

Raw data

Female fitness

  • Vial is a unique ID for each vial, which groups together observations of the same group of 5 DGRP females whose fitness was measured.
  • Block is the experimental block in which fitness was measured.
  • Line gives the DGRP line number of the focal females.
  • Female fitness early gives the number of L1 larvae produced by the DGRP females, in the early-life measurement.
  • Female fitness late gives the number of L1 larvae produced by the DGRP females, in the late-life measurement.
my_data_table(raw_female_fitness,
              "female_fitness_raw_data")

Male fitness

  • Vial is a unique ID for each vial, which groups together observations of the same group of 5 DGRP females whose fitness was measured.
  • Block is the experimental block in which fitness was measured.
  • Line gives the DGRP line number of the focal males
  • Early male rival gives the number of L1 larvae sired by the rival GFP males, in the early-life measurement.
  • Early male focal gives the number of L1 larvae sired by the focal DGRP males, in the early-life measurement.
  • Late male rival gives the number of L1 larvae sired by the rival GFP males, in the late-life measurement.
  • Late male focal gives the number of L1 larvae sired by the focal DGRP males, in the late-life measurement.
my_data_table(raw_male_fitness,
              "male_fitness_raw_data")

Estimated line means

The four columns other than Line give the line mean fitness for each of the four fitness traits. Fitness was estimated from Bayesian multivariate Poisson or Binomial models described in this script. The fitness values were expressed on the scale of the linear predictor (and thus are approximately normally distributed), and have been scaled to have a mean of zero and variance of one. Thus, a line with mean fitness equal to 1.5 is 1.5 standard deviations above average, on the scale of the linear predictor. Note that male fitness was not measured in line_354 due to experimenter error.

my_data_table(predicted_line_means,
              "line_mean_fitness_data")

sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur ... 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] DT_0.27           lubridate_1.9.2   forcats_1.0.0     stringr_1.5.0    
 [5] dplyr_1.1.0       purrr_1.0.1       readr_2.1.4       tidyr_1.3.0      
 [9] tibble_3.1.8      ggplot2_3.4.1     tidyverse_2.0.0   workflowr_1.7.0.4

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.0  xfun_0.37         bslib_0.4.2       colorspace_2.1-0 
 [5] vctrs_0.5.2       generics_0.1.3    htmltools_0.5.4   yaml_2.3.7       
 [9] utf8_1.2.2        rlang_1.0.6       jquerylib_0.1.4   later_1.3.0      
[13] pillar_1.8.1      glue_1.6.2        withr_2.5.0       bit64_4.0.5      
[17] lifecycle_1.0.3   munsell_0.5.0     gtable_0.3.1      htmlwidgets_1.6.1
[21] evaluate_0.20     knitr_1.42        tzdb_0.3.0        callr_3.7.3      
[25] fastmap_1.1.1     crosstalk_1.2.0   httpuv_1.6.9      ps_1.7.2         
[29] parallel_4.2.2    fansi_1.0.4       Rcpp_1.0.10       promises_1.2.0.1 
[33] scales_1.2.1      cachem_1.0.7      vroom_1.6.1       jsonlite_1.8.4   
[37] bit_4.0.5         fs_1.6.1          hms_1.1.2         digest_0.6.31    
[41] stringi_1.7.12    processx_3.8.0    getPass_0.2-2     rprojroot_2.0.3  
[45] grid_4.2.2        cli_3.6.0         tools_4.2.2       magrittr_2.0.3   
[49] sass_0.4.5        crayon_1.5.2      whisker_0.4.1     pkgconfig_2.0.3  
[53] ellipsis_0.3.2    timechange_0.2.0  rmarkdown_2.20    httr_1.4.5       
[57] rstudioapi_0.14   R6_2.5.1          git2r_0.31.0      compiler_4.2.2