Data from: Maintaining tandem movement cohesion through antennal movements in termites
Abstract
How do animals coordinate their motion during migration? Traditional models of collective motion, for example, describing bird flocks or fish schools, rely on visual interactions. However, many animals are blind, requiring movement coordination through maintenance of physical contact. The risks and costs of becoming accidentally separated may encourage the evolution of compensatory strategies. Here we study tandem running in blind termites. We quantitatively investigate how these animals use their appendages to maintain stable pair movements. During tandem runs, male followers use shorter palps and longer antennae to maintain physical contact with female leaders. Our posture-tracking analysis revealed that termites dynamically change their antennal movements. Males stabilize their antennae to maintain contact with their partners while their palps are in contact. When the male palps lost contact with a female, males started swinging their antennae while increasing movement speed. Antennae removal experiments revealed that antennal swinging contributes to pair maintenance, and males compensate for single antenna loss by increasing the swinging of the remaining one. By providing detailed information on contact-based movement coordination, our results contribute to understanding the diversity of animal collective behavior.
https://doi.org/10.5061/dryad.1ns1rn94q
Description of the data and file structure
This repository provides access to the data and source code used for this manuscript.
This study investigates the termite tandem run, focusing on how termites use antennae and regulate movement patterns according to physical contact with the partner. We recorded movement patterns of single termites and mating pairs in two different species, Reticulitermes speratus and Coptotermes formosanus. We also observe tandem running behavior of R. speratus when we cut their antennae. We used the posture tracking software, SLEAP, to extract trajectories of each body part. All these raw data were stored in the data_raw folder.
Run the codes sequentially as described below.
Table of Contents
This repository includes tracking data and Python/R codes for analysis. The entire file is contained within the data.zip file.
- analysis
- code - run in this order
- data_prep.py - 1. Preprocess SLEAP tracking data (including filling missing data by linear interpolation, applying a median filter with kernel size 5 using
scipy.signal.medfilt afunction, filling NAN for the removed antenna vector, and scaling in mm from pixel). Then extract the data of interest for further analysis. - data_fmt_forR.py - 2. Create formatted data (in FEATHER format) for visualization and statistical analysis in R.
- data_preprep.R - 3. Additional preprocessing using R.
- output_heatmap.R - 4-1. Create heatmap plots for antenna positions.
- output_antenna_move.R - 4-2. Analyze antenna movements.
- output_distance.R - 4-3. Analyze the distance between the leader and the follower.
- sleap_model_evaluation.py - 0. Additional script to obtain mAP and mAR. Use to evaluate the SLEAP-trained model performance.
- get_metric_error.py - 0. Additional script to obtain pose estimation error. Use to evaluate the SLEAP-trained model performance.
- data_prep.py - 1. Preprocess SLEAP tracking data (including filling missing data by linear interpolation, applying a median filter with kernel size 5 using
- data_raw - raw data in h5 format
- control: observation without antenna removal, antenna: antenna removal experiments (00: no antenna, 10: full-cut, 15: half cut, 20: control)
- file name format
- Control:
Species_dishsize_pairing_colony_rep.h5- Pairing: F (female), M (male), FM (female-male pair)
- Antenna:
Species_dishsize_treatment_colony_rep.h5
- Control:
- Variables
- Each file contains a "locations" array with the shape (frame, node, xy, individual), representing x–y coordinates of each body part over time for 1 or 2 individuals
- Nodes (0–16) correspond to: antennatipr, antennamiddler, antennabaser, antennatipl, antennamiddlel, antennabasel, headtip, pronotumfront, pronotumend, abdomenfront, abdomentip, frontlegl, middlelegr, middlelegl, hindlegr, hindlegl, and frontlegr.
- data_fmt - add temporal data generated from raw data. See the codes for how they were generated.
- data_filter – performed interpolation, filling, and smoothing for data_raw. Have subfolders for each species (Cop-for and Ret-spe). Within each species, further subfolders are for each treatment (control or antenna) and pairing status, consistent with
data_raw. Created bydata_prep.py. - data_extract – extracted data of body parts used in analysis (
antennatipr,antennabaser,antennatipl,antennabasel,headtip,pronotumfront,pronotumend,abdomentip). Subfolder structure is consistent withdata_filter. Created bydata_prep.py. - Files named
2D_hist_Species_Treatment_Pairing_AntennaState_df.feather– created bydata_fmt_forR.py, used inoutput_heatmap.R. - Files named
antenna_angle_Species_Treatment_Pairing_AntennaState_df.feather– created bydata_fmt_forR.py, used inoutput_distance.Randoutput_antenna_move.R. df_antenna_length.rdaanddf_palp_length.rda– stored data for antenna length in R analysis. Created bydata_preprep.Rusingdf_bl_al.csv.df_bl_al.csv– antenna length measurements produced indata_prep.py.
- data_filter – performed interpolation, filling, and smoothing for data_raw. Have subfolders for each species (Cop-for and Ret-spe). Within each species, further subfolders are for each treatment (control or antenna) and pairing status, consistent with
- Output includes PDF figures produced in R during data visualization and analysis. These figures summarize results from behavioral and movement analyses described in the manuscript. File names indicate the species (Cop-for and Ret-spe) and the type of analysis (e.g., speed, antennal movement, separation time, autocorrelation, etc.). Figures were generated to visualize statistical results and to check data quality, and are provided for transparency and reproducibility. No raw data are stored in this folder.
- palp_measurement - they were measured using this code.
- For each species, there are images with overlayed palp measurements.
- Length data are stored in
res.csvandres.pickle.- Definition of variables in
res.csv(see palp_measurement):name: name of the observed pair, corresponding to video nameswidth: width of the video frame – 2000 pxheight: height of the video frame – 2000 pxlength: length of the video in framesfps: frames per secondframe: frame number used for palp length measurement (integer, unitless)scale: size of the scaling object (ignored; 2000 px = dish size)bodyLength0: length of the left palp in pixels (px)bodyLength1: length of the right palp in pixels (px)
- Definition of variables in
- code - run in this order
- SLEAP - This folder contains trained SLEAP models used for pose estimation in two termite species. Within each species subfolder, the
modelsdirectory includes two models for a top-down tracking approach: one for locating individuals (centroid; e.g.,240315_202816.centroid.n=100) and one for identifying body parts (centered instance; e.g.,240315_205711.centered_instance.n=100). The contents (e.g.,.h5,.json,.slp,.npz,.csvfiles) The standard SLEAP project structure includes model weights, training logs, configurations, and ground-truth labels. For details on file structure and usage, refer to the official SLEAP documentation: https://sleap.ai
Session information
Python (data processing)
Python version 3.9.13
h5py: 3.7.0
pandas: 1.5.2
numpy: 1.23.2
opencv-python: 4.6.0.66
scipy: 1.9.3
R
> library(devtools)
> session_info()
─ Session info ────────────────────────────────────────────────────────────────
setting value
version R version 4.3.1 (2023-06-16 ucrt)
os Windows 11 x64 (build 22631)
system x86_64, mingw32
ui RStudio
language en
tz America/Chicago
date 2025-01-21
rstudio 2024.12.0+467 Kousa Dogwood (desktop)
pandoc 3.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/
─ Packages ────────────────────────────────────────────────────────────────────
Main packages used:
arrow (14.0.0.2), car (3.1-2), coxme (2.2-18.1), data.table (1.14.8), devtools (2.4.5),
dplyr (1.1.2), ggplot2 (3.4.2), ggpubr (0.6.0), lme4 (1.1-34), multcomp (1.4-25),
MuMIn (1.48.4), patchwork (1.2.0), survival (3.5-5), survminer (0.4.9), viridis (0.6.3)
