Publication: https://peerj.com/articles/4152
Docker Container: https://hub.docker.com/r/everhartlab/sclerotinia-366/
GitHub: https://github.com/everhartlab/sclerotinia-366
Poster: https://doi.org/10.6084/m9.figshare.5791713
------
This OSF project contains the data, code, and manuscript for "Population structure and phenotypic variation of _Sclerotinia sclerotiorum_ from dry bean (_Phaseolus vulgaris_) in the United States."
# Data
If you wish to use these data, we suggest to use the data set located in <https://osf.io/8x7b3/>. This data set has been validated and cleaned from the raw excel file. The first seven columns of the data represent:
1. Severity (noted as aggressiveness in the manuscript)
2. Mycelial Compatibility Group
3. Region (State/Country)
4. Source (field or white mold screening nursery)
5. Year Collected
6. Host Cultivar
7. Isolate Name
The rest of the 16 columns represent the fragment length at a given locus.
# Analysis
## Background
The analysis is controlled via two docker containers:
1. [sclerotinia-366-dependencies](https://hub.docker.com/r/everhartlab/sclerotinia-366-dependencies/): defines the complete software environment used, built on top of the [rocker/verse:3.4.2](https://hub.docker.com/r/rocker/verse) container. **(See the [Dockerfile](https://osf.io/mwv6d/))**
2. [sclerotinia-366](https://hub.docker.com/r/everhartlab/sclerotinia-366/) is built on top of the above container and contains the results of the analysis. **(See the [Dockerfile](https://osf.io/tvfju/))**
The `sclerotinia-366-dependencies` container is regularly rebuilt on docker hub whenever `rocker/verse:3.4.2` updates and the `sclerotinia-366` container is rebuilt on [CircleCI](https://circleci.com/gh/everhartlab/sclerotinia-366) whenever the git repository is updated.
As of this writing, the containers are up to date with R version 3.4.2 and packages downloaded from the [MRAN snapshot on 2017-10-31](https://mran.microsoft.com/snapshot/2017-10-31/).
## Reproduction
All of the steps for reproduction detailed here assume that you have installed docker (<https://docs.docker.com/engine/installation/#desktop>). If you do not have Docker installed, please do so before continuing.
### via RStudio Server
If you want to explore the analyses yourself, the easiest way to do this is through the RStudio server session inside of the Docker container. There are three steps to doing this, detailed below:
1. Run the docker container from your command line (the container will automatically download from docker hub)
2. Open your browser to `localhost:8787` and log in to RStudio (this is running within the docker container on your computer)
3. copy the `/analysis` directory to your current directory and open the RStudio project.
#### Running the docker container
To run the docker container, make sure you have Docker running, open your terminal and type:
```bash
docker run --name ssc --rm -dp 8787:8787 -e ROOT=TRUE everhartlab/sclerotinia-366:latest
```
This will first check to make sure you have the container on your machine. If you don't, Docker will automatically download it for you. It will spin up the Docker container on your machine, give it the name "ssc", and expose it to port 8787. You can open your browser and type `localhost:8787`, and an instance of Rstudio server will appear. Sign in with the following credentials:
- username: rstudio
- password: rstudio.
Since the files in `/analysis` are write-protected, if you wanted to explore, you should copy the directory to your current working space:
- in the R console type: `system("cp -R /analysis .")`.
- open `/analysis` and double click on znk_analysis.Rproj
From here you can re-run the analyses to your heart's content.
**Don't forget to stop the container when you are finished:**
```bash
docker stop ssc
```
### via command line
If you want to re-run the analysis in the container you can do the following:
```bash
docker run --rm -it -e ROOT=TRUE everhartlab/sclerotinia-366:latest bash
```
Once your docker container has started, you can run the full analysis with (note: this can take about 2 hours depending on the speed of your processor):
```bash
cd analysis
make clean # clear up all generated artifacts (reports, figures, tables)
make # generate all data and analyses
```
## Workflow for editing the project on your local copy
This is the workflow I use when I want to work on the project on my local computer. I open up the terminal to the home directory of the project and type:
```bash
docker run --name ssc -dp 8787:8787 -v $(pwd):/home/rstudio/ -e ROOT=TRUE everhartlab/sclerotinia-366:latest
```
This will spin up the container and mount my current working directory to the home directory of RStudio. This way, whenever I make changes in the docker container, they will show up on my system and I can track them using git. Note: I don't use the git tab in the Rstudio window because I've found it to be a bit wonky.