1+ /* *
2+ * This module contains process definitions related to JABS classifiers.
3+ */
4+
5+ /* *
6+ * Calculates features for JABS classifiers.
7+ *
8+ * @param tuple
9+ * - video_file The input video file.
10+ * - in_pose The input pose file.
11+ *
12+ * @return tuple files
13+ * - Path to the original pose file.
14+ * - Path to the generated feature cache directory.
15+ */
116process GENERATE_FEATURE_CACHE {
217 // This process will correct pose pathing to a v6 file
318 label " jabs_classify"
@@ -23,6 +38,20 @@ process GENERATE_FEATURE_CACHE {
2338 """
2439}
2540
41+ /* *
42+ * Predicts behaviors using JABS classifiers.
43+ *
44+ * @param tuple
45+ * - in_pose The input pose file.
46+ * - feature_cache The directory containing the generated features.
47+ * @param classifiers A map of classifiers:
48+ * - <classifier_name>: classifier parameter maps (not used by this process)
49+ *
50+ * @return tuple files
51+ * - Path to the original pose file.
52+ * - Path to the feature cache directory.
53+ * - Path to the generated behavior file. All behavior predictions are stored in a single file.
54+ */
2655process PREDICT_CLASSIFIERS {
2756 label " jabs_classify"
2857 label " cpu"
@@ -46,25 +75,53 @@ process PREDICT_CLASSIFIERS {
4675 """
4776}
4877
78+ /* *
79+ * Generates behavior tables from pose file, feature file, and prediction file.
80+ *
81+ * @param tuple
82+ * - in_pose The input pose file.
83+ * - feature_cache The directory containing the generated features.
84+ * - behavior_files The behavior prediction file.
85+ * @param classifiers A map of classifiers:
86+ * - <classifier_name>: classifier parameter maps:
87+ * - stitch_value: the gap size for stitching behavior bouts
88+ * - filter_value: the minimum length for behavior bouts
89+ *
90+ * @return tuple files
91+ * - Path to the generated behavior bout file.
92+ * - Path to the generated behavior summary file.
93+ */
4994process GENERATE_BEHAVIOR_TABLES {
5095 label " jabs_postprocess"
5196 label " cpu"
5297 label " r_jabs_tablegen"
5398
5499 input:
55100 tuple path(in_pose), path(feature_cache), path(behavior_files)
56- val classifier
101+ val classifiers
57102
58103 output:
59104 tuple path(" ${ in_pose.baseName} *_bouts.csv" ), path(" ${ in_pose.baseName} *_summaries.csv" ), emit: files
60105
61106 script:
62107 """
63- behavior_command="--behavior ${ classifier .collect { entry -> "$entry.key --stitch_gap $entry.value.stitch_value --min_bout_length $entry.value.filter_value" }.join(' --behavior ')} "
108+ behavior_command="--behavior ${ classifiers .collect { entry -> "$entry.key --stitch_gap $entry.value.stitch_value --min_bout_length $entry.value.filter_value" }.join(' --behavior ')} "
64109 python3 /JABS-postprocess/generate_behavior_tables.py --project_folder . --feature_folder . --out_prefix ${ in_pose.baseName} --out_bin_size 5 \$ {behavior_command}
65110 """
66111}
67112
113+ /* *
114+ * Generates heuristic classifier predictions.
115+ *
116+ * @param tuple
117+ * - in_pose The input pose file.
118+ * - feature_cache The directory containing the generated features.
119+ * @param heuristic_classifiers A list of heuristic classifier configuration files.
120+ *
121+ * @return tuple files
122+ * - Path to the generated bout file.
123+ * - Path to the generated summary file.
124+ */
68125process PREDICT_HEURISTICS {
69126 label " jabs_postprocess"
70127 label " cpu"
@@ -87,6 +144,14 @@ process PREDICT_HEURISTICS {
87144 """
88145}
89146
147+ /* *
148+ * Converts a behavior summary table to features.
149+ *
150+ * @param in_summary_table The input behavior summary table.
151+ * @param bin_size The bin size for feature extraction.
152+ *
153+ * @return features The generated feature file.
154+ */
90155process BEHAVIOR_TABLE_TO_FEATURES {
91156 label " jabs_table_convert"
92157 label " r_jabs_table_convert"
0 commit comments