Last updated: 2022-04-11

Checks: 2 0

Knit directory: Code/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). 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 e47dde2. 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:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    Flexibility Comparisons.nb.html
    Ignored:    Main.nb.html
    Ignored:    PGLS.FullData.nb.html
    Ignored:    PGLSforeachMeasFeature.nb.html
    Ignored:    PGLSwithPCA_Dims.nb.html
    Ignored:    PreppedVertMeas.nb.html
    Ignored:    ProcessCymatogasterFiles.nb.html
    Ignored:    ProcessFCSVfiles.nb.html
    Ignored:    TestingHabitatwithFriedmanData.nb.html
    Ignored:    Trilok_tree.nb.html
    Ignored:    VertLM.nb.html
    Ignored:    VertMeasLDA_Attempt.nb.html
    Ignored:    VertPGLS.nb.html
    Ignored:    VertPairs.nb.html
    Ignored:    analysis/.DS_Store
    Ignored:    analysis/10-VertLM.nb.html
    Ignored:    analysis/20-plot_phylogeny.nb.html
    Ignored:    analysis/21-plot_fits_and_summary.nb.html
    Ignored:    analysis/CheckSpeciesMatch.nb.html
    Ignored:    caper_test.nb.html
    Ignored:    data/.DS_Store
    Ignored:    ggtree_attempt.nb.html
    Ignored:    plot_example_data.nb.html
    Ignored:    plot_fits_and_summary.nb.html
    Ignored:    plot_phylogeny.nb.html
    Ignored:    renv/library/
    Ignored:    renv/staging/
    Ignored:    summarize_vert_meas.nb.html
    Ignored:    test_phylogeny.nb.html
    Ignored:    test_vertebraspace.nb.html
    Ignored:    vert_evol.Rproj

Untracked files:
    Untracked:  Main.html
    Untracked:  ProcessFCSVfiles.Rmd
    Untracked:  VertPGLS.html
    Untracked:  gg_saver.R
    Untracked:  output/BodyDistribution.pdf
    Untracked:  output/MasterVert_Measurements.csv
    Untracked:  output/mean_d_alphaPos_CBL.pdf
    Untracked:  output/pair_plot.pdf
    Untracked:  output/plot_example_data_figure.pdf
    Untracked:  output/stats_table.rtf
    Untracked:  plot_fits_and_summary.Rmd
    Untracked:  summarize_vert_meas.html
    Untracked:  testtree.csv
    Untracked:  vert_tree.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 7983950 Eric Tytell 2022-04-11 wflow_git_commit(c(“analysis/about.Rmd”, “analysis/index.Rmd”,
Rmd 0be8f4f Eric Tytell 2021-12-30 Updated the index file to link correctly
Rmd 23908bd Eric Tytell 2021-12-30 Test site build again
Rmd b9f4976 Eric Tytell 2021-12-30 Start workflowr project.

Internal vertebral morphology of bony fishes matches the mechanical demands of different environments

Dana Baxter\(^1\) | Karly E. Cohen\(^3\) | Cassandra M. Donatelli\(^2\) | Eric D. Tytell\(^1\)

\(^1\)Tufts University, Department of Biology \(^2\)University of Ottawa, Department of Biology \(^3\)University of Washington, Friday Harbor Labs

Submitted to Ecology and Evolution April 12, 2022.

Abstract

Raw data

The initial measurements were made by Dana Baxter by clicking points on vertebrae from CT scans. The measurements are in MasterVert_Measurements_old.csv.

Dana processed the data from Cymatogaster aggregata a bit later, so we have to merge it into the main data set.

Input: data/MasterVert_Measurements_old.csv Output: data/MasterVert_Measurements.csv

Here is the process to merge the Cymatogaster data: 01-ProcessCymatogasterFiles.

Matching species

Species are distributed somewhat randomly throughout the bony fishes. We use the phylogeny from Betancur-R et al 2017. Not every species we digitized is in their tree. For most of them, we can use another species in the same genus, since we don’t have many species in our data set that are in one genus.

Input: data/MasterVert_Measurements.csv Output: output/MasterVert_Measurements_Matched.csv This contains all of the measurements for all of the vertebrae, but with a new set of columns for “MatchSpecies” and “MatchGenus”, which are the matching species in the Betancur-R tree.

This notebook checks the match between our species and the one in the tree: 02-CheckSpeciesMatch.

Summary data sets

Centering and taking maxes and medians

Here, we take the data for each vertebra and produce summary values for each species. We first center the data set by finding the median value of any measurement for each vertebra across all of the species, then subtracting the actual value from that median.

Input: output/MasterVert_Measurements_Matched.csv Output:

  • output/vertdata_centered.csv: This contains the centered measurements
  • output/vertdata_summary.csv: This contains the summary maximum values and medians for each species

Notebook

Fitting the data with linear models

To represent the variation of the measurements along the vertebrae, we fit linear models to each measurement as a function of position along the body. Based on AIC, we use just an overall mean, a slope and a midpoint, or a quadratic fit.

We use midpoint rather than intercept. Midpoint is the value at 80% of the way down the body. If we use intercept, we sometimes end up with negative values, which is weird.

Input: output/vertdata_centered.csv, output/vertdata_summary.csv Output:

  • output/vertdata_summary_lm.csv: Contains the midpoint, slope, and quadratic coefficients as appropriate for each model.
  • output/vertdata_summary_lm_models.Rds: Same data, but storing the actual models in an Rds file.

Notebook

Statistics

Here, we run the phylogenetic generalized least squares models to determine which variables differ among species.

Input: output/vertdata_centered.csv, output/vertdata_summary.csv Output:

Notebook

Figures

Figure 1: Shows the phylogeny and several example vertabrae.

This produces the phylogeny.

Notebook

Figure 2, 3

Figures showing the overall mean for foramen diameter, posterior cone angle, and centrum body length, along with the distribution of the parameters along the body.

Also generates the stats table.

Notebook

Figure 4

Plots the relationship among pairs of species that differ in habitat.

Notebook