Get Ready for the Retake

Data Download

Get the data for the data analysis. There are two different options to get and load the data.

  • A - Import data from a R object (easy)
  • B - Import data from text files (a bit more difficult)

You do not need both! Choose the option you prefer.

## clean/reset environment 
rm(list = ls()) 

## Your current (working) directory
getwd()

## Change working directory (if needed)
# setwd("my/folder")

## Create new working directory (if needed)
# dir.create("Apple"); setwd("Apple")

Version A

## URL (Uniform Resource Locator)
apple.url <- "https://www.gdc-docs.ethz.ch/Varia/Wassermann2019/data/Apple_2019.RData"

## Download data (R data image file)
utils::download.file(apple.url, destfile = "Wassermann_2019.RData")

## Load and verify the apple data
load("Wassermann_2019.RData")
apple

# What you should get:
#
# phyloseq-class experiment-level object
# otu_table()   OTU Table:         [ 3128 taxa and 48 samples ]
# sample_data() Sample Data:       [ 48 samples by 7 sample variables ]
# tax_table()   Taxonomy Table:    [ 3128 taxa by 7 taxonomic ranks ]
# phy_tree()    Phylogenetic Tree: [ 3128 tips and 3127 internal nodes ]

Version B

## Download data (R data image file)
apple.url <- "https://www.gdc-docs.ethz.ch/Varia/Wassermann2019/data/Wassermann2019.zip"
utils::download.file(apple.url, destfile = "Wassermann2019.zip")
unzip("Wassermann2019.zip")
file.remove("Wassermann2019.zip")
list.files()

## Package you need
library(phyloseq) # > https://bioconductor.org/packages/release/bioc/html/phyloseq.html 

## Phyloseq Import
otu  <- "pApple_MiSeq250_16S_OTU_Count_Sintax.txt"
map  <- "pApple_MiSeq250_16S_MapFile.txt"
tree <- "pApple_MiSeq250_16S_OTU_MSA.tre"
# ref  <- "pApple_MiSeq250_16S_OTU.fa"

apple <- import_qiime(otufilename = otu, mapfilename = map, treefilename = tree)
apple

What you should get:
#
# phyloseq-class experiment-level object
# otu_table()   OTU Table:         [ 3128 taxa and 48 samples ]
# sample_data() Sample Data:       [ 48 samples by 7 sample variables ]
# tax_table()   Taxonomy Table:    [ 3128 taxa by 7 taxonomic ranks ]
# phy_tree()    Phylogenetic Tree: [ 3128 tips and 3127 internal nodes ]

R Scripts (working on it)

You also have the choice between an R script or and R-Markdown version. If you are not familiar with R-Markdown start with the R script.

## R Script for Re-Analysis
script.url <- "https://www.gdc-docs.ethz.ch/Varia/Wassermann2019/scripts/Wassermann2019.R"
utils::download.file(script.url, destfile = "Wassermann2019.R")
file.edit("Wassermann2019.R")

Careful! With R-Markdown, the working directory is defined by the location of the Rmd file and should not be changed.

## R-Markdown Script for Re-Analysis
md.url <- "https://www.gdc-docs.ethz.ch/Varia/Wassermann2019/scripts/Wassermann2019.Rmd"
utils::download.file(md.url, destfile = "Wassermann2019.Rmd")
file.edit("Wassermann2019.Rmd")