Companion Data Page

MARGO (Massively Automated Real-time GUI for Object-tracking),
a platform for high-throughput ethology


Zach Werkhoven, Chuan Qin, Christian Rohrsen, Björn Brembs, and Benjamin de Bivort

Department of Organismic and Evolutionary Biology, Harvard University, Cambridge, MA 02138, USA.
Institut für Zoologie - Neurogenetik, Universität Regensburg, Regensburg, Germany

** Corresponding author: debivort@oeb.harvard.edu


Data files (MATLAB 2016a)

Download a .zip of all these data files.
noise_injection_error_data.mat Contains two data arrays from tracking following manual noise injection. Cen_error is a number of frames by number of noise levels matrix of frame to frame error. Noise_level is an ordered one by number of noise levels array of probabilities of converting any given pixel of the threshold image to TRUE. Columns of cen_error are organised by increasing noise level. Data can be visualized with plot_mean_injection_error.m.
reference_shift_simulation_data.mat Contains data from the background reference shifting simulation. Summary of items:
  • raw_cen - x,y trace data from ground truth
  • shift_cen - x,y trace data from background shifting
  • shift_int - interval between shift events (frames)
  • shift_idx - frame indices of shift events
  • ifi - mean interframe interval (seconds)
Data can be visualized with reference_shift_triggered_averaging.m.
margo_ctrax_comparison_centroids.mat Contains tracking data from the same video tracked in both Ctrax and MARGO. Summary of items:
  • ctrax_x - (1 x nFlies) cell array of x-centroid data obtained with Ctrax
  • ctrax_y - (1 x nFlies) cell array of y-centroid data obtained with Ctrax
  • margo_x - (1 x nFlies) cell array of x-centroid data obtained with MARGO
  • margo_y - (1 x nFlies) cell array of y-centroid data obtained with MARGO
Data can be visualized with calculate_margo_to_ctrax_error.m.
LED_ymaze_individual_trial_data.mat Contains individual phototaxis and handedness biases grouped by whether the light stimulus occured to the right or left of the maze choice point. Summary of items:
  • nTrials - (1 x nFlies) number of trials for each fly
  • p_LR - (1 x nFlies) probabilities p(light_choice|light_on_right)
  • p_LL - (1 x nFlies) probabilities p(light_choice|light_on_left)
  • p_RL - (1 x nFlies) probabilities p(right_choice|light_on_right)
  • p_RD - (1 x nFlies) probabilities p(right_choice|light_on_left)
  • side_mat - (nTrials x nFlies) matrix of lit side relative to the starting point.
    Right = 1, Left = -1, No turn = 0
Data can be visualized with LED_ymaze_plot_pairdots.m.
optomotor_individual_data.mat Contains individual trial triggered averages of optomotor data. Summary of items:
  • numTrials - (1 x nExperiments) cell array of arrays w/ individual trial numbers for each experiment
  • delta_ang - (1 x nExperiments) cell array of arrays w/ individual trial triggered average change in body angle for a single experiment
  • delta_rad - (1 x nExperiments) cell array of arrays w/ individual trial triggered average change in normalize radial position for a single experiment
  • trial_t - (1 x nExperiments) cell array of trial-relative time stamps of for each experiment
Data can be visualized with plot_trial_triggered_averages_opotomotor.m.
optomotor_bootstrap_data.mat Contains individual trial triggered averages of optomotor data. Summary of items:
  • numTrials - (1 x nExperiments) cell array of arrays w/ individual trial numbers for each experiment
  • raw_delta - (1 x nExperiments) cell array of arrays of total angular distance traveled in each trial
  • stim_delta - (1 x nExperiments) cell array of arrays of total angular distance traveled in the direction of stimulus rotation in each trial
single_roi_sample Sample video of a single roi at low resolution (31 x 31 pixel). Note: this sample was used in conjuction with tile_single_roi_vid.m to generate a sample video with thousands of ROIs for frame rate.
optogenetic_speed_distributions Contains a struct of individual mean speed data distributions split by condition and time blocks from the optogenetic speed reinforcement paradigm. Summary of items:
  • by_time_block - struct of speed data split by time block
    • data - (1 x nBlocks) cell array individual mean speeds per experimental group and time block
    • labels - (1 x nBlocks) cell array of condition/time block labels for columns in data
  • by_condition - struct of speed data split by reinforcement condition
    • data - (1 x nBlocks) cell array individual mean speeds per experimental group and condition
    • labels - (1 x nBlocks) cell array of condition/group labels for columns in data
optogenetic_speed_traces Contains a struct of speed trace data from the optogenetic speed reinforcement paradigm. Summary of items:
  • data - (nGenotypes x 1) cell array of individual speed traces (nFrames x nFlies)
  • frame_labels - (nGenotypes x 1) cell array of frame labels by reinforcement paradigm (nFrames x 1)
  • labels - (nGenotypes x 1) cell array of genotype labels
  • frame_label_key - (nParadigms x 1) lookup table for frame to frame labels by reinforcement paradigm
