-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathREADME.Rmd
183 lines (129 loc) · 7.29 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
---
output:
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# Analysis of 366 *S. sclerotiorum* isolates
[![Last-changedate](https://img.shields.io/badge/last%20change-`r gsub('-', '--', Sys.Date())`-2F4096.svg)](https://github.com/everhartlab/sclerotinia-366/commits/master)
[![Licence](https://img.shields.io/badge/license-MIT%20License-2F4096.svg)](http://choosealicense.com/licenses/mit/)
[![minimal R version](https://img.shields.io/badge/R%3E%3D-3.4.2-2F4096.svg)](https://cran.r-project.org/)
[![Circle CI](https://circleci.com/gh/everhartlab/sclerotinia-366.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/everhartlab/sclerotinia-366)
This repository contains data, code, and a manuscript for analysis of 366 isolates of *Sclerotinia sclerotiorum* from the US and various countries around the world.
# Citations
## Publication
> Kamvar ZN, Amaradasa BS, Jhala R, McCoy S, Steadman JR, Everhart SE. (2017) Population structure and phenotypic variation of *Sclerotinia sclerotiorum* from dry bean (*Phaseolus vulgaris*) in the United States. *PeerJ* 5:e4152 <https://doi.org/10.7717/peerj.4152>
> Poster presented at the 2018 National Sclerotinia Initiative: <https://doi.org/10.6084/m9.figshare.5791713>
Data and Code
-------------
> Kamvar, Z. N., Amaradasa, B. S., Jhala, R., McCoy, S., Steadman, J. R., & Everhart, S. E. (2017, November). Data and analysis for population structure and phenotypic variation of *Sclerotinia sclerotiorum* from dry bean (*Phaseolus vulgaris*) in the United States. <https://doi.org/10.17605/OSF.IO/K8WTM>
Note: This citation represents the data and code that was in this repository at the time of re-submission (2017-11-15 20:42 UTC), For the docker container, this represents tag v1.1. You can find the live code at <https://osf.io/ejb5y>
# TOC
The analyses are arranged in the following order according to the [Makefile]:
1. [table-1.md]
1. [MCG-virulence.md]
1. [locus-stats.md]
1. [MLG-distribution.md]
1. [mlg-mcg.md]
1. [RDA-analysis.md]
1. [pop-diff.md]
1. [tree.md]
1. [wmn-differentiation.md]
1. [by-year.md]
1. [compare-aldrich-wolfe.md]
# 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/).
Jump to [Reproduction via Docker](#reproduction-via-docker) or [Reproduction Locally](#locally).
------
## Reproduction via Docker
This repository contains a [Dockerfile](Dockerfile), which specifies the
instructions to build a [docker](https://www.docker.com/) container. This is
designed to capture the complete development environment of the analysis so
that it can be accurately reproduced. The image is ~3.21Gb, so be sure that you
have enough memory on your computer to run it.
To Install Docker, go here: https://docs.docker.com/engine/installation/#desktop. Once you have downloaded docker, you can either pull the container or build it. Pulling is by far the quickest way to do this.
The docker container is located at https://hub.docker.com/r/everhartlab/sclerotinia-366/
### RStudio Server
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
```
### Building the container locally
If you don't want to pull from docker hub, you can build the container locally.
First, download the repository
```bash
git clone https://github.com/everhartlab/sclerotinia-366.git
cd sclerotinia-366/
docker build -t sclerotinia-366 .
```
Now that things are built, you can run the analysis in the image with:
```
docker run -it sclerotinia-366 bash
```
### Running the Analysis
Once you are in the container, you can run the analysis, which is mapped to
`analysis/`. The `make clean` command will wipe out all derivative files and
the `make` command will generate everything. Note that this took almost 2 hours
to run on my machine due to several bootstrapping processes.
```
cd analysis/
make clean
make
```
## Locally
This project is controlled via a [Makefile] which means that everything (analyses, tables, figures, the paper itself) is controlled via one command:
```
make
```
This will bootstrap the installation (warning: it will update packages),
process the data, perform the analyses, and compile the paper.
> Note: This analysis is only guaranteed to work with [the stated software environment](#packages-used).
Required software:
- GNU Make (If you're on Windows, you can use MinGW: http://www.mingw.org/)
- [R (version 3.4.1 or greater)](https://r-project.org)
- [LaTeX](https://www.latex-project.org/get)
- [pandoc](http://pandoc.org/) (Note: pandoc ships with Rstudio)
- [devtools](https://github.com/hadley/devtools#readme)
[Makefile]: Makefile
[table-1.md]: results/table-1.md
[MCG-virulence.md]: results/MCG-virulence.md
[locus-stats.md]: results/locus-stats.md
[MLG-distribution.md]: results/MLG-distribution.md
[mlg-mcg.md]: results/mlg-mcg.md
[RDA-analysis.md]: results/RDA-analysis.md
[pop-diff.md]: results/pop-diff.md
[tree.md]: results/tree.md
[wmn-differentiation.md]: results/wmn-differentiation.md
[by-year.md]: results/by-year.md
[compare-aldrich-wolfe.md]: results/compare-aldrich-wolfe.md
## Packages Used
```{r}
options(width = 100)
imports <- packageDescription("WorldSclerotinia")$Imports
imports <- strsplit(imports, "[^A-z]*,\n")[[1]]
for (i in imports) suppressPackageStartupMessages(library(i, character.only = TRUE))
devtools::session_info()
```