Skip to content

Code for the manuscript: "Analysis of behaviour in the Active Allothetic Place Avoidance task based on cluster analysis of the rat movement motifs"

License

Notifications You must be signed in to change notification settings

RodentDataAnalytics/code-aapa

Repository files navigation

code-aapa

Code for the manuscript: "Analysis of behaviour in the Active Allothetic Place Avoidance task based on cluster analysis of the rat movement motifs"

Analysis pipeline: Trajectories

The script exeAll.m runs the whole analysis.

Part 1: Full trajectories analysis (part1_rawData)

This part of the analysis loads the raw trajectory data and generates full_paths.mat which contains all the necessary info of each trajectory. Then it computes the set of features for all the trajectories feature_values_paths.mat. Finally a visual of each trajectory is generated.

Part 2: Segmentation on shock sector (part2_shockSegmentation)

Using the full_paths.mat the full trajectories are segmented on entrances and exists to the shock sector (i.e. the parts of the trajectories inside the shock sector are discarded). Short segments for which the timestamp between start and ending points are less the 5 seconds are discarded; results are stored in segmentation_shock.mat. For each segment the set of features is computed (feature_values_shock.mat). Finally a visual of each segment is generated.

Part 3: Subsegmentation on speed change (part3_subSegmentation)

Using the segmentation_shock.mat the segmented trajectories paths are segmented further based on sudden changes of the angular speed. Points of each segment are processed sequentially and added to a sub-segment until the difference between the local and median angular speed of the sub-segment (recomputed for each new added point) exceeds ds = 0.6 rad/s (default); short segments for which the timestamp between start and ending points are less the dt = 5 seconds (default) are discarded. The results are stored inside a different subfolder with name subsegmentation. Different subsegmentations can be generated by changing ds and dt which are stored in the subfolder as subseg_%ds_%dt.mat. The intervals for these parameters are (start,step,finish): dt = 2:1:7, ds = 0.3:0.1:0.8. For each subsegmentation the set of features is computed and stored inside the subfolder feature_values_subsegments as subseg_%ds_%dt.mat.

Subsegments clustering

For each subsegmentation the following clustering methodologies: clustering with MPCK-Means, K-Means initialised with DK-Means++ (km) and Sparse K-Means initialised with DK-Means++ (skm). Results are stored in subfolders as follows \clustering_subsegments+ (_km or _skm) \subseg_%ds_%dt.mat. Each mat file contains the struct array cl_results that has 9 rows (number of clusters k = 2 to 10 with step 1) and 11 columns (original 11 features, principal compoments pc = 2 to 11 with step 1). Each element of the array is a struct containing clustering results (refer to the field names of the struct). For the Sparse K-Means the sparsity parameter s in calculated in the interval 1.1:0.2:sqrt(dimensionality). For that latter method the different results are saved in the same struct format but each field value contains a cell array where each element is a clustering based on a different value for s. Code for each clustering is available in the files: clTiago.m (MPCK-Means), clDKMeans.m (km) and clDSKMeans.m (skm). This code also generates figures similar to Figure 2 of the paper.

Other scripts

full_paths_stats.m: generates Figure 1 of the paper.

TODO: explain/fix scripts for R code, GUI, Figure 3.

subsegment_stats.ods

Classes in sheets, top tables-control, bottom tables-treated, rows-animals, columns-days, final numbers are total sums of segments numbers.

About

Code for the manuscript: "Analysis of behaviour in the Active Allothetic Place Avoidance task based on cluster analysis of the rat movement motifs"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •