Detailed steps for genetic algorithm

The genetic algorithm works by creating a “population” of instances, with an output which it attempts to improve upon over successive “generations” of populations, by using the best results from the previous to inform the next (for a detailed description of genetic algorithms see (Mitchell 1998)). In this case, the instances are the creation of a dendrogram of functional relatedness based on weighted traits and a subsequent number (1…n) of functional groups as described above. The output is the lowest ranked AIC value of the GLMMs run for each of the functional groups. The algorithm was built in R (R Development Team 2014), based on source code from the package genalg(Willighagen 2005), which was modified to perform the analysis.

The following were the steps for each instance within a population of 100 instances over 100 generations:

-Each trait was assigned a random weighting between 0 and 1.

-Gower dissimilarity (Gower and Legendre 1986)was used to build a dendrogram from the functional trait matrix utilising the weightings.

-To quantitatively choose a number of groups for the dendrogram to be divided into, K-Means partitioning using Simple Structure Index (SSI) (Dolnicar et al. 1999) was used. A minimum number of groups was set at 8 and groups were not allowed to contain more than 25% of the total number of invertebrate families, this was to avoid excessively large groupings.

-GLMMs with a binomial error distribution were performed for each functional group derived from the previously computed dendrogram, using the lme4 R package (Bates et al. 2012). In each model, the dependent variable of positive to negative M. ulcerans samples at a site was compared with the independent variables derived from the null models (measures of environmental metrics found to have a significant relationship with M. ulcerans) in addition to the proportional presence of the functional group (in relation to the total number of organisms at a site), with geographic location as a random effect (defined based on the administrative regions of Ghana, this was sufficient in model checking to remove all spatial autocorrelation). All models used transformed data where appropriate, which was established from the null models for the environmental variables. The AIC value for each of these models was recorded as the model output, and was used by the genetic algorithm to rank the best fit models.

-The lowest ranked AIC output of these models was then used to inform how well the genetic algorithm assigned weightings, it then re-weighted the trait values using this information to improve upon the lowest AIC value.

Table SM 1List of environmental variables used to create the null models, this includes descriptions of the variables and a brief summary of their role in freshwater ecology.

Variable / Description
Dissolved oxygen / The level of oxygen dissolved in the water, this can affect what organisms can survive with many having specific adaptations for low or high levels.
Turbidity / A measure of water clarity, this can be affected by the level of dissolved and suspended solids.
Temperature / Measured in °C
Colour Apparent / A measure of the colour of the water, which can be a result of particulate matter, organic and inorganic, in addition to the presence of different micro-organisms.
Conductivity / How well the water conducts electricity is often affected by salt levels and the geology of the surrounding area.
Chlorophyll / Chlorophyll levels are predominantly affected by the presence of photosynthetic algae.
Suspended Solids / The level of non-dissolved particulates in the water column.
Dissolved Solids / The level of minerals, salts, metals, cations or anions dissolved in the water.
Calcium / An element important for the growth of numerous organisms, particularly those with hard shells.
Magnesium / An element important to the survival of numerous organisms.
Iron / An element important to the survival of numerous organisms.
Chlorine / An element often harmful to the growth of organisms.
Sulphates / Often attributed to eutrophication and the abundance of algae.
Phosphates / Often attributed to eutrophication and the abundance of algae.

Table SM2 Environmental variables, stepwise regression model table for lentic sites. In bold are variables found to be significantly related to the presence of PCR positive M. ulcerans samples, and were therefore kept in the null model.

Environmental Variable / Estimate / ± Std. Error / P
Dissolved Oxygen / 0.222 / 0.1304 / 0.089
pH / -6.5315 / 2.1444 / 0.002**
Turbidity / -0.1709 / 0.1713 / 0.318
Temperature / 0.81915 / 4.60267 / 0.859
Colour Apparent / 0.212 / 0.1319 / 0.108
Conductivity / -0.3856 / 0.2826 / 0.172
Chlorophyll / 0.816 / 0.2005 / <0.001***
Suspended Solids / -0.08918 / 0.1738 / 0.608
Dissolved Solids / 0.7615 / 0.2402 / 0.002**
Calcium / 0.4748 / 0.425 / 0.264
Magnesium / 0.4725 / 0.434 / 0.276
Iron / 0.3204 / 0.2142 / 0.135
Chlorine / -0.3922 / 0.3677 / 0.286
Sulphates / 0.2038 / 0.2655 / 0.443

Table SM3 Environmental variables, stepwise regression model table lotic sites. In bold are variables found to be significantly related to the presence of PCR positive M. ulcerans samples, and were therefore kept in the null model.

