DOI: 10.5061/dryad.mgqnk9989
title: Data and code from: Computational analyses of dynamic visual courtship display reveal diet-dependent male signaling in <em>Rabidosa rabida</em> wolf spiders

description: Male courtship signals exhibit significant variation influenced by
 genetic, environmental, and ecological factors. Investigating the
 evolutionary significance of the variations in the complex male courtship
 signals, which often consist of multiple components with distinct
 functions, requires clear identification and quantification of their
 structural organization. Traditional, manually defined ethograms can be
 subjective and inconsistent, even with the knowledge and experience of
 trained experts, leading to challenges in reproducible and consistent
 comparative analysis. To address these limitations, this study
 investigates the impact of diet manipulation on the dynamic visual
 components of multimodal courtship displays in male Rabidosa rabida wolf
 spiders. By adopting a bottom-up ethogram using the Gaussian Hidden Markov
 Model (GHMM) and employing both unary and binary similarity measures, we
 aim to develop automated tools for behavior annotation and quantitatively
 compare dynamic visual components (i.e., foreleg movements) during male
 courtship. We revealed that (i) the structural organization of foreleg
 movements defined by the GHMM is comparable to the previously described by
 human observers, (ii) combining unary similarity measures with binary
 similarity measures is a powerful approach for animal communication
 studies, and (iii) previous foraging history of males influence the
 morphology and movement of forelegs during the multimodal courtship
 signals of R. rabida males. Our findings will enhance our understanding of
 the evolution of complex male courtship signals by providing a
 standardized framework for future research.
description: # Computational analyses of the courtship dance of male wolf spiders * 4
 JupyterLab Notebooks, 1 R code, 2 CSV files, and 1 zip file are included.
 ## Supplementary_materials_S2: JupyterLab Notebooks 1. 0_train_GHMM.ipynb
 * train and verify the Gaussian Hidden Markov model * require the
 following packages * numpy, pandas, seaborn, matplotlib, math, umap,
 scipy, sklearn, graphviz, hmmlearn 1. 1_segmentation.ipynb * converting
 the continuous foreleg movements into lists of segments of the hidden
 states revealed by the GHMM. * require the following packages * numpy,
 pandas, seaborn, matplotlib, math, itertools, sklearn, hmmlearn 1.
 2_clustering.py * clustering visual displays using Dynamic Time Warping
 and hierarchical clustering * require the following packages * umap,
 hdbscan, pickle, pandas, numpy, Bio, scipy, pyts, itertools, collections
 1. 3_motif_discovery.py * finding motifs in the sequence of hidden states
 of male foreleg movements * require the following packages * umap,
 hdbscan, pickle, pandas, numpy, tensorflow, seaborn, matplotlib, random ,
 re, collection, seaborn ## R script 1. rabidosa_analysis.R * R script for
 statistical analysis ## dataset (.csv) 1. total_raw.csv * dataset for
 reproducing analysis in Jupyterlab Notebooks * total_raw.csv contains 41
 columns * id: id of males * diet: diet treatment (H: High-diet, L:
 Low-diet) * frame: the number of frames * x_1 ~ x_8: x coordinates of each
 feature * y_1 ~ y_8: y coordinates of each feature * Feature id * 1
 (InsertLeg) * 2 (Pedi1) * 3 (Pedi2) * 4 (FemPatJoint) * 5 (PatTibJoint) *
 6 (TibMetJoint) * 7 (MetTarJoint) * 8 (LegTip) * d_1 ~ d_8: the distance
 from the origin to each feature * angle_1 ~ angle_8 (degree): the angle
 between x-axis to each feature * ang_fp ~ ang_p2 (degree): angle between
 leg segments * fp: femur (coxa-femur) and patella * pt: patella and tibia
 * tm: tibia and metatarsus * mt: metatarsus and tarsus * p1: pedipalp 1
 (closer to the observer) * p2: pedipalp 2 (further from the observer) 1.
 Rabidosa_signal_comparison.csv * dataset to reproduce the analysis by R
 script * rabidosa_signal_comparison.csv contains 43 columns * id: id of
 males * diet: diet treatment (H: High-diet, L: Low-diet) * mated: the
 mating success of the males from the previous experiment (y: yes, n: no) *
 m_weight: male weight * f_weight: visual stimuli female weight *
 total_bout: the number of courtship signal bouts that males produced *
 bout_no: the order of selected bouts for the analysis * tot_dr: total
 duration of the selected bout * unique_state_tot: the number of unique
 GHMM state in the bout * lz_norm_tot: Normalized Lempel-Ziv complexity of
 the selected bout * ent_tot: Shannon entropy of the selected bout *
 ent_rate_tot: Entropy rate of the selected bout * st_dr: Duration of the
 stationary phase * la_dr: Duration of the leg-arching phase * le_dr:
 Duration of the leg-extension phase * n_la: number of leg-arching behavior
 * r_la: rate of the leg-arching behavior (/second) * n_le: number of
 leg-extension behavior * r_le: rate of the leg-extension behavior
 (/second) * unique_state_la: the number of unique GHMM state during the
 leg-arching phase * lz_norm_la: Normalized Lempel-Ziv complexity of the
 selected bout during the leg-arching phase * ent_la: Shannon entropy of
 the selected bout during the leg-arching phase * ent_rate_la: Entropy rate
 of the selected bout during the leg-arching phase * unique_state_le: the
 number of unique GHMM state during the leg-extension phase * lz_norm_le:
 Normalized Lempel-Ziv complexity of the selected bout during the
 leg-extension phase * ent_le: Shannon entropy of the selected bout during
 the leg-extension phase * ent_rate_le: Entropy rate of the selected bout
 during the leg-extension phase * tot_pp: the number of pedipalpal
 movements during a whole bout * num_pp_st: the number of pedipalpal
 movements during the stationary phase * num_pp_la: the number of
 pedipalpal movements during the leg-arching phase * num_pp_le: the number
 of pedipalpal movements during the leg-extension phase * st_prop_{n}: the
 proportion of each hidden state of GHMM in a bout (state from 0 to 9) *
 agg_label: predicted labels by agglomerative (hierarchical) clustering ##
 Supplementary_material_S4.zip: gif. files * The zip file contains the gif
 files to visualize the foreleg movements of individual males
 ({male_id}.gif) * The gif files are grouped by leg-arching/leg-extension
 -&gt; motifs that are discovered.