Title: | Pain Assessment at Withdrawal Speeds (PAWS) |
---|---|
Description: | Automated pain scoring from paw withdrawal tracking data. Based on Jones et al. (2020) "A machine-vision approach for automated pain measurement at millisecond timescales" <doi:10.7554/eLife.57258>. |
Authors: | Colin Twomey [aut, cre], Jessica Jones [aut], William Foster [aut], Joshua Plotkin [aut], Ishmail Abdus-Saboor [aut] |
Maintainer: | Colin Twomey <[email protected]> |
License: | GPL-3 |
Version: | 1.0.3 |
Built: | 2025-03-11 03:14:32 UTC |
Source: | https://github.com/cran/pawscore |
Create a new pain model based on a set of paw features, corresponding pain stimuli, and corresponding strain identity.
create_pain_model( paw.features, strains = NULL, pain.stimulus = NULL, strain.standards = jones2020.standards, feature.set = c("post.peak", "pre.peak") )
create_pain_model( paw.features, strains = NULL, pain.stimulus = NULL, strain.standards = jones2020.standards, feature.set = c("post.peak", "pre.peak") )
paw.features |
the paw features returned by
|
strains |
a vector containing strain information for each mouse |
pain.stimulus |
a vector containing stimulus information for each mouse |
strain.standards |
z-scores (centering and scaling) information by strain |
feature.set |
use either pre-peak or post-peak features |
pain model
Creates a new reference centering and scaling for the paw features of the given strain or strains.
create_strain_standard(paw.features, strain)
create_strain_standard(paw.features, strain)
paw.features |
list of extracted paw features |
strain |
character string or a vector of strain names, each of which is a character string, matching in length and order the list of paw features. |
list of pre-peak and post-peak strain standards, indexed by strain
Default parameters for extracting paw features
default_parameters()
default_parameters()
parameters used for Jones et al. (2020)
Default strain-based standards for paw features
default_standards()
default_standards()
standards used for Jones et al. (2020)
Extract features for paw time series
extract_features( x, y = NULL, parameters = default_parameters(), diagnostics = FALSE )
extract_features( x, y = NULL, parameters = default_parameters(), diagnostics = FALSE )
x |
time series of horizontal paw movement. Alternatively, a two column matrix of x and y time series, respectively. |
y |
time series of vertical paw movement, or NULL if x is a two column matrix. |
parameters |
contains information about frames per second,
filtering, windowing, and thresholds, for paw features
(see |
diagnostics |
set to TRUE will record intermediate values used when computing paw features. This information can be helpful for debugging parameter choices. The default, FALSE, is to not record these values. |
pre-peak and post-peak paw features (plus diagnostics, if enabled)
# example usage with a track from Jones et al. (2020) track <- jones2020.tracks[[1]] features <- extract_features(track$time.series)
# example usage with a track from Jones et al. (2020) track <- jones2020.tracks[[1]] features <- extract_features(track$time.series)
Paw trajectory time series, strain, and stimulus information for the cohort 1 data used in Jones et al.
jones2020.tracks
jones2020.tracks
A list of paw trajectories, each containing:
id
A unique id for each mouse
strain
The corresponding mouse strain
stimulus
The stimulus used
time.series
The paw trajectory when stimulus was applied
Jones et al. (2020) A machine-vision approach for automated pain measurement at millisecond timescales. eLife 9:e57258 doi:10.7554/eLife.57258
Convenience function to convert pain scores to binary or trinary pain classifications, e.g. pain / non-pain or pain / low-pain / high-pain. Note that trinary classifications are only valid for pain models fit with trinary classes (e.g. Jones et al. 2020). Otherwise the scale of the score is arbitrary, and the boundary between low and high pain is not scaled to be 1.
pain_class(score, type = c("binary", "trinary"))
pain_class(score, type = c("binary", "trinary"))
score |
pain scores generated by |
type |
binary or trinary (ternary) pain classifications |
one or more pain classes
Returns a pain score based on Jones et al. 2020 or the given pain.model. Pain scores are standardized so that increasingly positive (negative) values correspond to increasingly likely to be painful (unlikely to be painful) experiences. Pain scores based on pain models derived from trinary pain stimuli will additionally be scaled such that the transition between low and high pain is occurs at 1. Scores are not comparable across pain models.
pain_score( paw.features, strains = NULL, strain.standards = jones2020.standards, feature.set = c("post.peak", "pre.peak"), pain.model = NULL )
pain_score( paw.features, strains = NULL, strain.standards = jones2020.standards, feature.set = c("post.peak", "pre.peak"), pain.model = NULL )
paw.features |
the paw features returned by
|
strains |
a vector containing strain information for each mouse |
strain.standards |
z-scores (centering and scaling) information by strain |
feature.set |
use either pre-peak or post-peak features |
pain.model |
a pain model returned by |
one or more pain scores as a vector
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.
Convenience function for changing parameters
set_parameters(..., based.on = default_parameters())
set_parameters(..., based.on = default_parameters())
... |
name and value of parameters to set (e.g. fps=1500) |
based.on |
an existing complete set of parameters to modify
(see |
the modified list of parameters