Environmental Variable / Estimate / ± Std. Error / P
Dissolved Oxygen / 0.365 / 0.219 / 0.096
pH / 0.901 / 2.885 / 0.755
Turbidity / 0.186 / 0.104 / 0.073
Temperature / -5.533 / 4.896 / 0.258
Colour Apparent / -0.210 / 0.128 / 0.101
Conductivity / -185.796 / 31.584 / <0.001***
Chlorophyll / -0.127 / 0.154 / 0.410
Suspended Solids / -0.337 / 0.180 / 0.061
Dissolved Solids / 188.482 / 31.662 / <0.001***
Calcium / -1.047 / 0.419 / 0.013*
Magnesium / -1.530 / 0.288 / <0.001***
Iron / 0.194 / 0.665 / 0.770
Chlorine / 0.094 / 0.271 / 0.729
Sulphates / 0.053 / 0.177 / 0.765

Trait information including trait data and trait matrix.

Key for motility trait in table:

EpB = Epibenthic burrower

SA = Semi-aquatic

SwS = Surface water swimmer

FwS = Free water swimmer

CL = Crawler

TA = Predominantly attached to a surface

Definitions of feeding groups

Scraper: Consumes biofilms and algae directly from a surface substrage, e.g rocks.

Predators: Hunts and feeds upon other invertebrates and/or vertebrates

Gathering collectors: Actively gathers food such as detritus, algae and decaying tissue.

Predators/scavengers: Can both hunt and feed on living organisms or will feed upon decaying tissue

Haematophagous: Sucks blood from other organisms

Definitions of food types

Phytophagous: The tissue or fluids of macro plants.

Microphytes: Algae and plankton.

Detritus/Microphytes: Generally decaying tissue of macroplants in addition to microphytes e.g. algae.

Microinvertebrates: Small invertebrates, microscopic in size.

Macroinvertabrates: Larger invertebrates easily seen with the naked eye.

Omnivorous: Used for taxons which do not feed on an easily defined food type and will consume most foods available, including through predation, Includes several taxons which have a wide range of feeding habits within the taxonomic class used.

Microorganisms: Any microscopic organism, including: algae, bacteria, microinvertebrates and plankton.

Parasitic: Feeds on the tissue or fluids of a living host.

Decaying tissue: Decaying tissue, predominantly of other animals.

Table SM4 of species listed with their corresponding functional traits.

