Automated pain scoring from paw withdrawl tracking data based on Jones et al. (2020) A machine-vision approach for automated pain measurement at millisecond timescales. This R package takes paw trajectory data in response to a stimulus and provides an automated scoring of pain.
Using the devtools package (the first line can be skipped if devtools is already installed), in R run:
install.packages("devtools")
devtools::install_github("crtwomey/paws")
To compile from the commandline, cd to the parent directory of the paws repository and run
$ R CMD build paws
$ R CMD install paws_1.0.0.tar.gz
The package documentation explains the three main functions: extract_features, pain_score, and pain_class. A simple example is shown here using paw trajectory data from Jones et al., which is included with the package as jones2020.tracks.
# compute features for Jones et al. (2020) paw trajectories
paw.features <- lapply(jones2020.tracks, function(track) {
extract_features(track$time.series)
})
# get strain information for each track
strains <- sapply(jones2020.tracks, function(track) track$strain)
# compute pain scores
scores <- pain_score(paw.features, strains=strains)
Plotting the kernel density estimates of score distributions by stimulus (excluding strain SJL; see the paper) reproduces Fig. 4I of Jones et al.
Please cite Jones et al. (2020) and include a link to this repository if you use this code in an academic publication.
Testing, bug reports, and code contributions very welcome.
Copyright (c) 2019, 2020 Colin Twomey. Shared under a GNU GPLv3 license (see COPYING).