lakes <- fread('../data/metadata/lakes.csv')
stations <- fread('../data/weather/wu_stations.csv')
metadata_legend <- data.table::fread('../data/metadata/metadata_legend.csv')
metadata <- rbind(metadata_2018, metadata_2019)
set(metadata, j = "Date", value = as.Date(metadata$Date, "%m/%d/%Y"))
set(metadata, j = "Year", value = factor(metadata$Year, levels = sort(unique(metadata$Year))))
set(metadata, j = "Week", value = factor(metadata$Week, levels = sort(unique(metadata$Week))))
setorder(metadata, Location, Year, Week)
metadata[, Risk := "No"]
data.table::set(metadata, which(metadata$Microcystin >= 0.1), "Risk", "Low")
data.table::set(metadata, which(metadata$Microcystin >= 1), "Risk", "Moderate")
data.table::set(metadata, which(metadata$Microcystin >= 8), "Risk", "High")
lake_risk_colors <- schuylR::create_palette(4, 'viridis')
lake_risk <- rep(lake_risk_colors[1], length(unique(metadata$Location)))
lake_risk[metadata[, sum(Risk %in% "Low")>5, by = Location]$V1] <- lake_risk_colors[2]
lake_risk[metadata[, sum(Risk %in% "Moderate")>4, by = Location]$V1] <- lake_risk_colors[3]
lake_risk[metadata[, sum(Risk %in% "High")>2, by = Location]$V1] <- lake_risk_colors[4]
read_counts <- construct_ASVtable('../data/16S_processing/finalized_reads')
read_counts <- read_counts[, c(TRUE, colSums(read_counts[,-1]) > 5000), with = FALSE]
data.table::setnames(read_counts, colnames(read_counts), gsub('_S.*', '', colnames(read_counts)))
classifications <- dada2::assignTaxonomy(read_counts[[1]], '../data/16S_processing/databases/rdp_train_set_18.fa.gz')
classifications <- dada2::assignTaxonomy(read_counts[[1]], '../data/16S_processing/databases/silva_nr99_v138.1_train_set.fa.gz')