optogenetic_ymaze_data Contains structs of ymaze distributions from the optogenetic Y-maze reinforcement paradigm. Summary of items:
  • occ_int_gr66 - struct of Gr66a occupancy distributions and labels split by stimulation intensity
  • occ_freq_gr66 - struct of Gr66a occupancy distributions and labels split by stimulation frequency
  • occ_norpa_gr66 - struct of NorpA+Gr28bd occupancy distributions and labels split by ATR(-/+)
  • ent_int_gr66 - struct of Gr66a arm entry distributions and labels split by stimulation intensity
  • ent_freq_gr66 - struct of Gr66a arm entry distributions and labels split by stimulation frequency
  • ent_norpa_gr66 - struct of NorpA+Gr28bdarm entry distributions and labels split by ATR(-/+)
960_fly_meta_data Contains the ExperimentData object from the 960 high-throughput tracking demonstration. Summary of items:
  • expmt - ExperimentData object. See MARGO documentation for details.
raw_data_960_fly Contains binary raw data for centroids and time stamps from the 960 high-throughput tracking demonstration . Summary of items:
  • centroids.bin - (nFlies x [x,y] x nFrames) raw centroid coordinates in single floating point precision
  • time.bin - (nFrames x 1) raw time stamps formatted as inter-frame interval (in seconds) in single floating point precision

Analysis, simulation, and visualization functions and scripts (MATLAB 2016a)

Download a .zip of all these scripts and functions.
inject_image_noise.m plot_mean_injection_error.m Function: inject_image_noise.m

Description: converts each pixel of a binary image to TRUE at a uniform probabilty
Inputs:

  • thresh_im - binary threshold image for foreground segementation (foreground = TRUE)
  • noise_level - probability of converting any given pixel (0-1)

Outputs:

  • noise_im - binary threshold image with added noise

Script: plot_mean_injection_error.m

Description: plots total mean centroid error relative to a ground truth sample
Data: noise_injection_error_data.mat


Additional details in the top line comments
shift_reference.m reference_shift_triggered_averaging.m Function: shift_reference.m

Description: shifts the background reference image 2 pixels in a random direction
Inputs:

  • trackDat - Frame to frame tracking data (including bg reference)
  • expmt - MARGO ExperimentData meta data container

Outputs:

  • shifted bg reference (trackDat.ref.im)
  • time since reference shift (expmt.shift.t)
  • updated list of indices of frame shifts (expmt.shift.idx)

Script: reference_shift_triggered_averaging.m

Description: calculates and plots average tracking error triggered in a short (2s) window around the the reference shift. Error is calculated relative to a ground truth sample with the reference unshifted
Data: reference_shift_simulation_data.mat


Additional details in the top line comments
calculate_margo_to_ctrax_error.m Script: calculate_margo_to_ctrax_error.m

Description: calculates and aggregates the error between centroid coordinates obtained with MARGO and Ctrax. Plots a density estimate of the total error between the two samples.
Data: margo_ctrax_comparison_centroids.mat


Additional details in the top line comments
tile_single_roi_vid.m Function: tile_single_roi_vid.m

Description: replicates an sample video of a single ROI up to an M x N tiling
Inputs:

  • vid_path - file path to a single ROI sample video to tile. A sample is provided in (sample_roi_vid.avi)
  • ntiles - (1 x 2) array of M rows and N columns to tile the sample

Outputs:

  • saves the tiled video under the current directory in "tiled_roi_sample.avi"

Additional details in the top line comments
LED_ymaze_plot_pairdots.m Function: LED_ymaze_plot_pairdots.m

Description: plots LED Y-maze individual animal averages grouped by whether the light appeared to the right or left of the choice point
Data: LED_ymaze_individual_trial_data.mat


Additional details in the top line comments
generate_optomotor_null_model.m Script: generate_optomotor_null_model.m

Description: Creates an identical individuals null model distribution by bootstrapping all individual trial data
Data: optomotor_bootstrap_data.mat


Function: opto_bootstrap_all.m

Description: bootstrap resamples individual optomotor trial data up to the number of individuals in the observed data set (with randomly sampled observed trial numbers for each individual)
Inputs:

  • all_stim_delta - (nFlies) cell array of arrays of total angular distance traveled in the direction of stimulus rotation in each trial
  • all_raw_delta - (nFlies) cell array of arrays of total angular distance traveled in each trial

Outputs:

  • null_data - individual average optomotor indices from bootstrapped data
  • obs_data - individual average optomotor indices from observed data

Additional details in the top line comments
kde_plots_960_fly.m Script: kde_plots_960_fly.m

Description: Generate log speed kernel density estimates for individual flies process the speed data to regenerate the raw speed data and extract speed bouts.
Data: meta_data_960_fly.mat, raw_data_960_fly.zip


Additional details in the top line comments
raw_speed_plot_960_fly.m Script: raw_speed_plot_960_fly.m

Description: Generates summary representations from the raw speed data from the complete raw data found in '960_fly_raw_data.zip'.
Data: meta_data_960_fly.mat, raw_data_960_fly.zip


Additional details in the top line comments