---
title: "FROGS Phyloseq: Sample clustering using different linkage method (version 4.0.1)"
output: 
  html_notebook:
    code_folding: hide
params:
   phyloseq:
      value: x
   varExp:
      value: x
   distance:
      value: x
   libdir:
      value: x
---
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<style type="text/css">
code.r{ /* Code block */
  font-size: 11px;
}
pre { /* Code block */
  font-size: 11px
}
.button {
    background-color: #2a7ecc; /* Blue */
    border          : none;
    color           : white;
    padding         : 5px 10px;
    text-align      : center;
    text-decoration : none;
    display         : inline-block;
    font-size       : 12px;
    margin          : 4px 2px;
    cursor          : pointer;
    border-radius   : 8px;
}
h4 { 
    display      : block;
    font-size    : 1em;
    margin-top   : 1.33em;
    margin-bottom: 1.33em;
    margin-left  : 0;
    margin-right : 0;
    font-weight  : bold;
    color        : #2a7ecc;
}
</style>


```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, error = TRUE)
```
Phyloseq `r packageVersion("phyloseq")`

```{r import, message=FALSE}

## Import packages
library(phyloseq)
library(scales)
library(ape)
source(file.path(params$libdir, "graphical_methods.R"))
## Alternative to source all extra function from a github repo
## source("https://raw.githubusercontent.com/mahendra-mariadassou/phyloseq-extended/master/load-extra-functions.R")

## Setting variables
  ## The Phyloseq object (format rdata)
  # phyloseq <- ""

  ## The beta diversity distance matrix file
  # distance <- ""

  ## The experiment variable that you want to analyse
  # varExp <- ""

## Create input and parameters dataframe
  # params <- data.frame( "phyloseq" = phylose, "distance" = distance, "varExp" = varExp)

## Load data
  ## the phyloseq object
load(params$phyloseq)

  ## the distance matrix file
A        <- read.table(file=params$distance, row.names=1)
dist     <- as.dist(A)
```

# {.tabset .tabset-fade .tabset-pills}

## Ward D2
```{r ward, fig.width=8, fig.height=7, echo=FALSE}
plot_clust(data, dist, method = "ward.D2", color = params$varExp)
```

## Complete
```{r complete, fig.width=8, fig.height=7, echo=FALSE}
plot_clust(data, dist, method = "complete", color = params$varExp)
```

## Single
```{r single, fig.width=8, fig.height=7, echo=FALSE}
plot_clust(data, dist, method = "single", color = params$varExp)
```
