---
title: "FROGS Phyloseq: Multivariate Analysis of Variance (version 3.2.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)
```
Phyloseq `r packageVersion("phyloseq")`

```{r import, message=FALSE}
## Import packages
library(phyloseq)
library(vegan)

## 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, nammed data in FROGSSTAT Phyloseq Import data
load(params$phyloseq)
  # Convert sample_data to data.frame
metadata <- as(sample_data(data), "data.frame") 

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

## Multivariate ANOVA performed with adonis
adonis <- paste('adonis(dist ~ ', params$varExp, ', data = metadata, perm = 9999)')
eval(parse(text = adonis))
```
