-
Notifications
You must be signed in to change notification settings - Fork 0
/
02-start.Rmd
84 lines (55 loc) · 3.01 KB
/
02-start.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Getting started
## Checklist (before the course)
Install the following software in advance in order to avoid
unnecessary delays and leaving more time for the course contents.
* [R (version >4.1.0)](https://www.r-project.org/)
* [RStudio](https://www.rstudio.com/products/rstudio/download/);
choose "Rstudio Desktop" to download the latest version. Optional
but preferred. For further details, check the [Rstudio home
page](https://www.rstudio.com/).
* Install and load the required R packages
* After a successful installation you can start with the
case study examples in this training material
## Support and resources
For additional reading and online material, see [Material](material.html) section
For online support on installation and other matters, you can join us at:
* Users: [miaverse Gitter channel](https://gitter.im/microbiome/miaverse?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
* Developers: [Bioconductor Slack](https://bioc-community.herokuapp.com) #microbiomeexperiment channel (ask for an invitation)
## Installing and loading the required R packages
This section shows how to install and load all required packages into
the R session. Only uninstalled packages are installed.
```{r warning = FALSE, message = FALSE}
# List of packages that we need from cran and bioc
cran_pkg <- c("BiocManager", "bookdown", "dplyr", "ecodist", "ggplot2",
"gridExtra", "kableExtra", "knitr", "scales", "vegan")
bioc_pkg <- c("ANCOMBC", "ape", "DESeq2", "DirichletMultinomial", "mia", "miaViz")
# Gets those packages that are already installed
cran_pkg_already_installed <- cran_pkg[ cran_pkg %in% installed.packages() ]
bioc_pkg_already_installed <- bioc_pkg[ bioc_pkg %in% installed.packages() ]
# Gets those packages that need to be installed
cran_pkg_to_be_installed <- setdiff(cran_pkg, cran_pkg_already_installed)
bioc_pkg_to_be_installed <- setdiff(bioc_pkg, bioc_pkg_already_installed)
```
```{r warning = FALSE, message = FALSE}
# If there are packages that need to be installed, installs them from CRAN
if( length(cran_pkg_to_be_installed) ) {
install.packages(cran_pkg_to_be_installed)
}
```
```{r warning = FALSE, message = FALSE}
# If there are packages that need to be installed, installs them from Bioconductor
if( length(bioc_pkg_to_be_installed) ) {
BiocManager::install(bioc_pkg_to_be_installed, ask = F)
}
```
Now all required packages are installed, so let's load them into the session.
Some function names occur in multiple packages. That is why miaverse's packages
mia and miaViz are prioritized. Packages that are loaded first have higher priority.
```{r warning = FALSE, message = FALSE}
# Reorders bioc packages, so that mia and miaViz are first
bioc_pkg <- c(bioc_pkg[ bioc_pkg %in% c("mia", "miaViz") ],
bioc_pkg[ !bioc_pkg %in% c("mia", "miaViz") ] )
# Loading all packages into session. Returns true if package was successfully loaded.
loaded <- sapply(c(bioc_pkg, cran_pkg), require, character.only = TRUE)
as.data.frame(loaded)
```