☰ Menu

        Sept. 2019 Microbial Community Analysis Workshop

Home
Introduction and Lectures
Intro to the Workshop and Core
What is Bioinformatics?
Experimental Design and Cost Estimation
Introduction to Command-Line and the Cluster
Logging in and Transferring Files
Intro to Command-Line
Advanced Command-Line (extra)
Running jobs on the Cluster and using modules
Intro to R and Rstudio
Getting Started
Intro to R
Prepare Data in R (extra)
Data in R (extra)
dbcAmplicons
dbcAmplicons Installing Software
dbcAmplicons - Amplicons talk
dbcAmplicons - Bioinformatics talk
Dataset and Metadata
dbcAmplicons - Data processing
dbcAmplicons w/Dada2
Coming soon
Microbial Community Analysis in R
Prepare MCA Analysis
MCA Analysis in phyloseq
Support
Cheat Sheets
Software and Links
Scripts
ETC
Closing thoughts
Workshop Photos
Github
Biocore website

Create a new RStudio project

Open RStudio and create a new project, for more info see https://support.rstudio.com/hc/en-us/articles/200526207-Using-Projects

Learn more about packrat see https://rstudio.github.io/packrat/

We first need to make sure we have the necessary packages, phyloseq, ggplot2, gridExtra, gridR, ape, and edgeR are installed (if not install it), and then load

In the R console run the following commands

if (!any(rownames(installed.packages()) == "phyloseq")){
  if (!requireNamespace("BiocManager", quietly = TRUE))
      install.packages("BiocManager")
  BiocManager::install("phyloseq")
}
library(phyloseq)

if (!any(rownames(installed.packages()) == "biomformat")){
  if (!requireNamespace("BiocManager", quietly = TRUE))
      install.packages("BiocManager")
  BiocManager::install("biomformat")
}
library(biomformat)

if (!any(rownames(installed.packages()) == "ggplot2")){
  if (!requireNamespace("BiocManager", quietly = TRUE))
      install.packages("BiocManager")
  BiocManager::install("ggplot2")
}
library(ggplot2)

if (!any(rownames(installed.packages()) == "gridExtra")){
  if (!requireNamespace("BiocManager", quietly = TRUE))
      install.packages("BiocManager")
  BiocManager::install("gridExtra")
}
library(gridExtra)

if (!any(rownames(installed.packages()) == "vegan")){
  if (!requireNamespace("BiocManager", quietly = TRUE))
      install.packages("BiocManager")
  BiocManager::install("vegan")
}
library(vegan)

if (!any(rownames(installed.packages()) == "edgeR")){
  if (!requireNamespace("BiocManager", quietly = TRUE))
      install.packages("BiocManager")
  BiocManager::install("edgeR")
}
library(edgeR)
if (!any(rownames(installed.packages()) == "dada2")){
  if (!requireNamespace("BiocManager", quietly = TRUE))
      install.packages("BiocManager")
  BiocManager::install("dada2", version = "3.9")
}
library(dada2)

Download the template Markdown workshop document and open it

In the R console run the following command

download.file("https://raw.githubusercontent.com/ucdavis-bioinformatics-training/2019_September_UCD_Microbial_Community_Analysis_Workshop/master/MCA_Workshop_R/phyloseq.Rmd", "MCA_phyloseq.Rmd")

Download the data file for the workshop document and preview/open it

download.file("https://raw.githubusercontent.com/ucdavis-bioinformatics-training/2019_September_UCD_Microbial_Community_Analysis_Workshop/master/MCA_Workshop_R/16sV3V5.biom", "16sV3V5.biom")

Edit the file YAML portion

The top YAML (YAML ain’t markup language) portion of the doc tells RStudio how to parse the document.

---
title: "Microbial Community Analysis in R"
author: your_name
date: current_date
output:
    html_notebook: default
    html_document: default
---