Skip to contents

This function is used to run PAWS analysis either in a custom script or in the dashboard. paws_analysis will use custom parameters to group all tracked data into a single CSV containing pre- and post-peak metrics.

Usage

paws_analysis(
  csv_directory,
  save_directory,
  p_cutoff = 0.3,
  manual_scale_factor = NA,
  filter_chosen = "average",
  filter_length = 11,
  reference_distance = 40,
  stims = c("cb", "db", "lp", "hp"),
  body_parts = c("toe", "center", "heel"),
  reference_points = c("objecta", "objectb"),
  groups,
  fps = 2000,
  window_threshold = 0.5,
  fixed_baseline = 3,
  y_threshold = 1.5,
  shake_threshold = 0.35,
  savgol_filter_smoothing_multiplier = 3,
  expanded_analysis = FALSE,
  stimulus_velocity_factor = 0.0798,
  stimulus_displacement_factor = 0.17
)

Arguments

csv_directory

Path to the folder containing individual tracked CSVs.

save_directory

Path to the folder where PAWS output file should be saved.

p_cutoff

The confidence value at which all tracked points below this threshold are replaced by linear interpolation between two higher-confidence points.

manual_scale_factor

The 'real-world-length' to pixel conversion factor (i.e. millimeters/pixel). If you are using two reference points, you can ignore this parameter.

filter_chosen

The filter chosen to smooth tracked trajectories. Options are "none", "savitzky-golay", "median", or "average" (average recommended)

reference_distance

The 'real-world-length' between your reference objects (can be in mm, cm, etc). If you indicate a manual_scale_factor, this setting will be overrided by that factor.

stims

The word/acronym you use to indicate stimulation type in your tracked CSVs. If you have a set of tracked CSVs with dynamic brush and light pinprick stimulations (named DB_1.csv and LP_2.csv), set stims to c("DB", "LP"). This parameter enables PAWS to automatically and adaptively group scored data by stimulus in the final output file, so you don't have to.

body_parts

The names of the body-part(s) you wish to score using PAWS. If you label the paw with body-parts "toe," "center," and "heel," you should set body_parts to c("toe", "center", "heel").

reference_points

The names of the two reference points you wish to use to adaptively scale videos to their appropriate real-world dimensions. If you do not choose to have reference points (and instead wish to apply a manual scale factor to every video), you can ignore this setting.

groups

The names of the groups you wish to separate out (based on the filenames of the CSVs you provide). This parameter enables PAWS to automatically and adaptively group scored data by experimental group in the final output file, so you don't have to.

fps

The frames per second of your set of CSVs

window_threshold

The threshold to examine a given window of tracking activity for a withdrawal behavior. Higher values apply a more conservative window threshold.

fixed_baseline

The height (in units of choice) above the lowest y-axis position of the paw, used to determine the baseline for activity. the y_threshold parameter is used to set a baseline for this level of activity.

y_threshold

The threshold (in units of choice) above the fixed baseline at which the start and end time-points of activity are determined.

shake_threshold

The threshold to examine a given window of tracking activity for shaking behaviors. Higher values apply a more conservative shaking threshold (Tip: if shake segmentation does not match what you see in a video, you can fine-tune the threshold to match your observations).

expanded_analysis

Whether or not to export additional PAWS metrics (t-star, withdrawal latency) alongside the usual pain score metrics.

stimulus_velocity_factor

The 'b' term in a*sin(b(x - c)) + d used to fit the stimulus sine function.

stimulus_displacement_factor

The 'c' term in a*sin(b(x - c)) + d -- number of seconds after video starts until the stimulus contacts the paw.

Value

A single CSV grouped by both stimulus and experimental group, containing PAWS metrics for each body-part.