# Assuming a connection to the database called db_m is active
site_photos <- DBI::dbReadTable(db_m, "site_photos")
photo_source <- DBI::dbReadTable(db_m, "photo_source")
local_photo_dir <- "~/temp/streamphotos/"
# change as appropriate, include trailing /
for(i in 1:nrow(site_photos)){
diri <- photo_source$file_directory[photo_source$photo_sourcecode ==
site_photos$photo_sourcecode[i]]
if(!diri %in% dir(local_photo_dir)){
dir.create(paste0(local_photo_dir, diri))
}
urli <- paste0(
"https://tools.thewerg.unimelb.edu.au/mwbugs/data/streamphotos/",
diri,"/", site_photos$filename[i])
download.file(urli,
paste0(local_photo_dir, diri,"/",site_photos$filename[i]))
}Data downloads
The full1 macroinvertebrate database is available for download as a geopackage (gpkg) file. See the technical tips tab for a summary of the tables and their relationships.
mwbugs_taxonomy_tables.xlsx is an excel file containing only the taxonomy tables of the database (includes the taxon_* tables with taxoncodes for aquatic macroinvertebrates, and the t_* tables, which contain the hierarchy of all taxa (non-aquatic, non-macroinvertebrate and aquatic macroinvertebrate) in the taxon_seq table for assembling taxonomies for the metabarcoding data).
bug_database_functions.R contains several helper functions for working with the database in R. (calcMonthDate(), calcMonthNo(), codeTaxonomy(), checkTaxonNames(), taxoncodeToShortcode(), plot_lumar(), load_all_mwbugs_table()).
metabarcoding_functions.R contains several helper functions for working with metbarcoding data in the database (see Chapter 6 of the user’s manual). (build_taxonomic_table(), and others).
mwbugs.bib is a bibtex file containing all references used by the user’s manual and the data explorer app (in preparing download data documentation).
All photos listed in the site_photos table can be downloaded from the server using the following script (in R), and placed in subdirectories matching those listed in the photo_sources table.
Footnotes
This file excludes biota data for samples for which embargoed = 1 in the samples table. If you wish access to the embargoed data please contact Chris Walsh. For past versions of the database, see the archive.↩︎




