├── .gitignore
├── .nojekyll
├── 00--glossary.Rmd
├── 00--glossary.knit.html
├── 00--intro_to_r.Rmd
├── 00--intro_to_rstudio.Rmd
├── 00--required_data.Rmd
├── 00--required_software.Rmd
├── 02--quick_example.Rmd
├── 03--parsing.Rmd
├── 04--manipulating.Rmd
├── 05--plotting.Rmd
├── 06--quality_control.Rmd
├── 07--diversity_stats.Rmd
├── README.md
├── _glossary_definitions.Rmd
├── _sessioninfo.Rmd
├── _site.yml
├── about.Rmd
├── analysis_of_microbiome_community_data_in_r.Rproj
├── bibtexlib.bib
├── clean_data.Rdata
├── data
├── SMD.txt
├── example_data_1.tsv
├── example_data_2.fa
├── otuTable97.txt.bz2
└── taxAssignments97.txt
├── diversity_data.Rdata
├── docs
├── 00--glossary.html
├── 00--glossary.knit.html
├── 00--intro_to_r.html
├── 00--intro_to_rstudio.html
├── 00--required_data.html
├── 00--required_software.html
├── 00--required_software_files
│ └── figure-html
│ │ └── unnamed-chunk-2-1.png
├── 02--quick_example.html
├── 02--quick_example_files
│ └── figure-html
│ │ ├── unnamed-chunk-15-1.png
│ │ ├── unnamed-chunk-18-1.png
│ │ ├── unnamed-chunk-19-1.png
│ │ ├── unnamed-chunk-22-1.png
│ │ ├── unnamed-chunk-24-1.png
│ │ └── unnamed-chunk-29-1.png
├── 03--parsing.html
├── 04--manipulating.html
├── 05--plotting.html
├── 05--plotting_files
│ └── figure-html
│ │ ├── unnamed-chunk-10-1.png
│ │ ├── unnamed-chunk-11-1.png
│ │ ├── unnamed-chunk-12-1.png
│ │ ├── unnamed-chunk-14-1.png
│ │ ├── unnamed-chunk-15-1.png
│ │ ├── unnamed-chunk-16-1.png
│ │ ├── unnamed-chunk-17-1.png
│ │ ├── unnamed-chunk-18-1.png
│ │ ├── unnamed-chunk-19-1.png
│ │ ├── unnamed-chunk-22-1.png
│ │ ├── unnamed-chunk-23-1.png
│ │ ├── unnamed-chunk-25-1.png
│ │ ├── unnamed-chunk-26-1.png
│ │ ├── unnamed-chunk-27-1.png
│ │ ├── unnamed-chunk-28-1.png
│ │ ├── unnamed-chunk-3-1.png
│ │ ├── unnamed-chunk-30-1.png
│ │ ├── unnamed-chunk-31-1.png
│ │ ├── unnamed-chunk-32-1.png
│ │ ├── unnamed-chunk-33-1.png
│ │ ├── unnamed-chunk-4-1.png
│ │ ├── unnamed-chunk-5-1.png
│ │ ├── unnamed-chunk-7-1.png
│ │ ├── unnamed-chunk-8-1.png
│ │ └── unnamed-chunk-9-1.png
├── 06--quality_control.html
├── 06--quality_control_files
│ └── figure-html
│ │ ├── unnamed-chunk-12-1.png
│ │ ├── unnamed-chunk-13-1.png
│ │ ├── unnamed-chunk-5-1.png
│ │ ├── unnamed-chunk-8-1.png
│ │ └── unnamed-chunk-9-1.png
├── 07--diversity_stats.html
├── 07--diversity_stats_files
│ └── figure-html
│ │ ├── unnamed-chunk-14-1.png
│ │ ├── unnamed-chunk-15-1.png
│ │ ├── unnamed-chunk-2-1.png
│ │ ├── unnamed-chunk-20-1.png
│ │ ├── unnamed-chunk-21-1.png
│ │ ├── unnamed-chunk-22-1.png
│ │ ├── unnamed-chunk-23-1.png
│ │ ├── unnamed-chunk-28-1.png
│ │ ├── unnamed-chunk-29-1.png
│ │ ├── unnamed-chunk-3-1.png
│ │ ├── unnamed-chunk-32-1.png
│ │ ├── unnamed-chunk-35-1.png
│ │ ├── unnamed-chunk-38-1.png
│ │ ├── unnamed-chunk-6-1.png
│ │ ├── unnamed-chunk-8-1.png
│ │ ├── unnamed-chunk-8-2.png
│ │ └── unnamed-chunk-9-1.png
├── README.html
├── about.html
├── bibtexlib.bib
├── clean_data.Rdata
├── data
│ ├── SMD.txt
│ ├── example_data_1.tsv
│ ├── example_data_2.fa
│ ├── otuTable97.txt.bz2
│ └── taxAssignments97.txt
├── diversity_data.Rdata
├── figure_sources
│ ├── preferred_data_format.ods
│ ├── preferred_data_format_counts.png
│ ├── preferred_data_format_samples.png
│ └── typical_input_format.png
├── filtered_data.Rdata
├── footer.html
├── header.html
├── images
│ ├── IMG_3734.jpg
│ ├── boechera_stricta.jpg
│ ├── foster.jpeg
│ ├── rstudio_console.png
│ ├── rstudio_envrionment.png
│ ├── rstudio_file_browser.png
│ ├── rstudio_project.png
│ ├── rstudio_text_editor.png
│ └── wagner_barchart.png
├── index.html
├── parsed_data.Rdata
├── plotting_data.Rdata
├── plotting_files
│ └── figure-html
│ │ ├── unnamed-chunk-10-1.png
│ │ ├── unnamed-chunk-11-1.png
│ │ ├── unnamed-chunk-12-1.png
│ │ ├── unnamed-chunk-3-1.png
│ │ ├── unnamed-chunk-4-1.png
│ │ ├── unnamed-chunk-5-1.png
│ │ ├── unnamed-chunk-6-1.png
│ │ ├── unnamed-chunk-7-1.png
│ │ ├── unnamed-chunk-8-1.png
│ │ └── unnamed-chunk-9-1.png
├── ps_obj.Rdata
├── references
│ ├── journal.pcbi.1003531.PDF
│ └── journal.pone.0061217.PDF
├── site_libs
│ ├── bootstrap-3.3.5
│ │ ├── css
│ │ │ ├── bootstrap-theme.css
│ │ │ ├── bootstrap-theme.css.map
│ │ │ ├── bootstrap-theme.min.css
│ │ │ ├── bootstrap.css
│ │ │ ├── bootstrap.css.map
│ │ │ ├── bootstrap.min.css
│ │ │ ├── cerulean.min.css
│ │ │ ├── cosmo.min.css
│ │ │ ├── flatly.min.css
│ │ │ ├── fonts
│ │ │ │ ├── Lato.ttf
│ │ │ │ ├── LatoBold.ttf
│ │ │ │ ├── LatoItalic.ttf
│ │ │ │ ├── NewsCycle.ttf
│ │ │ │ ├── NewsCycleBold.ttf
│ │ │ │ ├── OpenSans.ttf
│ │ │ │ ├── OpenSansBold.ttf
│ │ │ │ ├── OpenSansBoldItalic.ttf
│ │ │ │ ├── OpenSansItalic.ttf
│ │ │ │ ├── OpenSansLight.ttf
│ │ │ │ ├── OpenSansLightItalic.ttf
│ │ │ │ ├── Raleway.ttf
│ │ │ │ ├── RalewayBold.ttf
│ │ │ │ ├── Roboto.ttf
│ │ │ │ ├── RobotoBold.ttf
│ │ │ │ ├── RobotoLight.ttf
│ │ │ │ ├── RobotoMedium.ttf
│ │ │ │ ├── SourceSansPro.ttf
│ │ │ │ ├── SourceSansProBold.ttf
│ │ │ │ ├── SourceSansProItalic.ttf
│ │ │ │ ├── SourceSansProLight.ttf
│ │ │ │ └── Ubuntu.ttf
│ │ │ ├── journal.min.css
│ │ │ ├── lumen.min.css
│ │ │ ├── paper.min.css
│ │ │ ├── readable.min.css
│ │ │ ├── sandstone.min.css
│ │ │ ├── simplex.min.css
│ │ │ ├── spacelab.min.css
│ │ │ ├── united.min.css
│ │ │ └── yeti.min.css
│ │ ├── fonts
│ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ ├── glyphicons-halflings-regular.svg
│ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ ├── glyphicons-halflings-regular.woff
│ │ │ └── glyphicons-halflings-regular.woff2
│ │ ├── js
│ │ │ ├── bootstrap.js
│ │ │ ├── bootstrap.min.js
│ │ │ └── npm.js
│ │ └── shim
│ │ │ ├── html5shiv.min.js
│ │ │ └── respond.min.js
│ ├── font-awesome-4.5.0
│ │ ├── css
│ │ │ ├── font-awesome.css
│ │ │ └── font-awesome.min.css
│ │ └── fonts
│ │ │ └── fontawesome-webfont.ttf
│ ├── jquery-1.11.3
│ │ └── jquery.min.js
│ └── navigation-1.1
│ │ ├── codefolding.js
│ │ ├── sourceembed.js
│ │ └── tabsets.js
├── styles.css
└── styles
│ ├── peerj-mod.csl
│ └── peerj.csl
├── figure_sources
├── preferred_data_format.ods
├── preferred_data_format_counts.png
├── preferred_data_format_samples.png
└── typical_input_format.png
├── filtered_data.Rdata
├── footer.html
├── header.html
├── images
├── IMG_3734.jpg
├── boechera_stricta.jpg
├── foster.jpeg
├── rstudio_console.png
├── rstudio_envrionment.png
├── rstudio_file_browser.png
├── rstudio_project.png
├── rstudio_text_editor.png
└── wagner_barchart.png
├── index.Rmd
├── parsed_data.Rdata
├── parsing_cache
└── html
│ ├── __globals
│ ├── __objects
│ ├── __packages
│ ├── unnamed-chunk-4_ed5e23b616eda0fc2f4b081ab8932b14.rdb
│ └── unnamed-chunk-4_ed5e23b616eda0fc2f4b081ab8932b14.rdx
├── plotting_data.Rdata
├── ps_obj.Rdata
├── references
├── journal.pcbi.1003531.PDF
└── journal.pone.0061217.PDF
├── style.R
├── styles.css
└── styles
├── peerj-mod.csl
└── peerj.csl
/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .Ruserdata
4 | *.pdf
5 | ./*.html
6 | ./*.png
7 | **/.~*
8 | site_libs/*
9 | *_files/*
10 | *_cache/*
--------------------------------------------------------------------------------
/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/.nojekyll
--------------------------------------------------------------------------------
/00--glossary.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | output: html_document
3 | bibliography: "bibtexlib.bib"
4 | ---
5 |
6 | ```{r setup, include=FALSE}
7 | source("style.R")
8 | knitr::opts_chunk$set(prompt = TRUE, comment = NA)
9 | ```
10 |
11 |
12 | # Glossary
13 |
14 | ```{r, echo=FALSE}
15 | gloss$render_all()
16 | ```
17 |
18 |
--------------------------------------------------------------------------------
/00--intro_to_r.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | output: html_document
3 | bibliography: "bibtexlib.bib"
4 | ---
5 |
6 | ```{r setup, include=FALSE}
7 | source("style.R")
8 | knitr::opts_chunk$set(prompt = TRUE, comment = NA)
9 | ```
10 |
11 |
12 | # A very short introduction to R
13 |
14 | R is a large and complex topic.
15 | Even those who use it every day only know a small subset of what there is to know.
16 | However, you don't need to know very much to do some very impressive things.
17 | This section is a very short introduction to the most basic aspects of R to get you started.
18 | Look at the list of resources and the end of this section for more complete tutorials.
19 |
20 | ## What is R?
21 |
22 | Unlike spreadsheet programs, like excel, R is a text-based "interactive" program, meaning that you use it by typing commands.
23 | If you type a valid command, R will do something, like printing something to the screen or modifying a piece of data.
24 | If you type an invalid command, R will print an error message and, ideally, nothing will happen.
25 | Where you type commands is referred to as the `r gloss$add('R console')`.
26 | If you are using `r gloss$add('RStudio')`, this is the lower left window.
27 | Here is what an R console looks like when R is first started:
28 |
29 | ```
30 | R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
31 | Copyright (C) 2018 The R Foundation for Statistical Computing
32 | Platform: x86_64-pc-linux-gnu (64-bit)
33 |
34 | R is free software and comes with ABSOLUTELY NO WARRANTY.
35 | You are welcome to redistribute it under certain conditions.
36 | Type 'license()' or 'licence()' for distribution details.
37 |
38 | Natural language support but running in an English locale
39 |
40 | R is a collaborative project with many contributors.
41 | Type 'contributors()' for more information and
42 | 'citation()' on how to cite R or R packages in publications.
43 |
44 | Type 'demo()' for some demos, 'help()' for on-line help, or
45 | 'help.start()' for an HTML browser interface to help.
46 | Type 'q()' to quit R.
47 |
48 | > |
49 | ```
50 |
51 | For example, if I type `1 + 1` into the console, R will do the math and "return" the result.
52 |
53 |
54 | ```{r}
55 | 1+1
56 | ```
57 |
58 | The thing after the `>` is what I typed and the line below is what was returned.
59 |
60 | Since I did not save the result, it was printed instead.
61 | The `[1]` at the start keeps track of how many values have been printed.
62 | Its not too useful when there is only a single value, as in this case, but gets more useful when many values are printed.
63 | For example, I could print values from 1 to 100 by typing:
64 |
65 | ```{r}
66 | 1:100
67 | ```
68 |
69 | Now the `[24]` on the second line means that `24` is the 24th element.
70 |
71 | ## Variables
72 |
73 | In programmer-speak, any piece of data is called a `r gloss$add("variable")`.
74 | There are different types, or `r gloss$add("class", shown = "classes")`, of variables such as `character` (text), `numeric` (numbers), and `data.frame`s (tables).
75 | You can "save" the result of commands in R using `<-` like so:
76 |
77 | ```{r}
78 | a_sequence <- 1:100
79 | ```
80 |
81 | Note how nothing is printed since the result of `1:100` was saved in the `a_sequence` variable, but it can still be printed by entering the name of the variable:
82 |
83 | ```{r}
84 | a_sequence
85 | ```
86 |
87 | Now, anytime `a_sequence` is used it would be as if `1:100` was typed instead (although the calculation would not be done again).
88 |
89 |
90 | ## Functions
91 |
92 | Any command/tool/action in R is a `r gloss$add("function")`
93 | Most functions are used by putting the input to the function (if any) in parentheses following the function name.
94 | For example, the `length` function returns how many things are in a variable:
95 |
96 | ```{r}
97 | length(a_sequence)
98 | ```
99 |
100 | Even things like `+` and `:` are functions, although these are used in a special way.
101 | For example, they could also be used this way, just to demonstrate the idea:
102 |
103 | ```{r}
104 | `:`(1, 10)
105 | `+`(1, 1)
106 | ```
107 |
108 | The vast majority of functions are used like `length`.
109 | Perhaps confusingly, functions are also variables and can be created and "saved".
110 | For example, the following code creates a function to add two numbers together and saves in the variable `add`:
111 |
112 | ```{r}
113 | add <- function(x, y) { x + y }
114 | ```
115 |
116 | We can now use this like any other function:
117 |
118 | ```{r}
119 | add(1, 1)
120 | ```
121 |
122 | And it can be printed like any other variable:
123 |
124 | ```{r}
125 | add
126 | ```
127 |
128 | Functions can range in complexity from simple ones like `add` to very long and complex functions that call other custom functions.
129 |
130 | ## Comments
131 |
132 | Reading code is difficult even if you wrote it.
133 | Although it might seem that the purpose of the code you just wrote is obvious, it will probably be much less clear in a month or two.
134 | Be kind to your future self or any other unfortunates that must interpret this code and use comments.
135 | Comments are parts of text that R ignores and programmers use to leave notes for themselves and other programmers.
136 | Anything that appears after a `#` is a comment and will be ignored by R.
137 |
138 | ```{r prompt=FALSE}
139 | # Add 1 + 1 and writes the result to console
140 | 1 + 1 # This is addition
141 | ```
142 |
143 | Comments are only needed when you save R commands in a text file, rather than experimenting on the R console interactively.
144 |
145 | ## Typical workflow
146 |
147 | In the examples above we have been assuming you are using R "interactively", which means typing things directly into the console.
148 | This is fine for experimenting, but is really not the best way to use R.
149 | You should write your commands in a `r gloss$add("plain text")` file with a ".R" file extension and copy and paste them into the R console.
150 | That way you have a record of what you have done and can rerun your entire analysis easily.
151 | If you are using RStudio, you can move the cursor to the line you want to run in the text editor and Ctrl + Enter to copy, paste, and execute the line in the console all at once.
152 |
153 | ## R packages
154 |
155 | An R package is a set of user-defined functions organized so that people can easily share and use them.
156 | Most of the functions used by most R users are from R packages rather than those supplied by `r gloss$add("base R")`.
157 | R packages can be installed in a few ways, but the most common is to download them from `r gloss$add('The Comprehensive R Archive Network (CRAN)')` using the `install.packages` function.
158 | For example `stringr` is an R package that supplies functions to work with text.
159 |
160 | ```{r eval = FALSE}
161 | install.packages("stringr")
162 | ```
163 |
164 | Once installed, a package must be "loaded" using the `library` function before any functions it supplies can be used:
165 |
166 | ```{r}
167 | library("stringr")
168 | ```
169 |
170 | Now we can use functions from the `stringr` package.
171 | For example, the `str_count` function counts the number of times a piece of text occurs in a larger piece of text:
172 |
173 | ```{r}
174 | str_count(string = "R is awesome!!!", pattern = "!")
175 | ```
176 |
177 | ## Getting help/documentation
178 |
179 | One of the most important skills in R is looking up (and interpreting) the built-in documentation.
180 | You can get the help for **any** R function by prefixing it with a question mark like so:
181 |
182 | ```{r eval = FALSE}
183 | ?getwd
184 | ```
185 |
186 | Help files have an overview of:
187 |
188 | - purpose of a function
189 | - options it takes
190 | - output it yields
191 | - examples demonstrating its usage
192 |
193 | This built-in documentation for each function can be a bit terse and hard to interpret and its quality varies greatly between packages.
194 | R packages will also usually have `r gloss$add("vignette", shown = "vignettes")`, which combine examples and explanations for how functions in a package are generally used.
195 | These can be found online or accessed in the installed package using the `browseVignettes` function:
196 |
197 | ```{r eval = FALSE}
198 | browseVignettes(package = "metacoder")
199 | ```
200 |
201 | Finally, some of the best documentation can be found online.
202 | For some of the more popular packages, like `dplyr` and `ggplot2`, the best documentation is from unofficial sources, like blogs, books, and question/answer sites like [Stack Overflow](https://stackoverflow.com/).
203 |
204 |
205 | ## What to do when you dont know what to do
206 |
207 | When you run into problems or don't know how to do something, **it will save you a lot of time** if you do an internet search describing the problem you have before trying to fix it by guessing, reading through documentation, or making a custom solution.
208 | If the problem has an error message, then **copy and paste the error into a search engine**.
209 | At least 95% of problems are well documented and discussed.
210 | If you think "there must be a better way to do this", there almost certainly is and some nice person on the internet spent hours writing a blog post about it or answering a question on [Stack Overflow](https://stackoverflow.com/).
211 | The trick is knowing what to type since the problem/concept might take some jargon to describe.
212 | Try describing your problem a few ways before giving up.
213 | If you know someone who uses R more, try asking them what to search for rather than asking them to help you themselves (unless they are super nice and/or have nothing better to do).
214 | For example, "I want to combine two tables based on the content of a column they both share" is a very common need, but it might be hard to get Google to understand what you want.
215 | Someone who uses R a lot will tell you to search for "joining" or "joins", which will lead you in the right direction, and will take only a few seconds of their time.
216 |
217 | ## More resources
218 |
219 | This was only the most basic concepts in R, but there are lots of free tutorials and info online to learn more.
220 | Searching "beginner R tutorial" on the internet will show hundreds of free resources.
221 | Here are a few resources for beginners to learn R:
222 |
223 | ### Introductory
224 |
225 | * [Swirl](http://swirlstats.com/) is a very well thought out R package that teaches you interactively.
226 | * [Code School Try R](https://www.codeschool.com/courses/try-r) is a nice interactive tutorial.
227 | * [Quick R](http://www.statmethods.net/interface/help.html)
228 | * [R reference card](http://cran.r-project.org/doc/contrib/Short-refcard.pdf)
229 | * A very nice, short [introduction to R](http://ateucher.github.io/rcourse_site/index.html)
230 | * [Jenny Bryan's 545 statistics in R course content](http://stat545.com/topics.html)
231 | * [Data Carpentry: R for data analysis and visualization of Ecological Data](http://www.datacarpentry.org/R-ecology-lesson/index.html)
232 | * [Software Carpentry: Programming with R](http://swcarpentry.github.io/r-novice-inflammation/)
233 | * [Software Carpentry: R for Reproducible Scientific Analysis](http://swcarpentry.github.io/r-novice-gapminder/)
234 | * [DataCamp's free introduction to R course](https://www.datacamp.com/courses/free-introduction-to-r)
235 |
236 | ### Advanced
237 |
238 | * [Advanced R](http://adv-r.had.co.nz/) by Hadley Wickham
239 |
240 | ### Books
241 |
242 | * [R in a Nutshell](http://shop.oreilly.com/product/0636920022008.do)
243 | * [R cookbook](http://www.cookbook-r.com/) is a nice quick reference and tutorial for general R use.
244 | * [ggplot2 book](http://ggplot2.org/book/) is a useful reference if you want to customize graphs for publication.
245 |
246 |
247 |
--------------------------------------------------------------------------------
/00--intro_to_rstudio.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | output: html_document
3 | bibliography: "bibtexlib.bib"
4 | ---
5 |
6 | ```{r setup, include=FALSE}
7 | source("style.R")
8 | ```
9 |
10 | # A quick introduction to RStudio
11 |
12 | RStudio is not R or a "type" of R.
13 | It is a program that runs R and provides extra tools that are helpful when writing R code, kind of like how your operating system can run a web browser.
14 | This workshop will assume you are using RStudio to interact with R, although everything here can be done without RStudio.
15 | Most R users seem to use RStudio and we like it, so we recommend using it.
16 |
17 |
18 | ## Installing RStudio
19 |
20 | The main version of RStudio that most people use is free and open source and can be downloaded here:
21 |
22 | https://www.rstudio.com/products/rstudio/download/#download
23 |
24 | ## The parts of RStudio
25 |
26 | When you open RStudio, you will notice a lot of different windows, each with some tabs.
27 | This can be overwhelming at first, but you only need to use a few to be productive and the ones you need are similar to other computer programs you probably already use.
28 |
29 | ### The R console tab
30 |
31 | 
32 |
33 | The `r gloss$add('R console')` is where you give R commands and is the lower left window in RStudio.
34 | It is the same way you would interact with R on the command line or terminal.
35 | In other words, the "Console" tab in the lower left window is the only part of RStudio that is actually R itself; everything else is optional tools.
36 |
37 | ### The text editor
38 |
39 | 
40 |
41 | The upper left window is a `r gloss$add('plain text')` editor, like Notepad or TextEdit.
42 | "Plain text" means no fonts, formatting etc, unlike program like Microsoft Word.
43 | You can have multiple files open at once and they appear in tabs.
44 | Depending on the type of the file being edited (i.e. its file extension), there will be different tools and behavior, but its all plain text.
45 |
46 | ### The file browser tab
47 |
48 | 
49 |
50 | The default tab in the lower right window is a basic file browser.
51 | You can open, delete, and rename files there.
52 | Its not as well-developed as your operating system's file browser and is mostly there so you don't have to switch applications to manage files.
53 | You can ignore the rest of the tabs there for now (Plots, Packages, Help, and Viewer), since they are usually automatically opened when they are relevant.
54 |
55 | ### The "Environment" tab
56 |
57 | 
58 |
59 | The "Environment" tab in the top right window lists the `r gloss$add('variable', shown = 'variables')` and `r gloss$add('function', shown = 'functions')` present in the current R session.
60 | It does not include the function/data in loaded packages however (unless you select a package from the drop down menu that says "Global Environment").
61 | When you ask "what have I created so far", the answer is in the environment tab.
62 |
63 | ## Console tricks
64 |
65 | ### Code completion
66 |
67 | RStudio has a very useful feature called code completion using the Tab key which can complete the full name of an object.
68 | For example type `hel` and hit Tab and you will see several functions pop up and you can select `help()`.
69 |
70 | This also works inside a function to find function arguments.
71 | Type `help(` and hit Tab to select arguments for the help function.
72 |
73 | ### Command history
74 |
75 | RStudio records your command history and you can scroll up or down the history of executed commands using the *Up* or *Down* keys.
76 | Make sure your cursor is in the console and try to re-execute previous commands.
77 |
78 | ### Quickly running code in a file
79 |
80 | Its best to write even experimental code in a file in the text editor, rather than writing it directly to the console, but it can get tedious to always be copying and pasting to try it out.
81 | Instead, you can move the cursor to the line you want to run in the text editor and Ctrl + Enter to copy, paste, and execute the line in the console all at once.
82 | This is a good habit to develop.
83 |
84 | ## R projects
85 |
86 | `r gloss$add('R project', shown = 'R projects')` are an RStudio concept and are integral to many people's workflow and organization.
87 | An R project is just a folder that has a file in it ending in ".Rproj".
88 | This file is created by RStudio when you create a new project.
89 | Although R projects are not needed, we highly recommend using them for the following reasons:
90 |
91 | * They help with organization, since they encourage you to put all the code and data for a project in a single directory.
92 | * They help standardize your current working directory. Each time a project is opened, your current working directory is automatically switched to the project directory.
93 | * They store where you left off when you last closed RStudio. Depending on how you set things up, its as if you never closed RStudio at all. All the variables and files will be where you last left them. Even unsaved files. NOTE: It is recommended that you do not rely on restoring variables between sessions, although RStudio will offer.
94 |
95 | Whenever you start something in R that you want to save, we recommend using an R project.
96 | You can make a new project by clicking on the upper right drop-down menu or "File > New Project".
97 |
98 | 
99 |
100 |
101 | ### Everything else
102 |
103 | Don't worry about it!
104 | Its all useful, but not needed when you start, and some of it you will likely never use.
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/00--required_data.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | output: html_document
3 | bibliography: "bibtexlib.bib"
4 | ---
5 |
6 | ```{r setup, include=FALSE}
7 | source("style.R")
8 | ```
9 |
10 | # Datasets used in this workshop
11 |
12 | In this workshop, we will be using data from @wagner2016host, a study on the effects of plant age, genotype, and environment on the bacterial microbiome of [*Boechera stricta*](https://en.wikipedia.org/wiki/Boechera_stricta), a perennial herb in the mustard family.
13 | @wagner2016host released their raw data with the article and it is available [here](http://datadryad.org/resource/doi:10.5061/dryad.g60r3) on [dryad](http://datadryad.org/).
14 | This is a great example of how to share your raw data!
15 |
16 | A copy of this data is included in this site and can be downloaded from links below.
17 |
18 | ## Sample metadata
19 |
20 | A table with a sample in each row and info about the samples in each column, such as plant genotype and field site.
21 | It is a 170Kb `r gloss$add('tab-delimited text file')`.
22 |
23 | SMD.txt
24 |
25 | ## The OTU abundance table
26 |
27 | This has the number of reads associated with each `r gloss$add('Operational Taxonomic Units (OTUs)', shown = 'OTU')` in each sample.
28 | It is a 6Mb compressed tab-delimited text file.
29 |
30 | otuTable97.txt.bz2
31 |
32 | ## The OTU taxonomy file
33 |
34 | This has the `r gloss$add('taxonomic classifications')` for each OTU.
35 | It is a 6Mb tab-delimited text file.
36 |
37 | taxAssignments97.txt
38 |
39 | ## References
40 |
--------------------------------------------------------------------------------
/00--required_software.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | output: html_document
3 | bibliography: "bibtexlib.bib"
4 | ---
5 |
6 | ```{r setup, include=FALSE}
7 | source("style.R")
8 | ```
9 |
10 | # Installing required software and data
11 |
12 | ## Installing R
13 |
14 | R is a computer language that focuses on statistics, data science, and visualization.
15 | It can be installed on all common operating systems.
16 | R can be downloaded here:
17 |
18 | https://cran.r-project.org/
19 |
20 |
21 | ## Installing RStudio
22 |
23 | `r gloss$add('RStudio')` is an "Integrated Development Environment" (IDE) which is a fancy way of saying "text editor with extra programming-related tools".
24 | RStudio makes it easier to use R, but is not needed to use R.
25 | Most R users seem to use RStudio, so we are recommending it for this workshop.
26 | The main version of RStudio, which is free and open source, can be downloaded here:
27 |
28 | https://www.rstudio.com/products/rstudio/download/#download
29 |
30 |
31 | ## Installing the required R packages
32 |
33 | In addition to tools included with every R installation, it is common to install `r gloss$add('R package', shown = 'R packages')`, which are sets of tools bundled together in a standardize way, making them easy to install.
34 | In fact, most functionality used in R is from R packages, not `r gloss$add('base R')`.
35 | The following packages are used in this primer.
36 | Clicking of their name will lead to documentation (perhaps unofficial) for the package.
37 |
38 | 1. [vegan](http://cc.oulu.fi/~jarioksa/opetus/metodi/vegantutor.pdf): Implements many standard statistical techniques used in ecological research. Is used extensively by packages like `phyloseq` and `metacoder`. [@dixon2003vegan]
39 | 1. [metacoder](https://github.com/grunwaldlab/metacoder#an-r-package-for-metabarcoding-research-planning-and-analysis): Manipulation and visualization of taxonomic data, particularly those from amplicon metagenomics research. [@foster2017metacoder]
40 | 1. [taxa](https://github.com/ropensci/taxa#taxa): defines taxonomic `r gloss$add('class', shown = 'classes')` and functions to manipulate them. The goal is to use these classes as low level fundamental taxonomic classes that other R packages can build on and use. This is used by `metacoder`. [@foster2018taxa]
41 | 1. [phyloseq](https://joey711.github.io/phyloseq/index.html): Popular package with tools for analysis and visualization of microbiome data [@mcmurdie2013phyloseq].
42 | 1. [ggplot2](http://r-statistics.co/Complete-Ggplot2-Tutorial-Part1-With-R-Code.html): Awesome graphing package. [@wickham2009ggplot2]
43 | 1. [dplyr](http://stat545.com/block009_dplyr-intro.html): A package for manipulating tabular data with a cohesive and intuitive set of commands. A popular alternative to base R methods. [@wickham2015dplyr]
44 | 1. [readr](https://cran.r-project.org/web/packages/readr/vignettes/readr.html): Makes reading tabular data from files easier.
45 | 1. [stringr](https://cran.r-project.org/web/packages/stringr/vignettes/stringr.html): Functions for text manipulation.
46 | 1. [agricolae](https://cran.r-project.org/web/packages/agricolae/vignettes/tutorial.pdf): Used for the design and analysis of experiments, especially plant-related experiments.
47 | 1. [ape](http://ape-package.ird.fr/): A popular package for DNA sequence analysis and phylogenetics.
48 |
49 | We wrote and actively maintain `metacoder` [@foster2017metacoder] and `taxa` [@foster2018taxa] so they
50 | are heavily relied upon in this primer.
51 |
52 | More R resources useful for microbiome data analysis can be found here:
53 |
54 | https://microsud.github.io/Tools-Microbiome-Analysis/
55 |
56 | You can enter the following script in the R console to install these packages:
57 |
58 | ```{r, eval = FALSE}
59 | # Install phyloseq from Bioconductor
60 | source('http://bioconductor.org/biocLite.R')
61 | biocLite("phyloseq")
62 |
63 | # Install the rest of the packages from CRAN
64 | install.packages(c("vegan", "metacoder", "taxa", "ggplot2", "dplyr", "readr", "stringr", "agricolae", "ape"),
65 | repos = "http://cran.rstudio.com",
66 | dependencies = TRUE)
67 | ```
68 |
69 | If the installation does not work, try installing the packages one at a time (e.g., `install.packages("taxa")`) and look for error messages.
70 | Usually the problem is that there is a non-R dependency that needs to be installed and how you install it will depend on your operating system.
71 | Copying the error messages into Google will usually help you figure it out.
72 | If a package has installed correctly, you should be able to load it with `library` (e.g., `library(phyloseq)`).
73 |
74 | You can test if the software is installed correctly by opening RStudio and running the following code.
75 | Look at the appendices if you need help using R or RStudio.
76 |
77 | ```{r warning=FALSE}
78 | library(metacoder)
79 | x = parse_tax_data(hmp_otus, class_cols = "lineage", class_sep = ";",
80 | class_key = c(tax_rank = "info", tax_name = "taxon_name"),
81 | class_regex = "^(.+)__(.+)$")
82 | heat_tree(x, node_label = taxon_names, node_size = n_obs, node_color = n_obs)
83 | ```
84 |
85 | If you see the above graph, then congratulations! You should now be all set for using R in this workshop.
86 | If you do not see the graph, then email us the result of the following code to help us troubleshoot the problem.
87 |
88 | ```{r eval=FALSE}
89 | sessionInfo()
90 | ```
91 |
92 |
93 | ## References
94 |
--------------------------------------------------------------------------------
/06--quality_control.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | output: html_document
3 | bibliography: "bibtexlib.bib"
4 | ---
5 |
6 | ```{r setup, include=FALSE}
7 | source("style.R")
8 | ```
9 |
10 | # Data quality control
11 |
12 | Sequencing technologies all have some amount of error.
13 | Some of this error happens during PCR and some happens during sequencing.
14 | There are lots of ways to filter out errors including:
15 |
16 | * Removing sequences/bases that the sequencer indicates are low quality.
17 | This information is typically in the `r gloss$add('FASTQ', show = '.fastq')` files returned by the sequencer.
18 | There are many programs, such as [trimmomatic](http://www.usadellab.org/cms/?page=trimmomatic), that can use the quality scores in these files to filter out low-quality sequences.
19 | * Clustering similar sequences together. Many erroneous sequences are very similar to the true sequences, so they will be incorporated into the same `r gloss$add('Operational Taxonomic Units (OTUs)', show = 'OTU')` as the true sequence. In that sense, clustering into OTUs will hide some sequencing error.
20 | * Removal of `r gloss$add('chimeric sequences')`. "Chimeras" are more significant errors that occur during PCR when an incomplete amplicon acts as a primer for a different template in a subsequent cycle. Most amplicon metagenomic pipelines (e.g. QIIME, mothur, usearch) have functions to detect and remove chimeras.
21 | * Removing low-abundance sequences. Most of the time, erroneous sequences will occur much less often than the true sequence. Simply removing any unique sequence / OTU that appears less than some minimum number of times is an effective way to remove these errors. OTUs represented by only a single sequence are commonly called `r gloss$add('singleton', show = 'singletons')`. So when you hear things like "singletons were removed" and means all OTUs with only a single sequence were removed.
22 | * `r gloss$add('Rarefaction', show = 'Rarefying')` read counts. Usually, we try to make each sample in a sequencing run have the same number of reads sequenced, but that does not always happen. When a sample has many more reads than another sample, its apparent diversity can be artificially inflated since rare taxa are more likely to be found. To avoid this, the reads are subsampled to a fixed number or "rarefied".
23 | * Converting counts to presence/absence. Due to PCR biases and the nature of `r gloss$add('compositional data')`, many researchers advocate not using read count information at all. Instead, they recommend converting counts to simply "present" or "absent".
24 |
25 | Since we are only working with abundance matrices in these tutorials, the first three types of quality control have already been done (ideally), but we can still remove low-abundance OTUs and rarefy the counts of the remaining OTUs.
26 |
27 | ## Load example data
28 |
29 | If you are starting the workshop at this section, or had problems running code in a previous section, use the following to load the data used in this section.
30 | You can download the "filtered_data.Rdata" file here.
31 | If `obj` and `sample_data` are already in your environment, you can ignore this and proceed.
32 |
33 | ```{r}
34 | load("filtered_data.Rdata")
35 | ```
36 |
37 | ## Removing low-abundance counts
38 |
39 | The easiest way to get rid of some error in your data is to throw out any count information below some threshold.
40 | The threshold is up to you; removing singletons or `r gloss$add('doubletons')` is common, but lets be more conservative and remove any counts less than 10.
41 | The `zero_low_counts` counts can be used to convert any counts less than some number to zero.
42 |
43 | ```{r}
44 | library(metacoder)
45 | obj$data$otu_counts <- zero_low_counts(obj, "otu_counts", min_count = 10,
46 | other_cols = TRUE) # keep OTU_ID column
47 | ```
48 |
49 | That set all read counts less than 10 to zero.
50 | It did not filter out any OTUs or their associated taxa however.
51 | We can do that using `filter_obs`, which is used to filter data associated with a taxonomy in a `taxmap` object.
52 | First lets find which OTUs now have now reads associated with them.
53 |
54 | ```{r}
55 | no_reads <- rowSums(obj$data$otu_counts[, sample_data$SampleID]) == 0
56 | sum(no_reads) # when `sum` is used on a TRUE/FALSE vector it counts TRUEs
57 | ```
58 |
59 | So now `r sum(no_reads)` of `r nrow(obj$data$otu_counts)` OTUs have no reads.
60 | We can remove them and the taxa they are associated with like so:
61 |
62 | ```{r}
63 | obj <- filter_obs(obj, "otu_counts", ! no_reads, drop_taxa = TRUE)
64 | print(obj)
65 | ```
66 |
67 |
68 | ## Rarefaction
69 |
70 | Rarefaction is used to simulate even numbers of samples (i.e. reads).
71 | Even sampling is important for at least two reasons:
72 |
73 | * When comparing diversity of samples, more samples make it more likely to observe rare species. This will have a larger effect on some diversity indexes than others, depending on how they weigh rare species.
74 | * When comparing the similarity of samples, the presence of rare species due to higher sampling depth in one sample but not another can make the two samples appear more different than they actually are.
75 |
76 | Therefore, when comparing the diversity or similarity of samples, it is important to rarefy, or subsample, to a constant depth.
77 | Typically, the depth chosen is the minimum sample depth.
78 | If the minimum depth is very small, the samples with the smallest depth can be removed and the minimum depth of the remaining samples can be used.
79 |
80 | Lets take a look at the distribution of read depths of our samples:
81 |
82 | ```{r fig.width=10, fig.height=5}
83 | hist(colSums(obj$data$otu_counts[, sample_data$SampleID]))
84 | ```
85 |
86 | We have a minimum depth of `r min(colSums(obj$data$otu_counts[, sample_data$SampleID]))`, a median of `r as.integer(median(colSums(obj$data$otu_counts[, sample_data$SampleID])))` and a maximum depth of `r max(colSums(obj$data$otu_counts[, sample_data$SampleID]))`.
87 | We could try to remove one or two of the samples with the smallest depth, since it seems like a waste to throw out so much data, but for this tutorial we will just rarefy to the minimum of `r min(colSums(obj$data$otu_counts[, sample_data$SampleID]))` reads.
88 | The `vegan` package implements many functions to help with rarefying data, but we will use a function from `metacoder` that calls the functions from `vegan` and reformats the input and outputs to make them easier to use with the way our data is formatted.
89 |
90 | ```{r}
91 | obj$data$otu_rarefied <- rarefy_obs(obj, "otu_counts", other_cols = TRUE)
92 | print(obj)
93 | ```
94 |
95 | This probably means that some OTUs now have no reads in the rarefied dataset.
96 | Lets remove those like we did before.
97 | However, since there is now two tables, we should not remove any taxa since they still might be used in the rarefied table, so we will not add the `drop_taxa = TRUE` option this time.
98 |
99 | ```{r}
100 | no_reads <- rowSums(obj$data$otu_rarefied[, sample_data$SampleID]) == 0
101 | obj <- filter_obs(obj, "otu_rarefied", ! no_reads)
102 | print(obj)
103 | ```
104 |
105 |
106 | ## Rarefaction curves
107 |
108 | The relationship between the number of reads and the number of OTUs can be described using `r gloss$add('Rarefaction', shown = 'rarefaction curves')`.
109 | Each line represents a different sample (i.e. column) and shows how many OTUs are found in a random subsets of different numbers of reads.
110 | The `rarecurve` function from the `vegan` package will do the random subsampling and plot the results for an abundance matrix.
111 | For example, the code below plots the rarefaction curve for a single sample:
112 |
113 | ```{r fig.width=10, fig.height=5}
114 | library(vegan)
115 | rarecurve(t(obj$data$otu_counts[, "M1981P563"]), step = 20,
116 | sample = min(colSums(obj$data$otu_counts[, sample_data$SampleID])),
117 | col = "blue", cex = 1.5)
118 | ```
119 |
120 | For this sample, few new OTUs are observed after about 20,000 reads.
121 | Since the number of OTUs found flattens out, it suggests that the sample had sufficient reads to capture most of the diversity.
122 | Like other functions in `vegan`, `rarecurve` expects samples to in rows instead of columns, so we had to `r gloss$add('transpose')` (make rows columns) the matrix with the `t` function before passing it to `rarecurve`.
123 | If you plot all the samples, which takes a few minutes, it looks like this:
124 |
125 | ```{r fig.width=10, fig.height=5, echo=FALSE, cache=TRUE}
126 | rarecurve(t(obj$data$otu_counts[, sample_data$SampleID]), step = 20,
127 | sample = min(colSums(obj$data$otu_counts[, sample_data$SampleID])),
128 | col = "blue", cex = 0.6)
129 | ```
130 |
131 |
132 | ## Converting to presence/absence
133 |
134 | Many researchers believe that read depth is not informative due to PCR and sequencing biases.
135 | Therefore, instead of comparing read counts, the counts can be converted to presence or absence of an OTU in a given sample.
136 | This can be done like so:
137 |
138 | ```{r}
139 | counts_to_presence(obj, "otu_rarefied")
140 | ```
141 |
142 | For this workshop however, we will use the read counts.
143 |
144 | ```{r include=FALSE}
145 | save(obj, sample_data, file = "clean_data.Rdata")
146 | ```
147 |
148 |
149 | ## Exercises
150 |
151 | In these exercises, we will be using the `obj` from the analysis above.
152 | If you did not run the code above or had problems, run the following code to get the objects used.
153 | You can download the "clean_data.Rdata" file here.
154 |
155 | ```{r}
156 | load("clean_data.Rdata")
157 | ```
158 |
159 | **1a)** Consider the following rarefaction curves:
160 |
161 | ```{r fig.width=10, fig.height=5, echo=FALSE}
162 | ex_subset <- t(obj$data$otu_counts[, 3:5])
163 | rownames(ex_subset) <- c("A", "B", "C")
164 | rarecurve(ex_subset, step = 20,
165 | sample = min(colSums(obj$data$otu_counts[, sample_data$SampleID])),
166 | col = "blue", cex = 2)
167 | ```
168 |
169 | **1b)** Which sample is more diverse?
170 |
171 | ```{asis hide_button = "Show Answer"}
172 | B
173 | ```
174 |
175 | **1c)** Which sample needs the most reads to capture all of its diversity?
176 |
177 | ```{asis hide_button = "Show Answer"}
178 | B
179 | ```
180 |
181 | **1d)** What would be a sufficient read count to capture all of the diversity in these three samples?
182 |
183 | ```{asis hide_button = "Show Answer"}
184 | Around 40,000 reads.
185 | ```
186 |
187 | **2)** Look at the documentation for `rarefy_obs`. Rarefy the sample OTU counts to 1000 reads.
188 |
189 | ```{r hide_button = TRUE}
190 | rarefy_obs(obj, "otu_counts", sample_size = 1000)
191 | ```
192 |
193 | **3)** What are two ways of accounting for uneven sample depth?
194 |
195 | ```{asis hide_button = "Show Answer"}
196 | Rarefaction and converting counts to proportions.
197 | ```
198 |
199 | **4)** What are some reasons that read counts might not correspond to species abundance in the original sample? Try to think of at least 3. There are 7 listed in the answer below and there are probably other reasons not listed.
200 |
201 | ```{asis hide_button = "Show Answer"}
202 | * PCR primers amplify some species more than others.
203 | * DNA sequencers sequence some sequences more than others.
204 | * The locus being amplified might have different numbers of copies in different organisms.
205 | * DNA from dead organisms can still be amplified, although this might not be a problem depending on the goal of the research.
206 | * Different sequences/organisms degrade in the environment at different rates.
207 | * Some organisms (e.g. spore-forming bacteria) are more resistant to DNA extraction techniques, so might not be as well represented in the DNA extract.
208 | * Some species have more DNA per individual / weight than others.
209 | ```
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This is the source code for the "Analysis of Microbiome Community Data in R" ICPP 2018 workshop.
2 | The **current version of this document** is available at:
3 |
4 | https://grunwaldlab.github.io/metacoder_documentation/workshop--00--introduction.html
--------------------------------------------------------------------------------
/_sessioninfo.Rmd:
--------------------------------------------------------------------------------
1 | ```{r results = "hold", eval=FALSE, message = FALSE, echo = FALSE}
2 | devtools::session_info()
3 | ```
--------------------------------------------------------------------------------
/_site.yml:
--------------------------------------------------------------------------------
1 | name: my-website
2 | navbar:
3 | title: Analysis of Microbiome Data in R
4 | left:
5 | - text: Example analysis
6 | href: 02--quick_example.html
7 | - text: Workshop
8 | icon: fa-laptop
9 | menu:
10 | - text: Required software
11 | href: 00--required_software.html
12 | - text: Required datasets
13 | href: 00--required_data.html
14 | - text: Getting data into R
15 | href: 03--parsing.html
16 | - text: Manipulating taxonomic data
17 | href: 04--manipulating.html
18 | - text: Plotting taxonomic data
19 | href: 05--plotting.html
20 | - text: Data quality control
21 | href: 06--quality_control.html
22 | - text: Diversity and Ordination
23 | href: 07--diversity_stats.html
24 | - text: Appendices
25 | icon: fa-book
26 | menu:
27 | - text: Introduction to R
28 | href: 00--intro_to_r.html
29 | - text: Introduction to RStudio
30 | href: 00--intro_to_rstudio.html
31 | - text: Glossary
32 | href: 00--glossary.html
33 | - text: Website source code
34 | href: https://github.com/grunwaldlab/analysis_of_microbiome_community_data_in_r
35 | - text: About
36 | icon: fa-info
37 | href: about.html
38 | output:
39 | html_document:
40 | theme: sandstone
41 | highlight: tango
42 | include:
43 | in_header: header.html
44 | after_body: footer.html
45 | css: styles.css
46 | lib_dir: site_libs
47 | self_contained: no
48 | output_dir: docs
49 |
50 |
--------------------------------------------------------------------------------
/about.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | output: html_document
3 | bibliography: "bibtexlib.bib"
4 | ---
5 |
6 |
7 |
10 |
11 |
12 |
18 |
19 |
About the authors
20 |
21 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | **Niklaus J. Grünwald** is a plant pathologist with the USDA Agricultural
34 | Research Service and a Professor in the Department of Botany and Pant Pathology
35 | and the Center for Genome Research and Biocomputing at Oregon State University.
36 | He received his PhD from UC Davis and conducted postdoctoral research at Cornell
37 | University. His research focuses on understanding the evolutionary patterns and
38 | processes of emerging pathogens using population genetic and evolutionary
39 | approaches and development of computational tools for characterizing pathogens and communities. Members of his group have developed several widely used R packages including: [*poppr*](http://github.com/grunwaldlab/poppr), [*vcfr*](https://github.com/grunwaldlab/vcfR), [*taxa*](https://cran.r-project.org/web/packages/taxa/index.html), and [*metacoder*](https://github.com/grunwaldlab/metacoder).
40 |
66 |
67 | **Zach S. L. Foster** is a graduate student in the Department of Botany and Plant Pathology at Oregon State University. He is the lead developer of the [*metacoder*](https://cran.r-project.org/web/packages/metacoder/index.html) and [*taxa*](https://cran.r-project.org/web/packages/taxa/index.html) R packages. He is also a recipient of the ROpenSci fellowship.
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/analysis_of_microbiome_community_data_in_r.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: Sweave
13 | LaTeX: pdfLaTeX
14 |
15 | BuildType: Website
16 |
--------------------------------------------------------------------------------
/bibtexlib.bib:
--------------------------------------------------------------------------------
1 | @article{callahan2016dada2,
2 | title={DADA2: high-resolution sample inference from Illumina amplicon data},
3 | author={Callahan, Benjamin J and McMurdie, Paul J and Rosen, Michael J and Han, Andrew W and Johnson, Amy Jo A and Holmes, Susan P},
4 | journal={Nature methods},
5 | volume={13},
6 | number={7},
7 | pages={581},
8 | year={2016},
9 | publisher={Nature Publishing Group}
10 | }
11 |
12 | @article{simpson1949measurement,
13 | title={Measurement of diversity},
14 | author={Simpson, Edward H},
15 | journal={nature},
16 | volume={163},
17 | number={4148},
18 | pages={688},
19 | year={1949},
20 | publisher={Nature Publishing Group},
21 | doi={10.1038/163688a0}
22 | }
23 |
24 | @article{hill1973diversity,
25 | title={Diversity and evenness: a unifying notation and its consequences},
26 | author={Hill, Mark O},
27 | journal={Ecology},
28 | volume={54},
29 | number={2},
30 | pages={427--432},
31 | year={1973},
32 | publisher={Wiley Online Library},
33 | URL={https://doi.org/10.2307/1934352}
34 | }
35 |
36 | @article{foster2018taxa,
37 | title={Taxa: An R package implementing data standards and methods for taxonomic data},
38 | author={Foster, Zachary SL and Chamberlain, Scott and Gr{\"u}nwald, Niklaus J},
39 | JOURNAL = {F1000Research},
40 | VOLUME = {7},
41 | YEAR = {2018},
42 | NUMBER = {272},
43 | DOI = {10.12688/f1000research.14013.1}
44 | }
45 |
46 | @article{mcmurdie2013phyloseq,
47 | title={phyloseq: an R package for reproducible interactive analysis and graphics of microbiome census data},
48 | author={McMurdie, Paul J and Holmes, Susan},
49 | journal={PloS One},
50 | volume={8},
51 | number={4},
52 | pages={e61217},
53 | year={2013},
54 | url={https://doi.org/10.1371/journal.pone.0061217},
55 | publisher={Public Library of Science}
56 | }
57 |
58 | @article{comeau2017microbiome,
59 | title={Microbiome Helper: a Custom and Streamlined Workflow for Microbiome Research},
60 | author={Comeau, Andr{\'e} M and Douglas, Gavin M and Langille, Morgan GI},
61 | journal={mSystems},
62 | volume={2},
63 | number={1},
64 | pages={e00127--16},
65 | year={2017},
66 | url={http://msystems.asm.org/content/2/1/e00127-16},
67 | publisher={Am Soc Microbiol}
68 | }
69 |
70 | @article{lozupone2005unifrac,
71 | title={UniFrac: a new phylogenetic method for comparing microbial communities},
72 | author={Lozupone, Catherine and Knight, Rob},
73 | journal={Applied and Environmental Microbiology},
74 | volume={71},
75 | number={12},
76 | pages={8228--8235},
77 | year={2005},
78 | url={http://aem.asm.org/content/71/12/8228.full},
79 | publisher={Am Soc Microbiol}
80 | }
81 |
82 | @article{foster2017metacoder,
83 | title={Metacoder: An R package for visualization and manipulation of community taxonomic diversity data},
84 | author={Foster, Zachary SL and Sharpton, Thomas J and Gr{\"u}nwald, Niklaus J},
85 | journal={PLoS Computational Biology},
86 | volume={13},
87 | number={2},
88 | pages={e1005404},
89 | year={2017},
90 | url={https://doi.org/10.1371/journal.pcbi.1005404},
91 | publisher={Public Library of Science}
92 | }
93 |
94 | @article{edgar2013uparse,
95 | title={UPARSE: highly accurate OTU sequences from microbial amplicon reads},
96 | author={Edgar, Robert C},
97 | journal={Nature Methods},
98 | volume={10},
99 | number={10},
100 | pages={996--998},
101 | year={2013},
102 | url={http://dx.doi.org/10.1038/nmeth.2604},
103 | publisher={Nature Research}
104 | }
105 |
106 | @article{dixon2003vegan,
107 | title={VEGAN, a package of R functions for community ecology},
108 | author={Dixon, Philip},
109 | journal={Journal of Vegetation Science},
110 | volume={14},
111 | number={6},
112 | pages={927--930},
113 | year={2003},
114 | publisher={BioOne}
115 | }
116 |
117 | @article{oksanen2007vegan,
118 | title = {vegan: Community Ecology Package},
119 | author = {Jari Oksanen and F. Guillaume Blanchet and Michael Friendly and Roeland Kindt and Pierre Legendre and Dan McGlinn and Peter R. Minchin and R. B. O'Hara and Gavin L. Simpson and Peter Solymos and M. Henry H. Stevens and Eduard Szoecs and Helene Wagner},
120 | year = {2018},
121 | note = {R package version 2.5-1},
122 | url = {https://CRAN.R-project.org/package=vegan}
123 | }
124 |
125 | @article{schloss2009introducing,
126 | title={Introducing mothur: open-source, platform-independent, community-supported software for describing and comparing microbial communities},
127 | author={Schloss, Patrick D and Westcott, Sarah L and Ryabin, Thomas and Hall, Justine R and Hartmann, Martin and Hollister, Emily B and Lesniewski, Ryan A and Oakley, Brian B and Parks, Donovan H and Robinson, Courtney J and others},
128 | journal={Applied and Environmental Microbiology},
129 | volume={75},
130 | number={23},
131 | pages={7537--7541},
132 | year={2009},
133 | url={http://aem.asm.org/cgi/pmidlookup?view=long&pmid=19801464},
134 | publisher={Am Soc Microbiol}
135 | }
136 |
137 | @article{caporaso2010qiime,
138 | title={QIIME allows analysis of high-throughput community sequencing data},
139 | author={Caporaso, J Gregory and Kuczynski, Justin and Stombaugh, Jesse and Bittinger, Kyle and Bushman, Frederic D and Costello, Elizabeth K and Fierer, Noah and Pe{\~n}a, Antonio Gonzalez and Goodrich, Julia K and Gordon, Jeffrey I and others},
140 | journal={Nature Methods},
141 | volume={7},
142 | number={5},
143 | pages={335--336},
144 | year={2010},
145 | url={https://www.nature.com/articles/nmeth.f.303},
146 | publisher={Nature Publishing Group}
147 | }
148 |
149 | @article{whittaker1960vegetation,
150 | title={Vegetation of the Siskiyou mountains, Oregon and California},
151 | author={Whittaker, Robert Harding},
152 | journal={Ecological monographs},
153 | volume={30},
154 | number={3},
155 | pages={279--338},
156 | year={1960},
157 | publisher={Wiley Online Library}
158 | }
159 |
160 | @article{wagner2016host,
161 | title={Host genotype and age shape the leaf and root microbiomes of a wild perennial plant},
162 | author={Wagner, Maggie R and Lundberg, Derek S and Tijana, G and Tringe, Susannah G and Dangl, Jeffery L and Mitchell-Olds, Thomas},
163 | journal={Nature communications},
164 | volume={7},
165 | pages={12151},
166 | year={2016},
167 | publisher={Nature Publishing Group},
168 | doi={10.1038/ncomms12151}
169 | }
170 |
171 | @article{zeeberg2004mistaken,
172 | title={Mistaken identifiers: gene name errors can be introduced inadvertently when using Excel in bioinformatics},
173 | author={Zeeberg, Barry R and Riss, Joseph and Kane, David W and Bussey, Kimberly J and Uchio, Edward and Linehan, W Marston and Barrett, J Carl and Weinstein, John N},
174 | journal={BMC bioinformatics},
175 | volume={5},
176 | number={1},
177 | pages={80},
178 | year={2004},
179 | publisher={BioMed Central},
180 | URL={https://doi.org/10.1186/1471-2105-5-80}
181 | }
182 |
183 | @article{wickham2015dplyr,
184 | title={dplyr: A grammar of data manipulation},
185 | author={Wickham, Hadley and Francois, Romain},
186 | journal={R package version 0.4},
187 | volume={3},
188 | year={2015}
189 | }
190 |
191 | @Book{wickham2009ggplot2,
192 | author = {Hadley Wickham},
193 | title = {ggplot2: Elegant Graphics for Data Analysis},
194 | publisher = {Springer-Verlag New York},
195 | year = {2009},
196 | isbn = {978-0-387-98140-6},
197 | url = {http://ggplot2.org},
198 | }
199 |
200 | @article{callahan2017exact,
201 | title={Exact sequence variants should replace operational taxonomic units in marker-gene data analysis},
202 | author={Callahan, Benjamin J and McMurdie, Paul J and Holmes, Susan P},
203 | journal={The ISME journal},
204 | volume={11},
205 | number={12},
206 | pages={2639},
207 | year={2017},
208 | publisher={Nature Publishing Group}
209 | }
210 |
--------------------------------------------------------------------------------
/clean_data.Rdata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/clean_data.Rdata
--------------------------------------------------------------------------------
/data/example_data_1.tsv:
--------------------------------------------------------------------------------
1 | common_name ncbi_seq_id itis_taxon_id my_taxonomy
2 | Lions FJ712037 183803 mammalia, felidae, panthera, leo
3 | Tigers KC879292 183806 mammalia, felidae, panthera, tigris
4 | Bears HW243304 180544 mammalia, ursidae, ursus, americanus
5 |
--------------------------------------------------------------------------------
/data/example_data_2.fa:
--------------------------------------------------------------------------------
1 | > FJ712037::class_mammalia;family_felidae;genus_panthera;species_leo
2 | ATGAATTACACAAGTTTTATTTTCGCTTTTCAGCTTTGCATAATTTTGTGTTCTTCTGGTTGTTACTGTC
3 | AGGCCATGTTTTTTAAAGAAATAGAAGAGCTAAAGGGATATTTTAATGCAAGTAATCCAGATGTAGCAGA
4 | TGGTGGGTCGCTTTTCGTAGACATTTCAAAGAACTGGAAAGAGGAGAGTGATAAAACAATAATTCAAAGC
5 | CAAATTGTCTCCTTCTACTTGAAAATGTTTGAAAACCTGAAAGATGATGACCAGCGCATTCAAAGGAACA
6 | TGGACACCATCAAGGAAGACATGCTTGATAAGTTGTTAAATACCAGCTCCAGTAAACGGGATGACTTCCT
7 | CAAGCTGATTCAAATCCCTGTGAATGATCTGCAGGTCCAGCGCAAAGCAATAAATGAACTCTTCAAAGTG
8 | ATGAACGATCTCTCACCAAGATCTAACCTGAGGAAGCGGAAAAGGAGTCAGAATCTGTTTCGAGGCCGTA
9 | GAGCATCGAAATAA
10 | > KC879292::class_mammalia;family_felidae;genus_panthera;species_tigris
11 | ATGATAACATACATTGTATTTATTTTAAGTACAATTTTCGTGGTGAGCTTTGTGAGTTTTTCTTCAAAGC
12 | CTTCTCCTATTTATGGTGGGCTTGGATTGATTGTGGCTGGTGGTGTTGGTTGCGGTATTGTATTGAATTT
13 | TGGGGGGTCATTTTTAGGTTTAATAGTTTTTTTAATTTATTTGGGGGGCATGCTTGTGGTGTTTGGGTAC
14 | ACTACAGCTATGGCTACTGAGCCCTACCCCGAGGCGTGGACATCTAATAAAGCCGTATTAGGTGCGTTTA
15 | TTACGGGGGTATTAGCGGAGTTGTTGACTGCTTGCTATATTTTAAAGGAAGATGAGGTTGAGGTTGTGTT
16 | TAAGTTTAATGGTGCGGGTGATTGAGTGATCTATGATACGGGTGACTCGGGGTTTTTTAGTGAGGAGGCC
17 | ATAGGAATTGCAGCACTGTATAGTTATGGAACCTGGCTAGTGGTTGTCACTGGTTGGTCTTTGCTTATTG
18 | GTGTATTGGTGATTATAGA
19 | > HW243304::class_mammalia;family_ursidae;genus_ursus;species_americanus
20 | ATGATGTCTGCGAAAGACATGGTTAAAGTAATGATTGTCATGTTTGCAATTTGTTTTCTTGCAAAATCGG
21 | ATGGGAAACCTGTTAAGAAGAGATCTGTGAGCGAGATACAGTTTATGCATAACCTGGGCAAACATCTGAG
22 | CTCCATGGAGAGGGTGGAATGGCTGCGGAAGAAGCTGCAGGACGTGCACAACTTTGTTGCCCTTGGAGCT
23 | CCAACAGCGCACAGAGATGGTGGTTCCCAGAGGCCCCAGAAAAAGGAAGACAATGTGCTGGTTGAGAACC
24 | ATCAAAAAAGTCTCGGAGAAGCAGACAAAGCTGATGTGGATGTATTAACTAAAGCTAAATCCCAGTGAGA
25 | ATTC
--------------------------------------------------------------------------------
/data/otuTable97.txt.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/data/otuTable97.txt.bz2
--------------------------------------------------------------------------------
/diversity_data.Rdata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/diversity_data.Rdata
--------------------------------------------------------------------------------
/docs/00--intro_to_rstudio.html:
--------------------------------------------------------------------------------
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 |
33 |
34 |
35 |
36 |
37 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
91 |
92 |
93 |
126 |
127 |
144 |
145 |
146 |
RStudio is not R or a “type” of R. It is a program that runs R and provides extra tools that are helpful when writing R code, kind of like how your operating system can run a web browser. This workshop will assume you are using RStudio to interact with R, although everything here can be done without RStudio. Most R users seem to use RStudio and we like it, so we recommend using it.
258 |
259 |
Installing RStudio
260 |
The main version of RStudio that most people use is free and open source and can be downloaded here:
When you open RStudio, you will notice a lot of different windows, each with some tabs. This can be overwhelming at first, but you only need to use a few to be productive and the ones you need are similar to other computer programs you probably already use.
266 |
267 |
The R console tab
268 |
269 |
270 |
271 |
272 |
The R console is where you give R commands and is the lower left window in RStudio. It is the same way you would interact with R on the command line or terminal. In other words, the “Console” tab in the lower left window is the only part of RStudio that is actually R itself; everything else is optional tools.
273 |
274 |
275 |
The text editor
276 |
277 |
278 |
279 |
280 |
The upper left window is a plain text editor, like Notepad or TextEdit. “Plain text” means no fonts, formatting etc, unlike program like Microsoft Word. You can have multiple files open at once and they appear in tabs. Depending on the type of the file being edited (i.e. its file extension), there will be different tools and behavior, but its all plain text.
281 |
282 |
283 |
The file browser tab
284 |
285 |
286 |
287 |
288 |
The default tab in the lower right window is a basic file browser. You can open, delete, and rename files there. Its not as well-developed as your operating system’s file browser and is mostly there so you don’t have to switch applications to manage files. You can ignore the rest of the tabs there for now (Plots, Packages, Help, and Viewer), since they are usually automatically opened when they are relevant.
289 |
290 |
291 |
The “Environment” tab
292 |
293 |
294 |
295 |
296 |
The “Environment” tab in the top right window lists the variables and functions present in the current R session. It does not include the function/data in loaded packages however (unless you select a package from the drop down menu that says “Global Environment”). When you ask “what have I created so far”, the answer is in the environment tab.
297 |
298 |
299 |
300 |
Console tricks
301 |
302 |
Code completion
303 |
RStudio has a very useful feature called code completion using the Tab key which can complete the full name of an object. For example type hel and hit Tab and you will see several functions pop up and you can select help().
304 |
This also works inside a function to find function arguments. Type help( and hit Tab to select arguments for the help function.
305 |
306 |
307 |
Command history
308 |
RStudio records your command history and you can scroll up or down the history of executed commands using the Up or Down keys. Make sure your cursor is in the console and try to re-execute previous commands.
309 |
310 |
311 |
Quickly running code in a file
312 |
Its best to write even experimental code in a file in the text editor, rather than writing it directly to the console, but it can get tedious to always be copying and pasting to try it out. Instead, you can move the cursor to the line you want to run in the text editor and Ctrl + Enter to copy, paste, and execute the line in the console all at once. This is a good habit to develop.
313 |
314 |
315 |
316 |
R projects
317 |
R projects are an RStudio concept and are integral to many people’s workflow and organization. An R project is just a folder that has a file in it ending in “.Rproj”. This file is created by RStudio when you create a new project. Although R projects are not needed, we highly recommend using them for the following reasons:
318 |
319 |
They help with organization, since they encourage you to put all the code and data for a project in a single directory.
320 |
They help standardize your current working directory. Each time a project is opened, your current working directory is automatically switched to the project directory.
321 |
They store where you left off when you last closed RStudio. Depending on how you set things up, its as if you never closed RStudio at all. All the variables and files will be where you last left them. Even unsaved files. NOTE: It is recommended that you do not rely on restoring variables between sessions, although RStudio will offer.
322 |
323 |
Whenever you start something in R that you want to save, we recommend using an R project. You can make a new project by clicking on the upper right drop-down menu or “File > New Project”.
324 |
325 |
326 |
327 |
328 |
329 |
Everything else
330 |
Don’t worry about it! Its all useful, but not needed when you start, and some of it you will likely never use.
In this workshop, we will be using data from Wagner et al. (2016), a study on the effects of plant age, genotype, and environment on the bacterial microbiome of Boechera stricta, a perennial herb in the mustard family. Wagner et al. (2016) released their raw data with the article and it is available here on dryad. This is a great example of how to share your raw data!
258 |
A copy of this data is included in this site and can be downloaded from links below.
259 |
260 |
Sample metadata
261 |
A table with a sample in each row and info about the samples in each column, such as plant genotype and field site. It is a 170Kb tab-delimited text file.
Wagner, Maggie R, Derek S Lundberg, G Tijana, Susannah G Tringe, Jeffery L Dangl, and Thomas Mitchell-Olds. 2016. “Host Genotype and Age Shape the Leaf and Root Microbiomes of a Wild Perennial Plant.” Nature Communications 7. Nature Publishing Group: 12151. doi:10.1038/ncomms12151.
278 | Niklaus J. Grünwald is a plant pathologist with the USDA Agricultural Research Service and a Professor in the Department of Botany and Pant Pathology and the Center for Genome Research and Biocomputing at Oregon State University. He received his PhD from UC Davis and conducted postdoctoral research at Cornell University. His research focuses on understanding the evolutionary patterns and processes of emerging pathogens using population genetic and evolutionary approaches and development of computational tools for characterizing pathogens and communities. Members of his group have developed several widely used R packages including: poppr, vcfr, taxa, and metacoder.
279 |
296 | Zach S. L. Foster is a graduate student in the Department of Botany and Plant Pathology at Oregon State University. He is the lead developer of the metacoder and taxa R packages. He is also a recipient of the ROpenSci fellowship.
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
313 |
314 |
315 |
316 |
317 |
318 |
330 |
331 |
332 |
340 |
341 |
342 |
343 |
--------------------------------------------------------------------------------
/docs/bibtexlib.bib:
--------------------------------------------------------------------------------
1 | @article{callahan2016dada2,
2 | title={DADA2: high-resolution sample inference from Illumina amplicon data},
3 | author={Callahan, Benjamin J and McMurdie, Paul J and Rosen, Michael J and Han, Andrew W and Johnson, Amy Jo A and Holmes, Susan P},
4 | journal={Nature methods},
5 | volume={13},
6 | number={7},
7 | pages={581},
8 | year={2016},
9 | publisher={Nature Publishing Group}
10 | }
11 |
12 | @article{simpson1949measurement,
13 | title={Measurement of diversity},
14 | author={Simpson, Edward H},
15 | journal={nature},
16 | volume={163},
17 | number={4148},
18 | pages={688},
19 | year={1949},
20 | publisher={Nature Publishing Group},
21 | doi={10.1038/163688a0}
22 | }
23 |
24 | @article{hill1973diversity,
25 | title={Diversity and evenness: a unifying notation and its consequences},
26 | author={Hill, Mark O},
27 | journal={Ecology},
28 | volume={54},
29 | number={2},
30 | pages={427--432},
31 | year={1973},
32 | publisher={Wiley Online Library},
33 | URL={https://doi.org/10.2307/1934352}
34 | }
35 |
36 | @article{foster2018taxa,
37 | title={Taxa: An R package implementing data standards and methods for taxonomic data},
38 | author={Foster, Zachary SL and Chamberlain, Scott and Gr{\"u}nwald, Niklaus J},
39 | JOURNAL = {F1000Research},
40 | VOLUME = {7},
41 | YEAR = {2018},
42 | NUMBER = {272},
43 | DOI = {10.12688/f1000research.14013.1}
44 | }
45 |
46 | @article{mcmurdie2013phyloseq,
47 | title={phyloseq: an R package for reproducible interactive analysis and graphics of microbiome census data},
48 | author={McMurdie, Paul J and Holmes, Susan},
49 | journal={PloS One},
50 | volume={8},
51 | number={4},
52 | pages={e61217},
53 | year={2013},
54 | url={https://doi.org/10.1371/journal.pone.0061217},
55 | publisher={Public Library of Science}
56 | }
57 |
58 | @article{comeau2017microbiome,
59 | title={Microbiome Helper: a Custom and Streamlined Workflow for Microbiome Research},
60 | author={Comeau, Andr{\'e} M and Douglas, Gavin M and Langille, Morgan GI},
61 | journal={mSystems},
62 | volume={2},
63 | number={1},
64 | pages={e00127--16},
65 | year={2017},
66 | url={http://msystems.asm.org/content/2/1/e00127-16},
67 | publisher={Am Soc Microbiol}
68 | }
69 |
70 | @article{lozupone2005unifrac,
71 | title={UniFrac: a new phylogenetic method for comparing microbial communities},
72 | author={Lozupone, Catherine and Knight, Rob},
73 | journal={Applied and Environmental Microbiology},
74 | volume={71},
75 | number={12},
76 | pages={8228--8235},
77 | year={2005},
78 | url={http://aem.asm.org/content/71/12/8228.full},
79 | publisher={Am Soc Microbiol}
80 | }
81 |
82 | @article{foster2017metacoder,
83 | title={Metacoder: An R package for visualization and manipulation of community taxonomic diversity data},
84 | author={Foster, Zachary SL and Sharpton, Thomas J and Gr{\"u}nwald, Niklaus J},
85 | journal={PLoS Computational Biology},
86 | volume={13},
87 | number={2},
88 | pages={e1005404},
89 | year={2017},
90 | url={https://doi.org/10.1371/journal.pcbi.1005404},
91 | publisher={Public Library of Science}
92 | }
93 |
94 | @article{edgar2013uparse,
95 | title={UPARSE: highly accurate OTU sequences from microbial amplicon reads},
96 | author={Edgar, Robert C},
97 | journal={Nature Methods},
98 | volume={10},
99 | number={10},
100 | pages={996--998},
101 | year={2013},
102 | url={http://dx.doi.org/10.1038/nmeth.2604},
103 | publisher={Nature Research}
104 | }
105 |
106 | @article{dixon2003vegan,
107 | title={VEGAN, a package of R functions for community ecology},
108 | author={Dixon, Philip},
109 | journal={Journal of Vegetation Science},
110 | volume={14},
111 | number={6},
112 | pages={927--930},
113 | year={2003},
114 | publisher={BioOne}
115 | }
116 |
117 | @article{oksanen2007vegan,
118 | title = {vegan: Community Ecology Package},
119 | author = {Jari Oksanen and F. Guillaume Blanchet and Michael Friendly and Roeland Kindt and Pierre Legendre and Dan McGlinn and Peter R. Minchin and R. B. O'Hara and Gavin L. Simpson and Peter Solymos and M. Henry H. Stevens and Eduard Szoecs and Helene Wagner},
120 | year = {2018},
121 | note = {R package version 2.5-1},
122 | url = {https://CRAN.R-project.org/package=vegan}
123 | }
124 |
125 | @article{schloss2009introducing,
126 | title={Introducing mothur: open-source, platform-independent, community-supported software for describing and comparing microbial communities},
127 | author={Schloss, Patrick D and Westcott, Sarah L and Ryabin, Thomas and Hall, Justine R and Hartmann, Martin and Hollister, Emily B and Lesniewski, Ryan A and Oakley, Brian B and Parks, Donovan H and Robinson, Courtney J and others},
128 | journal={Applied and Environmental Microbiology},
129 | volume={75},
130 | number={23},
131 | pages={7537--7541},
132 | year={2009},
133 | url={http://aem.asm.org/cgi/pmidlookup?view=long&pmid=19801464},
134 | publisher={Am Soc Microbiol}
135 | }
136 |
137 | @article{caporaso2010qiime,
138 | title={QIIME allows analysis of high-throughput community sequencing data},
139 | author={Caporaso, J Gregory and Kuczynski, Justin and Stombaugh, Jesse and Bittinger, Kyle and Bushman, Frederic D and Costello, Elizabeth K and Fierer, Noah and Pe{\~n}a, Antonio Gonzalez and Goodrich, Julia K and Gordon, Jeffrey I and others},
140 | journal={Nature Methods},
141 | volume={7},
142 | number={5},
143 | pages={335--336},
144 | year={2010},
145 | url={https://www.nature.com/articles/nmeth.f.303},
146 | publisher={Nature Publishing Group}
147 | }
148 |
149 | @article{whittaker1960vegetation,
150 | title={Vegetation of the Siskiyou mountains, Oregon and California},
151 | author={Whittaker, Robert Harding},
152 | journal={Ecological monographs},
153 | volume={30},
154 | number={3},
155 | pages={279--338},
156 | year={1960},
157 | publisher={Wiley Online Library}
158 | }
159 |
160 | @article{wagner2016host,
161 | title={Host genotype and age shape the leaf and root microbiomes of a wild perennial plant},
162 | author={Wagner, Maggie R and Lundberg, Derek S and Tijana, G and Tringe, Susannah G and Dangl, Jeffery L and Mitchell-Olds, Thomas},
163 | journal={Nature communications},
164 | volume={7},
165 | pages={12151},
166 | year={2016},
167 | publisher={Nature Publishing Group},
168 | doi={10.1038/ncomms12151}
169 | }
170 |
171 | @article{zeeberg2004mistaken,
172 | title={Mistaken identifiers: gene name errors can be introduced inadvertently when using Excel in bioinformatics},
173 | author={Zeeberg, Barry R and Riss, Joseph and Kane, David W and Bussey, Kimberly J and Uchio, Edward and Linehan, W Marston and Barrett, J Carl and Weinstein, John N},
174 | journal={BMC bioinformatics},
175 | volume={5},
176 | number={1},
177 | pages={80},
178 | year={2004},
179 | publisher={BioMed Central},
180 | URL={https://doi.org/10.1186/1471-2105-5-80}
181 | }
182 |
183 | @article{wickham2015dplyr,
184 | title={dplyr: A grammar of data manipulation},
185 | author={Wickham, Hadley and Francois, Romain},
186 | journal={R package version 0.4},
187 | volume={3},
188 | year={2015}
189 | }
190 |
191 | @Book{wickham2009ggplot2,
192 | author = {Hadley Wickham},
193 | title = {ggplot2: Elegant Graphics for Data Analysis},
194 | publisher = {Springer-Verlag New York},
195 | year = {2009},
196 | isbn = {978-0-387-98140-6},
197 | url = {http://ggplot2.org},
198 | }
199 |
200 | @article{callahan2017exact,
201 | title={Exact sequence variants should replace operational taxonomic units in marker-gene data analysis},
202 | author={Callahan, Benjamin J and McMurdie, Paul J and Holmes, Susan P},
203 | journal={The ISME journal},
204 | volume={11},
205 | number={12},
206 | pages={2639},
207 | year={2017},
208 | publisher={Nature Publishing Group}
209 | }
210 |
--------------------------------------------------------------------------------
/docs/clean_data.Rdata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/clean_data.Rdata
--------------------------------------------------------------------------------
/docs/data/example_data_1.tsv:
--------------------------------------------------------------------------------
1 | common_name ncbi_seq_id itis_taxon_id my_taxonomy
2 | Lions FJ712037 183803 mammalia, felidae, panthera, leo
3 | Tigers KC879292 183806 mammalia, felidae, panthera, tigris
4 | Bears HW243304 180544 mammalia, ursidae, ursus, americanus
5 |
--------------------------------------------------------------------------------
/docs/data/example_data_2.fa:
--------------------------------------------------------------------------------
1 | > FJ712037::class_mammalia;family_felidae;genus_panthera;species_leo
2 | ATGAATTACACAAGTTTTATTTTCGCTTTTCAGCTTTGCATAATTTTGTGTTCTTCTGGTTGTTACTGTC
3 | AGGCCATGTTTTTTAAAGAAATAGAAGAGCTAAAGGGATATTTTAATGCAAGTAATCCAGATGTAGCAGA
4 | TGGTGGGTCGCTTTTCGTAGACATTTCAAAGAACTGGAAAGAGGAGAGTGATAAAACAATAATTCAAAGC
5 | CAAATTGTCTCCTTCTACTTGAAAATGTTTGAAAACCTGAAAGATGATGACCAGCGCATTCAAAGGAACA
6 | TGGACACCATCAAGGAAGACATGCTTGATAAGTTGTTAAATACCAGCTCCAGTAAACGGGATGACTTCCT
7 | CAAGCTGATTCAAATCCCTGTGAATGATCTGCAGGTCCAGCGCAAAGCAATAAATGAACTCTTCAAAGTG
8 | ATGAACGATCTCTCACCAAGATCTAACCTGAGGAAGCGGAAAAGGAGTCAGAATCTGTTTCGAGGCCGTA
9 | GAGCATCGAAATAA
10 | > KC879292::class_mammalia;family_felidae;genus_panthera;species_tigris
11 | ATGATAACATACATTGTATTTATTTTAAGTACAATTTTCGTGGTGAGCTTTGTGAGTTTTTCTTCAAAGC
12 | CTTCTCCTATTTATGGTGGGCTTGGATTGATTGTGGCTGGTGGTGTTGGTTGCGGTATTGTATTGAATTT
13 | TGGGGGGTCATTTTTAGGTTTAATAGTTTTTTTAATTTATTTGGGGGGCATGCTTGTGGTGTTTGGGTAC
14 | ACTACAGCTATGGCTACTGAGCCCTACCCCGAGGCGTGGACATCTAATAAAGCCGTATTAGGTGCGTTTA
15 | TTACGGGGGTATTAGCGGAGTTGTTGACTGCTTGCTATATTTTAAAGGAAGATGAGGTTGAGGTTGTGTT
16 | TAAGTTTAATGGTGCGGGTGATTGAGTGATCTATGATACGGGTGACTCGGGGTTTTTTAGTGAGGAGGCC
17 | ATAGGAATTGCAGCACTGTATAGTTATGGAACCTGGCTAGTGGTTGTCACTGGTTGGTCTTTGCTTATTG
18 | GTGTATTGGTGATTATAGA
19 | > HW243304::class_mammalia;family_ursidae;genus_ursus;species_americanus
20 | ATGATGTCTGCGAAAGACATGGTTAAAGTAATGATTGTCATGTTTGCAATTTGTTTTCTTGCAAAATCGG
21 | ATGGGAAACCTGTTAAGAAGAGATCTGTGAGCGAGATACAGTTTATGCATAACCTGGGCAAACATCTGAG
22 | CTCCATGGAGAGGGTGGAATGGCTGCGGAAGAAGCTGCAGGACGTGCACAACTTTGTTGCCCTTGGAGCT
23 | CCAACAGCGCACAGAGATGGTGGTTCCCAGAGGCCCCAGAAAAAGGAAGACAATGTGCTGGTTGAGAACC
24 | ATCAAAAAAGTCTCGGAGAAGCAGACAAAGCTGATGTGGATGTATTAACTAAAGCTAAATCCCAGTGAGA
25 | ATTC
--------------------------------------------------------------------------------
/docs/data/otuTable97.txt.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/data/otuTable97.txt.bz2
--------------------------------------------------------------------------------
/docs/diversity_data.Rdata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/diversity_data.Rdata
--------------------------------------------------------------------------------
/docs/figure_sources/preferred_data_format.ods:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/figure_sources/preferred_data_format.ods
--------------------------------------------------------------------------------
/docs/figure_sources/preferred_data_format_counts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/figure_sources/preferred_data_format_counts.png
--------------------------------------------------------------------------------
/docs/figure_sources/preferred_data_format_samples.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/figure_sources/preferred_data_format_samples.png
--------------------------------------------------------------------------------
/docs/figure_sources/typical_input_format.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/figure_sources/typical_input_format.png
--------------------------------------------------------------------------------
/docs/filtered_data.Rdata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/filtered_data.Rdata
--------------------------------------------------------------------------------
/docs/footer.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/header.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/docs/images/IMG_3734.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/images/IMG_3734.jpg
--------------------------------------------------------------------------------
/docs/images/boechera_stricta.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/images/boechera_stricta.jpg
--------------------------------------------------------------------------------
/docs/images/foster.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/images/foster.jpeg
--------------------------------------------------------------------------------
/docs/images/rstudio_console.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/images/rstudio_console.png
--------------------------------------------------------------------------------
/docs/images/rstudio_envrionment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/images/rstudio_envrionment.png
--------------------------------------------------------------------------------
/docs/images/rstudio_file_browser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/images/rstudio_file_browser.png
--------------------------------------------------------------------------------
/docs/images/rstudio_project.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/images/rstudio_project.png
--------------------------------------------------------------------------------
/docs/images/rstudio_text_editor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/images/rstudio_text_editor.png
--------------------------------------------------------------------------------
/docs/images/wagner_barchart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/images/wagner_barchart.png
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
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 |
33 |
34 |
35 |
36 |
37 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
91 |
92 |
93 |
126 |
127 |
144 |
145 |
146 |
Welcome! This primer provides a concise introduction to conducting applied analyses of microbiome data in R. While this primer does not require extensive knowledge of programming in R, the user is expected to install R and all packages required for this primer.
258 |
Please install the required software and download the example data before coming to the workshop.
259 |
260 |
What is covered
261 |
This primer provides a concise introduction to conducting the statistical analyses and visualize microbiome data in R based on metabarcoding and high throughput sequencing (HTS). This primer does not cover “shotgun” metagenomic analysis, which is very different in nature. The reader is expected to have a very basic understanding of ecological diversity theory and some experience with R. The techniques presented here assume the raw sequences have been converted to exact sequence variants (ESVs) or operational Taxonomic Units (OTUs) and classified (i.e., assigned a taxonomy) using tools such as QIIME, mothur, or dada2 (Schloss et al. 2009; Caporaso et al. 2010; Callahan et al. 2016).
262 |
263 |
264 |
Why use R?
265 |
R is an open source (free) statistical programming and graphing language that includes tools for analysis of statistical, ecological diversity and community data, among many other things. R provides a cohesive environment to analyze data using modular “toolboxes” called R packages. R runs on all major operating systems including Microsoft Windows, Linux (e.g., Ubuntu), and Apple’s OS X. The general type of analyses done in this workshop could be done in python, Perl, or using command line tools. We like R for the following reasons:
266 |
267 |
We use it (i.e., we are biased).
268 |
R packages are easy to install and not too hard to make.
269 |
The R community is very active and growing. Packages are updated frequently.
R Markdown is well supported, allowing R code to be embedded in documents and output to diverse formats. This website is the output of a set of R Markdown documents. Thus, R markdown can be used as an electronic notebook facilitating for reproducible research link.
273 |
R has strong graphing and statistical capabilities.
274 |
You can produce publication ready graphics
275 |
R is designed to be an interactive language, providing a natural fit for statistical analyses rather than writing programs.
276 |
277 |
278 |
279 |
The kind of data used in this workshop
280 |
This workshop will not start with the raw reads, since the first steps in a metabarcoding workflow are typically done using command line tools such as QIIME or mothur (dada2 is an exception) in the cloud. Data that can be analysed using techniques presented here is typically the result of the following steps (Comeau, Douglas, and Langille 2017):
281 |
282 |
Sample environments/soil/tissue/water and extract DNA.
283 |
Perform PCR using standard primers.
284 |
Sequence using a high-throughput sequencing platform such as the Illumina MiSeq.
285 |
Call OTUs/ESVs and assign a taxonomic classification by comparing them to a reference database, such as Greengenes.
286 |
Construct an abundance matrix of read counts for each OTU in each sample.
287 |
288 |
Here we focus on the statistical analysis and visualizations following OTU calling that include:
289 |
290 |
Reading files into R
291 |
Manipulating tabular and taxonomic data
292 |
Heat trees (Foster, Sharpton, and Grünwald 2017), stacked bar charts and related visualizations
293 |
Alpha and beta diversity
294 |
Ordination methods
295 |
296 |
297 |
298 |
Help us improve this resource
299 |
We hope you enjoy this primer. Please provide us feedback on any errors you might find or suggestions for improvement.
300 |
301 |
302 |
Citing this primer
303 |
Please cite this primer if you find it useful for your research as: ZSL Foster and NJ Grünwald. 2018. Analysis of Microbiome Community Data in R. DOI: XXX.
Callahan, Benjamin J, Paul J McMurdie, Michael J Rosen, Andrew W Han, Amy Jo A Johnson, and Susan P Holmes. 2016. “DADA2: High-Resolution Sample Inference from Illumina Amplicon Data.” Nature Methods 13 (7). Nature Publishing Group: 581.
312 |
313 |
314 |
Caporaso, J Gregory, Justin Kuczynski, Jesse Stombaugh, Kyle Bittinger, Frederic D Bushman, Elizabeth K Costello, Noah Fierer, et al. 2010. “QIIME Allows Analysis of High-Throughput Community Sequencing Data.” Nature Methods 7 (5). Nature Publishing Group: 335–36. https://www.nature.com/articles/nmeth.f.303.
315 |
316 |
317 |
Comeau, André M, Gavin M Douglas, and Morgan GI Langille. 2017. “Microbiome Helper: A Custom and Streamlined Workflow for Microbiome Research.” mSystems 2 (1). Am Soc Microbiol: e00127–16. http://msystems.asm.org/content/2/1/e00127-16.
318 |
319 |
320 |
Foster, Zachary SL, Thomas J Sharpton, and Niklaus J Grünwald. 2017. “Metacoder: An R Package for Visualization and Manipulation of Community Taxonomic Diversity Data.” PLoS Computational Biology 13 (2). Public Library of Science: e1005404. https://doi.org/10.1371/journal.pcbi.1005404.
321 |
322 |
323 |
Schloss, Patrick D, Sarah L Westcott, Thomas Ryabin, Justine R Hall, Martin Hartmann, Emily B Hollister, Ryan A Lesniewski, et al. 2009. “Introducing Mothur: Open-Source, Platform-Independent, Community-Supported Software for Describing and Comparing Microbial Communities.” Applied and Environmental Microbiology 75 (23). Am Soc Microbiol: 7537–41. http://aem.asm.org/cgi/pmidlookup?view=long&pmid=19801464.
324 |
325 |
326 |
327 |
328 |
329 |
334 |
335 |
336 |
337 |
338 |
339 |
351 |
352 |
353 |
361 |
362 |
363 |
364 |
--------------------------------------------------------------------------------
/docs/parsed_data.Rdata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/parsed_data.Rdata
--------------------------------------------------------------------------------
/docs/plotting_data.Rdata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/plotting_data.Rdata
--------------------------------------------------------------------------------
/docs/plotting_files/figure-html/unnamed-chunk-10-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/plotting_files/figure-html/unnamed-chunk-10-1.png
--------------------------------------------------------------------------------
/docs/plotting_files/figure-html/unnamed-chunk-11-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/plotting_files/figure-html/unnamed-chunk-11-1.png
--------------------------------------------------------------------------------
/docs/plotting_files/figure-html/unnamed-chunk-12-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/plotting_files/figure-html/unnamed-chunk-12-1.png
--------------------------------------------------------------------------------
/docs/plotting_files/figure-html/unnamed-chunk-3-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/plotting_files/figure-html/unnamed-chunk-3-1.png
--------------------------------------------------------------------------------
/docs/plotting_files/figure-html/unnamed-chunk-4-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/plotting_files/figure-html/unnamed-chunk-4-1.png
--------------------------------------------------------------------------------
/docs/plotting_files/figure-html/unnamed-chunk-5-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/plotting_files/figure-html/unnamed-chunk-5-1.png
--------------------------------------------------------------------------------
/docs/plotting_files/figure-html/unnamed-chunk-6-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/plotting_files/figure-html/unnamed-chunk-6-1.png
--------------------------------------------------------------------------------
/docs/plotting_files/figure-html/unnamed-chunk-7-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/plotting_files/figure-html/unnamed-chunk-7-1.png
--------------------------------------------------------------------------------
/docs/plotting_files/figure-html/unnamed-chunk-8-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/plotting_files/figure-html/unnamed-chunk-8-1.png
--------------------------------------------------------------------------------
/docs/plotting_files/figure-html/unnamed-chunk-9-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/plotting_files/figure-html/unnamed-chunk-9-1.png
--------------------------------------------------------------------------------
/docs/ps_obj.Rdata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/ps_obj.Rdata
--------------------------------------------------------------------------------
/docs/references/journal.pcbi.1003531.PDF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/references/journal.pcbi.1003531.PDF
--------------------------------------------------------------------------------
/docs/references/journal.pone.0061217.PDF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/references/journal.pone.0061217.PDF
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/Lato.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/Lato.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/LatoBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/LatoBold.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/LatoItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/LatoItalic.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/NewsCycle.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/NewsCycle.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/NewsCycleBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/NewsCycleBold.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSans.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSans.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansBold.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansBoldItalic.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansItalic.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansLight.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansLightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansLightItalic.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/Raleway.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/Raleway.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/RalewayBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/RalewayBold.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/Roboto.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/Roboto.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/RobotoBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/RobotoBold.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/RobotoLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/RobotoLight.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/RobotoMedium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/RobotoMedium.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansPro.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansPro.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansProBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansProBold.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansProItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansProItalic.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansProLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansProLight.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/css/fonts/Ubuntu.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/css/fonts/Ubuntu.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grunwaldlab/analysis_of_microbiome_community_data_in_r/5234a2938aba7405898e6f0277f141f3eb56fcac/docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/js/npm.js:
--------------------------------------------------------------------------------
1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
2 | require('../../js/transition.js')
3 | require('../../js/alert.js')
4 | require('../../js/button.js')
5 | require('../../js/carousel.js')
6 | require('../../js/collapse.js')
7 | require('../../js/dropdown.js')
8 | require('../../js/modal.js')
9 | require('../../js/tooltip.js')
10 | require('../../js/popover.js')
11 | require('../../js/scrollspy.js')
12 | require('../../js/tab.js')
13 | require('../../js/affix.js')
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/shim/html5shiv.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
3 | */
4 | // Only run this code in IE 8
5 | if (!!window.navigator.userAgent.match("MSIE 8")) {
6 | !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document);
7 | };
8 |
--------------------------------------------------------------------------------
/docs/site_libs/bootstrap-3.3.5/shim/respond.min.js:
--------------------------------------------------------------------------------
1 | /*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
2 | * Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
3 | * */
4 |
5 | // Only run this code in IE 8
6 | if (!!window.navigator.userAgent.match("MSIE 8")) {
7 | !function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b');
25 | if (show)
26 | div.addClass('in');
27 | var id = 'rcode-643E0F36' + currentIndex++;
28 | div.attr('id', id);
29 | $(this).before(div);
30 | $(this).detach().appendTo(div);
31 |
32 | // add a show code button right above
33 | var showCodeText = $('' + (show ? 'Hide' : 'Code') + '');
34 | var showCodeButton = $('');
35 | showCodeButton.append(showCodeText);
36 | showCodeButton
37 | .attr('data-toggle', 'collapse')
38 | .attr('data-target', '#' + id)
39 | .attr('aria-expanded', show)
40 | .attr('aria-controls', id);
41 |
42 | var buttonRow = $('');
43 | var buttonCol = $('');
44 |
45 | buttonCol.append(showCodeButton);
46 | buttonRow.append(buttonCol);
47 |
48 | div.before(buttonRow);
49 |
50 | // update state of button on show/hide
51 | div.on('hidden.bs.collapse', function () {
52 | showCodeText.text('Code');
53 | });
54 | div.on('show.bs.collapse', function () {
55 | showCodeText.text('Hide');
56 | });
57 | });
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/docs/site_libs/navigation-1.1/sourceembed.js:
--------------------------------------------------------------------------------
1 |
2 | window.initializeSourceEmbed = function(filename) {
3 | $("#rmd-download-source").click(function() {
4 | var src = $("#rmd-source-code").html();
5 | var a = document.createElement('a');
6 | a.href = "data:text/x-r-markdown;base64," + src;
7 | a.download = filename;
8 | document.body.appendChild(a);
9 | a.click();
10 | document.body.removeChild(a);
11 | });
12 | };
13 |
--------------------------------------------------------------------------------
/docs/site_libs/navigation-1.1/tabsets.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | /**
4 | * jQuery Plugin: Sticky Tabs
5 | *
6 | * @author Aidan Lister
7 | * adapted by Ruben Arslan to activate parent tabs too
8 | * http://www.aidanlister.com/2014/03/persisting-the-tab-state-in-bootstrap/
9 | */
10 | (function($) {
11 | "use strict";
12 | $.fn.rmarkdownStickyTabs = function() {
13 | var context = this;
14 | // Show the tab corresponding with the hash in the URL, or the first tab
15 | var showStuffFromHash = function() {
16 | var hash = window.location.hash;
17 | var selector = hash ? 'a[href="' + hash + '"]' : 'li.active > a';
18 | var $selector = $(selector, context);
19 | if($selector.data('toggle') === "tab") {
20 | $selector.tab('show');
21 | // walk up the ancestors of this element, show any hidden tabs
22 | $selector.parents('.section.tabset').each(function(i, elm) {
23 | var link = $('a[href="#' + $(elm).attr('id') + '"]');
24 | if(link.data('toggle') === "tab") {
25 | link.tab("show");
26 | }
27 | });
28 | }
29 | };
30 |
31 |
32 | // Set the correct tab when the page loads
33 | showStuffFromHash(context);
34 |
35 | // Set the correct tab when a user uses their back/forward button
36 | $(window).on('hashchange', function() {
37 | showStuffFromHash(context);
38 | });
39 |
40 | // Change the URL when tabs are clicked
41 | $('a', context).on('click', function(e) {
42 | history.pushState(null, null, this.href);
43 | showStuffFromHash(context);
44 | });
45 |
46 | return this;
47 | };
48 | }(jQuery));
49 |
50 | window.buildTabsets = function(tocID) {
51 |
52 | // build a tabset from a section div with the .tabset class
53 | function buildTabset(tabset) {
54 |
55 | // check for fade and pills options
56 | var fade = tabset.hasClass("tabset-fade");
57 | var pills = tabset.hasClass("tabset-pills");
58 | var navClass = pills ? "nav-pills" : "nav-tabs";
59 |
60 | // determine the heading level of the tabset and tabs
61 | var match = tabset.attr('class').match(/level(\d) /);
62 | if (match === null)
63 | return;
64 | var tabsetLevel = Number(match[1]);
65 | var tabLevel = tabsetLevel + 1;
66 |
67 | // find all subheadings immediately below
68 | var tabs = tabset.find("div.section.level" + tabLevel);
69 | if (!tabs.length)
70 | return;
71 |
72 | // create tablist and tab-content elements
73 | var tabList = $('