Species / Feeding group / Food type / Respiration / Body shape / Motility / Main body constituents
Ancylidae / Scraper / Microphytes / Lung / Spherical / TA / Calcium carbonate
Baetidae / Scraper / Microphytes / Gill / Streamlined / CL / Chitin/sclerotin
Bithyniidae / Scraper / Microphytes / Gill / Cylindrical / CL / Calcium carbonate
Heptageniidae / Scraper / Microphytes / Gill / Flattened / TA / Chitin/sclerotin
Hydrobiidae / Scraper / Microphytes / Gill / Cylindrical / EpB / Calcium carbonate
Hydroptilidae / Scraper / Microphytes / Gill / Cylindrical / CL / Constructed Casing
Leptophlebiidae / Scraper / Detritus/Microphytes / Gill / Flattened / TA / Chitin/sclerotin
Lymnaeidae / Scraper / Microphytes / Lung / Cylindrical / CL / Calcium carbonate
Psephenidae / Scraper / Microphytes / Gill / Flattened / TA / Chitin/sclerotin
Thiaridae / Scraper / Microphytes / Lung / Cylindrical / CL / Calcium carbonate
Araneae / Predators / Macroorganisms / Lung / Spherical / CL / Chitin
Hydrozoida / Predator / Macroorganisms / Tegument / NA / NA / NA
Belostomatidae / Predators / Macroorganisms / Plastron / Flattened / FwS / Chitin/sclerotin
Chlorocyphidae / Predators / Macroorganisms / Gill / Flattened / CL / Chitin/sclerotin
Dytiscidae / Predators / Macroorganisms / Plastron / Flattened / CL / Chitin/sclerotin
Nepidae / Predators / Macroorganisms / Stigmata / Cylindrical / CL / Chitin/sclerotin
Notonectidae / Predators / Macroorganisms / Plastron / Flattened / FwS / Chitin/sclerotin
Odonata / Predators / Macroorganisms / Gill / Flattened / CL / Chitin/sclerotin
Athericidae / Predators / Microinvertebrates / Gill / Spherical / CL / Chitin
Chaoboridae / Predators / Microinvertebrates / Tegument / Cylindrical / FwS / Chitin
Empididae / Predators / Microinvertebrates / Gill / Cylindrical / EpB / Chitin
Hebridae / Predators / Microinvertebrates / Stigmata / Flattened / CL / Chitin/sclerotin
Hydracarinidae / Predators / Microinvertebrates / Tegument / Flattened / CL / Membranous
Noteridae / Predators / Microinvertebrates / Stigmata / Flattened / CL / Chitin/sclerotin
Perlidae / Predators / macroinvertebrates / Gill / Flattened / EpB / Chitin/sclerotin
Pleidae / Predators / Microinvertebrates / Plastron / Spherical / FwS / Chitin/sclerotin
Staphylinidae / Predators / macroinvertebrates / Stigmata / Flattened / EpB / Chitin/sclerotin
Atyidae / Gathering collectors / Omnivourus / Gill / Cylindrical / FwS / Calcium carbonate
Ceratopogonidae / Gathering collectors / Omnivourus / Gill / Cylindrical / CL / Chitin
Chironomidae / Gathering collectors / Omnivourus / Tegument / Cylindrical / EpB / Chitin
Culicidae / Gathering collectors / Omnivourus / Stigmata / Cylindrical / FwS / Chitin
Dixidae / Gathering collectors / Microphytes / Stigmata / Cylindrical / Sws / Chitin
Hydraenidae / Gathering collectors / Microphytes / Plastron / Cylindrical / CL / Chitin/sclerotin
Isopoda / Various / Omnivourus / Gill / NA / FwS / Chitin
Leptoceridae / Various / Omnivourus / Gill / Cylindrical / CL / Constructed Casing
Potamonautidae / Shredders / Omnivourus / Gill / Flattened / CL / Calcium carbonate
Simuliidae / Gathering collectors / Omnivourus / Stigmata / Cylindrical / CL / Chitin/sclerotin
Tipulidae / Gathering collectors / Omnivourus / Stigmata / Cylindrical / CL / Chitin
Bulininae / Scraper / Phytophagous / Lung / Cylindrical / CL / Calcium carbonate
Physidae / Scraper / Phytophagous / Lung / Cylindrical / CL / Calcium carbonate
Pilidae / Scraper / Phytophagous / Gill / Spherical / CL / Calcium carbonate
Planorbidae / Scraper / Phytophagous / Lung / Flattened / CL / Calcium carbonate
Caenidae / Gathering collectors / Detritus/Microphytes / Gill / Flattened / CL / Chitin/sclerotin
Elmidae / Gathering collectors / Detritus/Microphytes / Plastron / Cylindrical / CL / Chitin/sclerotin
Hydrophilidae / Predators/Scavengers / Detritus/Microphytes / Plastron / Cylindrical / CL / Chitin/sclerotin
Limnichidae / Gathering collectors / Detritus/Microphytes / Plastron / Flattened / CL / Chitin/sclerotin
Ptilodactylidae / Gathering collectors / Detritus/Microphytes / Stigmata / Cylindrical / CL / Chitin/sclerotin
Sminthuridae / Gathering collectors / Detritus/Microphytes / tegument / Cylindrical / CL / Chitin
Stratiomyiidae / Gathering collectors / Detritus/Microphytes / Stigmata / Flattened / CL / Chitin
Syrphidae / Gathering collectors / Detritus/Microphytes / Stigmata / Cylindrical / CL / Chitin
Calopterygidae / Predators / Macroinvertebrates / Gill / Cylindrical / CL / Chitin/sclerotin
Coenagrionidae / Predators / Macroinvertebrates / Gill / Cylindrical / CL / Chitin/sclerotin
Corduliidae / Predators / Macroinvertebrates / Gill / Flattened / CL / Chitin/sclerotin
Gerridae / Predators / Macroinvertebrates / Plastron / Cylindrical / SwS / Chitin/sclerotin
Gomphidae / Predators / Macroinvertebrates / Gill / Flattened / EpB / Chitin/sclerotin
Gyrinidae / Predators / Macroinvertebrates / Plastron / Cylindrical / CL / Chitin/sclerotin
Lampyridae / Predators / Macroinvertebrates / Stigmata / Flattened / SA / Chitin
Libellulidae / Predators / Macroinvertebrates / Gill / Flattened / CL / Chitin/sclerotin
Muscidae / Predators / Macroinvertebrates / Stigmata / Cylindrical / CL / Chitin
Naucoridae / Predators / Macroinvertebrates / Plastron / Flattened / CL / Chitin/sclerotin
Protoneuridae / Predators / Macroinvertebrates / Gill / Flattened / CL / Chitin/sclerotin
Rhagionidae / Predators / Macroinvertebrates / Stigmata / Cylindrical / EpB / Chitin
Sciomyzidae / Predators / Macroinvertebrates / Stigmata / Cylindrical / FwS / Chitin
Chrysomelidae / Shredders / Phytophagous / Plastron / Flattened / CL / Chitin/sclerotin
Copepoda / Shredders / Microorganisms / Tegument / Cylindrical / FwS / Chitin
Corixidae / Shredders / Phytophagous / Plastron / Flattened / SwS / Chitin/sclerotin
Curculionidae / Shredders / Phytophagous / Plastron / Cylindrical / CL / Chitin/sclerotin
Dryopidae / Shredders / Phytophagous / Plastron / Cylindrical / CL / Chitin/sclerotin
Ephydridae / Shredders / Microphytes / Stigmata / Cylindrical / EpB / Chitin
Hirudinae / hematophagous / Parasitic / Tegument / Cylindrical / FwS / Membranous
Hydrochidae / Shredders / Phytophagous / Plastron / Cylindrical / CL / Chitin/sclerotin
Pyralidae / Shredders / Phytophagous / Stigmata / Cylindrical / CL / Chitin
Tricorythidae / Gathering collectors / Phytophagous / Gill / Flattened / CL / Chitin/sclerotin
Cladocera / filtering collectors / Microorganisms / Tegument / Flattened / FwS / Membranous
Conchostraca / filtering collectors / Microorganisms / Gill / Spherical / FwS / Calcium carbonate
Hydropsychidae / filtering collectors / Microorganisms / Gill / Cylindrical / TA / Constructed Casing
Oligoneuriidae / filtering collectors / Microorganisms / Gill / Flattened / CL / Chitin/sclerotin
Polycentropodidae / filtering collectors / Microorganisms / Gill / Cylindrical / TA / Chitin
Scirtidae / filtering collectors / Microorganisms / Stigmata / Flattened / CL / Chitin
Sphaeriidae / filtering collectors / Microorganisms / Gill / Spherical / EpB / Calcium carbonate
Entomobryiidae / Gathering collectors / Detritus/Microphytes / Tegument / Cylindrical / EpB / Chitin
Ephemeridae / Gathering collectors / Detritus/Microphytes / Gill / Flattened / EpB / Chitin/sclerotin
Ephemerythidae / Gathering collectors / Detritus/Microphytes / Gill / Flattened / EpB / Chitin/sclerotin
Hypogastruridae / Gathering collectors / Detritus/Microphytes / Tegument / Cylindrical / EpB / Chitin
Isotomidae / Gathering collectors / Detritus/Microphytes / Tegument / Cylindrical / EpB / Chitin
Nematoda / Gathering collectors / Detritus/Microphytes / Tegument / Cylindrical / EpB / Membranous
Oligochaeta / Gathering collectors / Detritus/Microphytes / Stigmata / Cylindrical / EpB / Membranous
Ostracoda / Gathering collectors / Detritus/Microphytes / Gill / Spherical / EpB / Calcium carbonate
Polymitarcyidae / Gathering collectors / Detritus/Microphytes / Gill / Flattened / EpB / Chitin/sclerotin
Psychodidae / Gathering collectors / Detritus/Microphytes / Stigmata / Cylindrical / EpB / Chitin
Hydrometridae / Predators/Scavengers / Decaying tissue / Stigmata / Cylindrical / SA / Chitin/sclerotin
Mesoveliidae / Predators/Scavengers / Decaying tissue / Stigmata / Flattened / SwS / Chitin/sclerotin
Saldidae / Predators/Scavengers / Microinvertebrates / Stigmata / Flattened / SA / Chitin/sclerotin
Veliidae / Predators/Scavengers / Microinvertebrates / Stigmata / Flattened / FwS / Chitin/sclerotin

Bates D, Maechler M, and Bolker B (2012). Linear mixed-effects models using S4 classes.R package version 0.999999-0. in.

Dolnicar S, Grabler K, Mazanec JA, Woodside AG, Crouch GI, Oppermann M, et al. (1999). A tale of three cities: perceptual charting for analysing destination images. CABI Publishing.

Gower JC, and Legendre P (1986). Metric and Euclidean properties of dissimilarity coefficients. Journal of Classification3:5-48.

Mitchell M (1998). An introduction to genetic algorithms. MIT press.

R Development Team (2014). R: A language and environment for statistical computing. in.

Willighagen E (2005). Genalg: R based genetic algorithm. R package version 0.11.