Table S1. R code used in the statistical analyses and statistical graphs.

# Nico Salmaso, Luigi Naselli-Flores and Judit Padisák

# Functional classifications in phytoplankton ecology and their application

# * R scripts - Tested with:

# ** R version 3.1.1 (2014-07-10) under Windows

# ** R version 3.1.1 (2014-07-10) under Linux Ubuntu 14.04 LTS

# A) Fig. 2a,d ***************************************************************************

rm(list=ls(all=TRUE))

# Under Windows the input matrices are supposed to be saved under "c:\data\"

# In Linux save files in, e.g., "/home"

setwd("c:/data/")

FGall <- read.table(file="FG_TabIII_Reynolds.txt", header=T, sep="\t", row.names=1); FGall

FG <- FGall[c(1:8)]; FG

# if the package "vegan" is not installed, run this command:

install.packages("vegan")

# Fig. 2a *** the script works with R version > 3.0.3 ***

library(vegan)

FG.euc <- vegdist(FG, "euclidean")

ward <- hclust(FG.euc, method="ward.D2") # option ward.D2 (R ver.>3.0.3) implements Ward's clustering criterion(see Murtagh and Legendre 2014).

par(mar=c(5,5,4,2))

plot(ward, hang=0, xlab="", ylab="Height", main="", sub="", cex=1.2, cex.lab=1.7, cex.axis=1.5)

text(2.9, 2.4, "4", cex=2)

text(9.9, 2.4, "5", cex=2)

text(17.3, 2.4, "3", cex=2)

text(23.7, 2.4, "2", cex=2)

text(27.3, 2.4, "1", cex=2)

# NMDS

FG.mds <- metaMDS(FG, distance = "euclidean", autotransform = FALSE)

# Fig. 2b

# Codon A B C D N P T S1 S2 SN Z X3 X2 X1 Y E F G J K H1 H2 U LO LM M R V W1 W2

# grpWard5 1 2 2 3 5 5 5 3 4 4 1 1 3 3 3 1 1 3 3 4 4 4 5 5 4 4 4 3 3 3

grpWard5 <- c(1,2,2,3,5,5,5,3,4,4,1,1,3,3,3,1,1,3,3,4,4,4,5,5,4,4,4,3,3,3)

par(mar=c(5,5,4,2))

plot(FG.mds, type="t", display="sites", cex=1.3, cex.axis=1.7, cex.lab=1.7, xlab="NMDS Axis 1", ylab="NMDS Axis 2")

encircle <- ordihull(FG.mds, grpWard5, draw=c("polygon"), label = TRUE, cex=1.3, lty=1, lwd=0.5)

# Fig. 2c

FG.mds$wascores <- wascores(FG.mds$points, FG, expand = TRUE)

par(mar=c(5,5,4,2))

fig <- plot(FG.mds, type = "none", cex=1.3, cex.axis=1.7, cex.lab=1.7, xlab="NMDS Axis 1", ylab="NMDS Axis 2")

points(fig, "sites", pch=21, col="black", bg="white", cex=1.2)

text(fig, "species", col="black", cex=1.3, font=4)

# Fig. 2d

FG.mds.T <- envfit(FG.mds ~ FGall$Trophy)

par(mar=c(5,5,4,2))

plot(FG.mds, type="t", display="sites", cex=1.3, cex.axis=1.7, cex.lab=1.7, xlab="NMDS Axis 1", ylab="NMDS Axis 2")

plot(FG.mds.T, cex=2, labels="Trophic state", font=4, col=1)

with(FGall, ordisurf(FG.mds, FGall$Trophy, add=T, labcex=2, col="black", font=4))

# B) Fig. 3 ********************************************************************************

rm(list=ls(all=TRUE))

# Under Windows the input matrices are supposed to be saved under "c:\data\"

# In Linux save files in, e.g., "/home"

setwd("c:/data/")

FG_attr <- read.table(file="FG_attributes.txt", header=T, sep="\t", row.names=1); FG_attr

# Fig. 3

library(vegan)

par(mar=c(5,5,4,2))

FG.jac <- vegdist(FG_attr, "jaccard")

dend <- hclust(FG.jac, method="ward.D2")

plot(dend, hang=0, xlab="", ylab="Height", main="", sub="", cex=1.3, cex.lab=1.7, cex.axis=1.7)

# END #

# Data input

Input archive, save as text file: FG_TabIII_Reynolds.txt

Zm I Temp SRP DIN Si CO2 fZoo TrophyCode Trophy

A 0 0.5 1.0 1.0 1 1.0 0.0 0.0 O 3

B 0 1.0 1.0 1.0 0 0.0 0.0 0.0 M 5

C 0 1.0 1.0 0.0 0 0.0 0.5 0.0 E 7

D 1 1.0 1.0 0.0 0 0.0 1.0 0.0 H 9

N 0 0.0 0.0 1.0 0 0.5 0.0 0.5 M 5

P 0 0.0 0.0 0.0 0 0.5 1.0 1.0 E 7

T 0 0.5 0.0 0.5 0 1.0 0.5 1.0 M 5

S1 1 1.0 1.0 0.0 0 1.0 1.0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