Skip to content

Source code for a paper on pre-processing high frequency animal tracking data.

Notifications You must be signed in to change notification settings

pratikunterwegs/atlas-best-practices

Repository files navigation

Source Code and Supplementary Material for: A Guide to Pre-processing High-throughput Animal Tracking Data

Project Status: Active – The project has reached a stable, usable state and is being actively developed. DOI:10.1101/2020.12.15.422876 DOI Paper Workflows

This is source code for a manuscript that sets out a pipeline for pre-processing data from ATLAS systems, but which can be applied to any high-throughput tracking data.

The worked out examples mentioned in the manuscript and provided in the supplementary material as a PDF, can also be found hosted on Github Pages in its online version, here: Online Version of Worked-out Examples.

Source Code for Figures and Analyses

Most of the source code may be found in the folder scripts, with numbers indicating the order in which it is to be run. This source code (for figures 7 and 8) is partially generated from the .Rmd files in the directory supplement using knitr::purl. See the render_books.sh file for details of the conversion from .Rmd to .R.

renv/

Settings to store and restore the R packages to the versions used in this project.

scripts/

  • 01_background.R: Simulating data using the R package smoove for the section Pipeline Overview, Getting atlastools, and Simulating Data. Simulated data is saved into the data folder as data_sim.csv (uniform correlated velocity model data), and data_for_patch.csv (three rotational/advection correlated velocity model datasets). No seed was set for data_sim.csv, but data_for_res_patch.csv was generated using a set seed.

  • 02_filtering_data.R: Source code for figures that support the sections Spatio-Temporal Filtering and Filtering to Reduce Location Errors. Also adds error to the UCVM dataset (data_sim.csv) using functions defined in R/helper_functions.R. Makes Figures 2 -- 3. Writes cleaned data to data/data_no_reflections.csv.

  • 03_smoothing_tracks.R: Code to make Figures 4 -- 5 in the section Smoothing and Thinning Data.

  • 04_residence_patch.R: Code to make Figure 6 in the section Creating System-Specific Pre-processing Tools.

  • 05_calibration_data.R: Code for Figure 7 in the main text subsection A Real-World Test of User-Built Pre-Processing Tools. Shows a fully worked out example of pre-processing ATLAS data, as well as the linear model validating the residence patch method. Also used in Supplementary Material 01 (docs/ms_atlas_preproc_supplementary_material_DATE.pdf) section Validating the Residence Patch Method with Calibration Data.

  • 06_bat_data.R: Shows a fully worked out example of pre-processing ATLAS tracking data from fruit bats in the Hula Valley, Israel, which forms the main text section Worked out Example on Animal Tracking Data. Also used in Supplementary Material 01 (docs/ms_atlas_preproc_supplementary_material_DATE.pdf) section Processing Egyptian Fruit Bat Tracks.

  • 0x_get_srtm_hula.py`: Python code to retrieve Shuttle Radio Topography Mission 30m resolution data for the Hula Valley, Israel. This is used solely as a background for Figure 8 in the main text.

  • helper_functions.R: Script with helpful functions to simulate errors in data.

Main Text

The main text is also copied from a local source into the docs/ as a PDF.

Supplementary Material

Supplementary Material 01 is rendered into the docs/ folder as docs/ms_atlas_preproc_supplementary_material_DATE.pdf, where DATE is the date of rendering. The rendering code using the R package bookdown is run from the shell script render_books.sh.

This material is placed in the supplement/ folder.

supplement/

  • figures/ The supplementary material figures.

  • latex/ and *.yml Formatting options for the supplementary material output.

  • .Rmd files to create the supplementary material.

  • render_books.sh: A shell script with helper commands to generate the Supplementary Material and the source code as R scripts from the Rmd files.

  • references.bib: References for the main text and Supplementary Material 01.

The xx_references.Rmd file ensures a References section in Supplementary Material 01.


Supplementary Material 02 is the PDF manual for the R package atlastools, which is rendered from the installed version of atlastools using devtools::build_manual. The rendered output is atlastools_VERSION.pdf. Versioning is not implemented in the naming. This command is also run from the shell script render_books.sh.

Auxiliary Files

  • atlas_best_practices.qgz: A QGIS 3 project file to generate Figure 8 in the main text.

  • .git*: Files for git repository organisation. The submodule atlas-manuscript contains the TEX source of the main text and is private.

Data

The data/ folder contains the following main datasets.

Simulated Movement Data

  1. data_sim.csv: Data simulated from R/_01_background.R. An UCVM track simulated using smoove.

  2. data_for_res_patch.csv: Data simulated from R/_01_background.R. Three RACVM tracks simulated using smoove.

Empirical Movement Data

  1. atlas1060_allTrials_annotated.csv: A hand held calibration ATLAS track collected in August 2020 in the Dutch Wadden Sea. Used to make Figure 7 in the main text subsection Validating the Residence Patch Method, and in Supplementary Material 01 (docs/ms_atlas_preproc_supplementary_material_DATE.pdf), section Validating the Residence Patch Method with Calibration Data.

  2. Three_example_bats.sql: Tracks from three Egyptian fruit bats (Rousettus aegyptiacus)from the Hula Valley, Israel. Used to make Figure 8 in the main text section Worked out Example on Animal Tracking Data, and for the Supplementary Material 01 (docs/ms_atlas_preproc_supplementary_material_DATE.pdf) section Processing Egyptian Fruit Bat Tracks.

  3. bat_data.csv: The above data saved as a csv file.

Empirical Spatial Data

  1. griend_polygon/: A shapefile with the polygon outline of the Dutch Wadden Sea island of Griend, where the calibration data was collected.

  2. hula_valley/: A shapefile of the extent of the study site of the Hula Valley, Israel.

  3. griend_hut.gpkg: The location of the field station on Griend.

  4. Roosts.csv: The locations of bat roosts in the Hula Valley.

  5. trees_update_clusters_Aug2020.csv: The locations of fruit trees in the Hula Valley, Israel.

  6. srtm_30.tif: A digital elevation model (DEM) of the Hula Valley, Israel.

Processed Data

All other data are processed forms of the simulated or empirical movement data and not described further.

Figures

The figures folder contains the main text, as well as supplementary material figures.