Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 3.65 KB

README.md

File metadata and controls

60 lines (39 loc) · 3.65 KB

nectandra_ferns

Code repostitory to run analyses and generate figures and manuscript for Nitta et al. "A taxonomic and molecular survey of the pteridophytes of the Nectandra Reserve, Costa Rica". PLOS ONE 2020 https://doi.org/10.1371/journal.pone.0241231

All code is in R. The drake package is used to manage the workflow.

To run all analyses and generate the manuscript:

  1. Clone this repository
  2. If you haven't already, set up an NCBI Entrez API key
  3. Download the data
  4. Run make.R in the provided docker container

NCBI Entrez API key

This analysis queries GenBank and downloads DNA sequences. It is recommended to register a free NCBI Entrez API key and set this as the ENTREZ_KEY environmental variable before running analyses, or warnings will be issued when the sequences get downloaded. See taxize::use_entrez() and taxize::`taxize-authentication`() for more info on how to set this up.

(short version of the taxize documentation: make a file called .Renviron in the root of this repo, and put this line in it: ENTREZ_KEY=somekey, where somekey is the API key you set up on NCBI)

Data

There are two small data files included in this repo. The rest of the data are hosted on Dryad. For each of the links below, click on "Download Dataset", then place the zipped data file (it will have a similar name to the DOI) in the data folder of the this repo. This must be done before running make.R. You can manually unzip the data archives if you want to see the contents, but the code needs the original zipped file in data/ to run.

Reproducible analysis with Docker

make.R requires various packages to be installed, and may not work properly if package versions have changed. Therefore, a Docker image is provided to run the code reproducibly. You can install docker from here.

Navigate to the cloned repository (where /path/to/repo is the path on your machine), and launch the container:

cd /path/to/repo
docker-compose up -d

Run make.R inside the container:

docker exec nectandra_ferns_analysis_1 Rscript make.R

You will see the targets being built by drake, and the final manuscript should be compiled at the end as nectandra_ferns.pdf and nectandra_ferns.docx in the results/ms folder. Other figure and table files will also be compiled.

When it's finished, take down the container:

docker-compose down

Licenses