Data set and R code for running stochastic character mapping to reconstruct the evolution of air-breathing and amphibious behaviour in fishes.
Before running the scripts, you should do the following
Make an new folder that will be the working directory and specify its path here setwd("/Users/christiandamsgaard/Dropbox/Projects/Air-breathing review_full/")
Download, unzip and paste "Complete “all-taxon assembled” chronograms" and "PFC_short_classification.csv" from "https://fishtreeoflife.org/downloads/" into the working directory. To save time, you can further download the maximum clade credibility tree "mcc.nexus", and outputs from sections 1 and 3 called "times_bpp_Organ.txt","counts_bpp_Organ.txt","times_bpp_LS.txt","counts_bpp_LS.txt"
Download and paste "Data Set 1.xlsx" into the working directory.
Within the working directory folder make a folder called "Figures".
Install the packages specified under ## LOAD PACKAGES ## using the "Tools" --> "Install Packages..." option.
To prepare running the model, first run the lines from the sections #### LOAD PACKAGES, COLOR SCHEMES, FUNCTIONS, IMPORT TREES, IMPORT DATA #### From there, you can run modelling within section 1-2 on air-breathing evolution or section 3-4 on amphibious evolution. Sections 1-2 and sections 3-4 are followed by lines that code the figures. Sections 1-2 and sections 3-4 each take up ~ 10GB ram, so if your computer has < 16GB memory, consider running Sections 1-2, plot the associated data, and shut down R to clear the memory. Then re-open R, and run sections 3-4, plot the associated data.