autogaita 1.0.2__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {autogaita-1.0.2 → autogaita-1.0.3}/PKG-INFO +1 -1
- autogaita-1.0.3/autogaita/batchrun_scripts/group_dlcrun.py +206 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/group/group_1_preparation.py +7 -9
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/group/group_2_data_processing.py +14 -17
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/group/group_3_PCA.py +8 -10
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/group/group_4_stats.py +27 -14
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/group/group_main.py +7 -2
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/group/group_utils.py +18 -9
- autogaita-1.0.3/autogaita/gui/group_gui_config.json +114 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita.egg-info/PKG-INFO +1 -1
- {autogaita-1.0.2 → autogaita-1.0.3}/setup.py +1 -1
- autogaita-1.0.2/autogaita/batchrun_scripts/group_dlcrun.py +0 -108
- autogaita-1.0.2/autogaita/gui/group_gui_config.json +0 -41
- {autogaita-1.0.2 → autogaita-1.0.3}/LICENSE +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/README.md +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/__init__.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/__main__.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/batchrun_scripts/__init__.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/batchrun_scripts/dlc_multirun.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/batchrun_scripts/dlc_singlerun.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/batchrun_scripts/group_universal3Drun.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/batchrun_scripts/sleap_singlerun.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/batchrun_scripts/universal3D_multirun.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/batchrun_scripts/universal3D_singlerun.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/common2D/__init__.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/common2D/common2D_3_analysis.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/common2D/common2D_4_plots.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/common2D/common2D_constants.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/common2D/common2D_utils.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/dlc/__init__.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/dlc/dlc_1_preparation.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/dlc/dlc_2_sc_extraction.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/dlc/dlc_main.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/dlc/dlc_utils.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/group/__init__.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/group/group_5_plots.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/group/group_constants.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/__init__.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/dlc_gui.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/dlc_gui_config.json +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/first_level_gui_utils.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/gaita_widgets.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/group_gui.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/gui_constants.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/gui_utils.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/main_gui.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/sleap_gui.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/sleap_gui_config.json +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/universal3D_gui.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/universal3D_gui_config.json +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/window_2D_advanced_config.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/window_2D_columninfo.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/gui/window_2D_run_and_done.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/resources/__init__.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/resources/constants.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/resources/icon.icns +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/resources/icon.ico +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/resources/logo.png +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/resources/pic_to_demo_for_repo.png +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/resources/utils.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/sleap/__init__.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/sleap/sleap_1_preparation.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/sleap/sleap_2_sc_extraction.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/sleap/sleap_main.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/universal3D/__init__.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/universal3D/universal3D_1_preparation.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/universal3D/universal3D_2_sc_extraction.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/universal3D/universal3D_3_analysis.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/universal3D/universal3D_4_plots.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/universal3D/universal3D_constants.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/universal3D/universal3D_datafile_preparation.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/universal3D/universal3D_main.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita/universal3D/universal3D_utils.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita.egg-info/SOURCES.txt +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita.egg-info/dependency_links.txt +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita.egg-info/requires.txt +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/autogaita.egg-info/top_level.txt +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/setup.cfg +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/tests/__init__.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/tests/test_common2D_unit_3_main_analysis.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/tests/test_dlc_approval.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/tests/test_dlc_unit_1_preparation.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/tests/test_dlc_unit_2_sc_extraction.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/tests/test_group_approval.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/tests/test_group_unit.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/tests/test_universal3D_approval.py +0 -0
- {autogaita-1.0.2 → autogaita-1.0.3}/tests/test_universal3D_unit.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: autogaita
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: Automatic Gait Analysis in Python. A toolbox to streamline and standardise the analysis of kinematics across species after ML-based body posture tracking. Despite being optimised for gait analyses, AutoGaitA has the potential to be used for any kind of kinematic analysis.
|
|
5
5
|
Home-page: https://github.com/mahan-hosseini/AutoGaitA/
|
|
6
6
|
Author: Mahan Hosseini
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import autogaita
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def group_dlcrun():
|
|
5
|
+
"""
|
|
6
|
+
Batchrun script to run AutoGaitA Group for Results obtained with AutoGaitA DLC.
|
|
7
|
+
folderinfo & cfg dictionaries must be configured as explained in our documentation. See the "AutoGaitA without the GUI" section of our documentation for references to in-depth explanations to all dictionary keys (note that each key of dicts corresponds to some object in the AutoGaitA Group GUI)
|
|
8
|
+
"""
|
|
9
|
+
# folderinfo
|
|
10
|
+
# => Note that length of folderinfo's group_names & group_dirs lists determines how # many groups are compared.
|
|
11
|
+
# => Also note that indices must correspond (i.e., idx # 1's name will be used # for dataset stored in group_dir's idx 1)
|
|
12
|
+
folderinfo = {}
|
|
13
|
+
folderinfo["group_names"] = [
|
|
14
|
+
# ----------
|
|
15
|
+
# RM Dataset
|
|
16
|
+
# "5mm",
|
|
17
|
+
# "12mm",
|
|
18
|
+
# "25mm",
|
|
19
|
+
# -------
|
|
20
|
+
# Interaction Issue Dataset
|
|
21
|
+
# "Control",
|
|
22
|
+
# "Silenced",
|
|
23
|
+
# --------
|
|
24
|
+
# Testing Dataset
|
|
25
|
+
# "one",
|
|
26
|
+
# "two",
|
|
27
|
+
# --------
|
|
28
|
+
# Beam x Age for Manuscript
|
|
29
|
+
"3m_5mm",
|
|
30
|
+
"3m_12mm",
|
|
31
|
+
"3m_25mm",
|
|
32
|
+
"24m_5mm",
|
|
33
|
+
"24m_12mm",
|
|
34
|
+
"24m_25mm",
|
|
35
|
+
]
|
|
36
|
+
folderinfo["group_dirs"] = [
|
|
37
|
+
# --------------------------
|
|
38
|
+
# Full Dataset (39 subjects)
|
|
39
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Control Full",
|
|
40
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Silenced Full/",
|
|
41
|
+
# --------------------------
|
|
42
|
+
# Reduced Dataset (5 subjects)
|
|
43
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Control",
|
|
44
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Silenced/",
|
|
45
|
+
# --------------------------
|
|
46
|
+
# Testing Dataset
|
|
47
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/Group 1/",
|
|
48
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/Group 2/",
|
|
49
|
+
# --------------------------
|
|
50
|
+
# RM Dataset (example data in repo)
|
|
51
|
+
# "/Users/mahan/sciebo/PythonCode/gaita_repo/example data/5mm/Results/",
|
|
52
|
+
# "/Users/mahan/sciebo/PythonCode/gaita_repo/example data/12mm/Results/",
|
|
53
|
+
# "/Users/mahan/sciebo/PythonCode/gaita_repo/example data/25mm/Results/",
|
|
54
|
+
# --------------------------
|
|
55
|
+
# Beam x Age for Manuscript
|
|
56
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/5mm/9w",
|
|
57
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/12mm/9w",
|
|
58
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/25mm/9w",
|
|
59
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/5mm/104w",
|
|
60
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/12mm/104w",
|
|
61
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/25mm/104w"
|
|
62
|
+
]
|
|
63
|
+
folderinfo["results_dir"] = (
|
|
64
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/example_data_results/"
|
|
65
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Mahan Results/"
|
|
66
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/GroupResults/"
|
|
67
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/YoungOld3BeamsForPaper"
|
|
68
|
+
)
|
|
69
|
+
# cfg
|
|
70
|
+
cfg = {}
|
|
71
|
+
cfg["do_permtest"] = False # True
|
|
72
|
+
cfg["do_anova"] = True
|
|
73
|
+
cfg["permutation_number"] = 100
|
|
74
|
+
cfg["PCA_n_components"] = 0.9
|
|
75
|
+
cfg["PCA_custom_scatter_PCs"] = "1,3;2,3;2,3,4;;;;"
|
|
76
|
+
cfg["PCA_save_3D_video"] = False
|
|
77
|
+
cfg["PCA_bins"] = "" # "0-10,24,50-75"
|
|
78
|
+
cfg["stats_threshold"] = 0.05
|
|
79
|
+
cfg["plot_SE"] = True
|
|
80
|
+
cfg["color_palette"] = "inferno"
|
|
81
|
+
cfg["dont_show_plots"] = True
|
|
82
|
+
cfg["legend_outside"] = True
|
|
83
|
+
cfg["which_leg"] = "left"
|
|
84
|
+
cfg["anova_design"] = "RM ANOVA"
|
|
85
|
+
# cfg["anova_design"] = "Mixed ANOVA"
|
|
86
|
+
cfg["PCA_variables"] = [
|
|
87
|
+
# Beam x Age
|
|
88
|
+
"Nose x",
|
|
89
|
+
"Nose y",
|
|
90
|
+
"Ear base x",
|
|
91
|
+
"Ear base y",
|
|
92
|
+
"Front paw tao x",
|
|
93
|
+
"Front paw tao y",
|
|
94
|
+
"Wrist x",
|
|
95
|
+
"Wrist y",
|
|
96
|
+
"Elbow x",
|
|
97
|
+
"Elbow y",
|
|
98
|
+
"Lower Shoulder x",
|
|
99
|
+
"Lower Shoulder y",
|
|
100
|
+
"Upper Shoulder x",
|
|
101
|
+
"Upper Shoulder y",
|
|
102
|
+
"Iliac Crest x",
|
|
103
|
+
"Iliac Crest y",
|
|
104
|
+
"Hip x",
|
|
105
|
+
"Hip y",
|
|
106
|
+
"Knee x",
|
|
107
|
+
"Knee y",
|
|
108
|
+
"Ankle x",
|
|
109
|
+
"Ankle y",
|
|
110
|
+
"Hind paw tao x",
|
|
111
|
+
"Hind paw tao y",
|
|
112
|
+
"Tail base y",
|
|
113
|
+
"Tail center x",
|
|
114
|
+
"Tail center y",
|
|
115
|
+
"Tail tip x",
|
|
116
|
+
"Tail tip y",
|
|
117
|
+
"Hind paw tao Velocity",
|
|
118
|
+
"Hind paw tao Acceleration",
|
|
119
|
+
"Ankle Velocity",
|
|
120
|
+
"Ankle Acceleration",
|
|
121
|
+
"Knee Velocity",
|
|
122
|
+
"Knee Acceleration",
|
|
123
|
+
"Hip Velocity",
|
|
124
|
+
"Hip Acceleration",
|
|
125
|
+
"Iliac Crest Velocity",
|
|
126
|
+
"Iliac Crest Acceleration",
|
|
127
|
+
"Ankle Angle",
|
|
128
|
+
"Knee Angle",
|
|
129
|
+
"Hip Angle",
|
|
130
|
+
"Wrist Angle",
|
|
131
|
+
"Elbow Angle",
|
|
132
|
+
"Lower Shoulder Angle",
|
|
133
|
+
"Iliac Crest Angle",
|
|
134
|
+
"Ankle Angle Velocity",
|
|
135
|
+
"Ankle Angle Acceleration",
|
|
136
|
+
"Knee Angle Acceleration",
|
|
137
|
+
"Hip Angle Velocity",
|
|
138
|
+
"Hip Angle Acceleration",
|
|
139
|
+
"Wrist Angle Velocity",
|
|
140
|
+
"Wrist Angle Acceleration",
|
|
141
|
+
"Elbow Angle Velocity",
|
|
142
|
+
"Elbow Angle Acceleration",
|
|
143
|
+
"Lower Shoulder Angle Velocity",
|
|
144
|
+
"Lower Shoulder Angle Acceleration",
|
|
145
|
+
"Iliac Crest Angle Velocity",
|
|
146
|
+
"Iliac Crest Angle Acceleration",
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
# PREVIOUS TESTING FEATURES
|
|
150
|
+
# -----------------
|
|
151
|
+
# "Hind paw tao y",
|
|
152
|
+
# "Ankle y",
|
|
153
|
+
# "Knee y",
|
|
154
|
+
# "Ankle Angle",
|
|
155
|
+
# "Knee Angle",
|
|
156
|
+
# "Nose x",
|
|
157
|
+
# "Knee y",
|
|
158
|
+
# "Knee x",
|
|
159
|
+
# "Knee Velocity",
|
|
160
|
+
# "Knee Acceleration",
|
|
161
|
+
# "Knee Angle",
|
|
162
|
+
# "Knee Angle Velocity",
|
|
163
|
+
# "Knee Angle Acceleration",
|
|
164
|
+
# "Hip Angle",
|
|
165
|
+
]
|
|
166
|
+
cfg["stats_variables"] = [
|
|
167
|
+
# "Hind paw tao y",
|
|
168
|
+
# "Ankle y",
|
|
169
|
+
# "Knee y",
|
|
170
|
+
# "Ankle Angle",
|
|
171
|
+
# "Knee Angle",
|
|
172
|
+
# "Nose x",
|
|
173
|
+
# "Knee y",
|
|
174
|
+
# "Knee x",
|
|
175
|
+
# "Knee Velocity",
|
|
176
|
+
# "Knee Acceleration",
|
|
177
|
+
# "Knee Angle",
|
|
178
|
+
# "Knee Angle Velocity",
|
|
179
|
+
# "Knee Angle Acceleration",
|
|
180
|
+
# "Hip Angle",
|
|
181
|
+
# "Elbow Angle"
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
# Beam x Age
|
|
185
|
+
"Hip x",
|
|
186
|
+
"Hip y",
|
|
187
|
+
"Knee x",
|
|
188
|
+
"Knee y",
|
|
189
|
+
"Ankle x",
|
|
190
|
+
"Ankle y",
|
|
191
|
+
"Hind paw tao x",
|
|
192
|
+
"Hind paw tao y",
|
|
193
|
+
"Hind paw tao Velocity",
|
|
194
|
+
"Ankle Velocity",
|
|
195
|
+
"Knee Velocity",
|
|
196
|
+
"Ankle Angle",
|
|
197
|
+
"Knee Angle",
|
|
198
|
+
"Hip Angle"
|
|
199
|
+
]
|
|
200
|
+
# run
|
|
201
|
+
autogaita.group(folderinfo, cfg)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
# %% what happens if we just hit run
|
|
205
|
+
if __name__ == "__main__":
|
|
206
|
+
group_dlcrun()
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# %% imports
|
|
2
|
-
from autogaita.
|
|
2
|
+
from autogaita.resources.utils import write_issues_to_textfile
|
|
3
3
|
import os
|
|
4
4
|
import json
|
|
5
|
-
import numpy as np
|
|
6
5
|
import matplotlib.pyplot as plt
|
|
7
6
|
import seaborn as sns
|
|
8
7
|
|
|
@@ -110,7 +109,6 @@ def extract_cfg_vars(folderinfo, cfg):
|
|
|
110
109
|
|
|
111
110
|
group_names = folderinfo["group_names"]
|
|
112
111
|
group_dirs = folderinfo["group_dirs"]
|
|
113
|
-
results_dir = folderinfo["results_dir"]
|
|
114
112
|
|
|
115
113
|
# ................................ save_to_xls ...................................
|
|
116
114
|
save_to_xls = [None] * len(group_dirs)
|
|
@@ -143,7 +141,7 @@ def extract_cfg_vars(folderinfo, cfg):
|
|
|
143
141
|
save_to_xls[g] = False
|
|
144
142
|
if save_to_xls[g] is True:
|
|
145
143
|
print(sheet_type_mismatch_message)
|
|
146
|
-
write_issues_to_textfile(sheet_type_mismatch_message,
|
|
144
|
+
write_issues_to_textfile(sheet_type_mismatch_message, folderinfo)
|
|
147
145
|
# case 2: we found a xlsx file
|
|
148
146
|
elif os.path.exists(
|
|
149
147
|
os.path.join(
|
|
@@ -158,7 +156,7 @@ def extract_cfg_vars(folderinfo, cfg):
|
|
|
158
156
|
if save_to_xls[g] is False:
|
|
159
157
|
save_to_xls[g] = True
|
|
160
158
|
print(sheet_type_mismatch_message)
|
|
161
|
-
write_issues_to_textfile(sheet_type_mismatch_message,
|
|
159
|
+
write_issues_to_textfile(sheet_type_mismatch_message, folderinfo)
|
|
162
160
|
# test that at least 1 folder has valid results for all groups
|
|
163
161
|
if not valid_results_folders:
|
|
164
162
|
no_valid_results_error = (
|
|
@@ -168,7 +166,7 @@ def extract_cfg_vars(folderinfo, cfg):
|
|
|
168
166
|
+ "\nFix & re-run!"
|
|
169
167
|
)
|
|
170
168
|
print(no_valid_results_error)
|
|
171
|
-
write_issues_to_textfile(no_valid_results_error,
|
|
169
|
+
write_issues_to_textfile(no_valid_results_error, folderinfo)
|
|
172
170
|
# assign to our cfg dict after group loop
|
|
173
171
|
cfg["save_to_xls"] = save_to_xls
|
|
174
172
|
|
|
@@ -190,7 +188,7 @@ def extract_cfg_vars(folderinfo, cfg):
|
|
|
190
188
|
+ str(cfg["PCA_n_components"])
|
|
191
189
|
+ "\n Fix & re-run!"
|
|
192
190
|
)
|
|
193
|
-
write_issues_to_textfile(PCA_error_message,
|
|
191
|
+
write_issues_to_textfile(PCA_error_message, folderinfo)
|
|
194
192
|
raise ValueError(PCA_error_message)
|
|
195
193
|
if cfg["PCA_n_components"] < 2:
|
|
196
194
|
print(
|
|
@@ -217,7 +215,7 @@ def extract_cfg_vars(folderinfo, cfg):
|
|
|
217
215
|
+ "\n".join(list(set(duplicate_vars)))
|
|
218
216
|
)
|
|
219
217
|
print(PCA_duplicates_error_message)
|
|
220
|
-
write_issues_to_textfile(PCA_duplicates_error_message,
|
|
218
|
+
write_issues_to_textfile(PCA_duplicates_error_message, folderinfo)
|
|
221
219
|
cfg["PCA_variables"] = unique_PCA_vars
|
|
222
220
|
# check if PCA bin num is valid, two tests and 1 fix
|
|
223
221
|
# => note there is separate code that transforms this string input into an int-list
|
|
@@ -249,7 +247,7 @@ def extract_cfg_vars(folderinfo, cfg):
|
|
|
249
247
|
# so we just stop everything and help them fix it
|
|
250
248
|
if PCA_bins_error_message:
|
|
251
249
|
print(PCA_bins_error_message)
|
|
252
|
-
write_issues_to_textfile(PCA_bins_error_message,
|
|
250
|
+
write_issues_to_textfile(PCA_bins_error_message, folderinfo)
|
|
253
251
|
raise ValueError(PCA_bins_error_message)
|
|
254
252
|
# fix for users: remove first and last characters if not digits
|
|
255
253
|
while not cfg["PCA_bins"][0].isdigit():
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# %% imports
|
|
2
|
-
from autogaita.resources.utils import bin_num_to_percentages
|
|
3
|
-
from autogaita.group.group_utils import write_issues_to_textfile
|
|
2
|
+
from autogaita.resources.utils import bin_num_to_percentages, write_issues_to_textfile
|
|
4
3
|
import os
|
|
5
4
|
import pandas as pd
|
|
6
5
|
import numpy as np
|
|
@@ -95,7 +94,7 @@ def import_data(folderinfo, cfg):
|
|
|
95
94
|
tracking_software,
|
|
96
95
|
name,
|
|
97
96
|
which_leg,
|
|
98
|
-
|
|
97
|
+
folderinfo,
|
|
99
98
|
cfg,
|
|
100
99
|
)
|
|
101
100
|
df_dict[which_df][g] = final_df_checks_and_save_to_xls(
|
|
@@ -109,7 +108,7 @@ def import_data(folderinfo, cfg):
|
|
|
109
108
|
# test: is bin_num is consistent across our groups
|
|
110
109
|
# => if so, add it as well as one_bin_in_% to cfg
|
|
111
110
|
cfg["bin_num"] = test_bin_num_consistency(
|
|
112
|
-
df_dict["Normalised"], group_names,
|
|
111
|
+
df_dict["Normalised"], group_names, folderinfo
|
|
113
112
|
)
|
|
114
113
|
dfs = df_dict["Normalised"]
|
|
115
114
|
raw_dfs = df_dict["Original"]
|
|
@@ -147,7 +146,7 @@ def final_df_checks_and_save_to_xls(
|
|
|
147
146
|
return this_df
|
|
148
147
|
|
|
149
148
|
|
|
150
|
-
def test_bin_num_consistency(dfs, group_names,
|
|
149
|
+
def test_bin_num_consistency(dfs, group_names, folderinfo):
|
|
151
150
|
"""Tests if bin number of step-cycle normalisation is consistent across groups"""
|
|
152
151
|
# For this we use sc_breaks [i.e. the nan step-separators]) to see if bin_num is the
|
|
153
152
|
# same value across all individual step-cycles across all groups.
|
|
@@ -166,17 +165,15 @@ def test_bin_num_consistency(dfs, group_names, results_dir):
|
|
|
166
165
|
this_bin_num = sc_breaks[b] - sc_breaks[b - 1] - 1
|
|
167
166
|
if this_bin_num != bin_num:
|
|
168
167
|
bin_num_error_helper_function(
|
|
169
|
-
dfs, g, group_names, sc_breaks,
|
|
168
|
+
folderinfo, dfs, g, group_names, sc_breaks, b
|
|
170
169
|
)
|
|
171
170
|
# handle the last step-cycle of the df (it doesn't have a sc_break after it!)
|
|
172
171
|
if (len(dfs[g]) - sc_breaks[-1] - 1) != this_bin_num:
|
|
173
|
-
bin_num_error_helper_function(
|
|
174
|
-
dfs, g, group_names, sc_breaks, results_dir, b
|
|
175
|
-
)
|
|
172
|
+
bin_num_error_helper_function(folderinfo, dfs, g, group_names, sc_breaks, b)
|
|
176
173
|
return bin_num
|
|
177
174
|
|
|
178
175
|
|
|
179
|
-
def bin_num_error_helper_function(dfs, g, group_names, sc_breaks,
|
|
176
|
+
def bin_num_error_helper_function(folderinfo, dfs, g, group_names, sc_breaks, b):
|
|
180
177
|
"""Handle this error in a separate function for readability"""
|
|
181
178
|
id_col_idx = dfs[g].columns.get_loc(ID_COL)
|
|
182
179
|
message = (
|
|
@@ -189,11 +186,11 @@ def bin_num_error_helper_function(dfs, g, group_names, sc_breaks, results_dir, b
|
|
|
189
186
|
+ "\nPlease re-run & make sure all bin numbers match!"
|
|
190
187
|
)
|
|
191
188
|
print(message)
|
|
192
|
-
write_issues_to_textfile(message,
|
|
189
|
+
write_issues_to_textfile(message, folderinfo)
|
|
193
190
|
raise ValueError(message)
|
|
194
191
|
|
|
195
192
|
|
|
196
|
-
def test_PCA_and_stats_variables(df, group_name, name,
|
|
193
|
+
def test_PCA_and_stats_variables(df, group_name, name, folderinfo, cfg):
|
|
197
194
|
"""Tests if PCA & stats variables are present in all groups' datasets"""
|
|
198
195
|
PCA_variables = cfg["PCA_variables"]
|
|
199
196
|
stats_variables = cfg["stats_variables"]
|
|
@@ -215,7 +212,7 @@ def test_PCA_and_stats_variables(df, group_name, name, results_dir, cfg):
|
|
|
215
212
|
+ "\nPlease re-run & make sure all variables are present!"
|
|
216
213
|
)
|
|
217
214
|
print(PCA_variable_mismatch_message)
|
|
218
|
-
write_issues_to_textfile(PCA_variable_mismatch_message,
|
|
215
|
+
write_issues_to_textfile(PCA_variable_mismatch_message, folderinfo)
|
|
219
216
|
raise ValueError(PCA_variable_mismatch_message)
|
|
220
217
|
if stats_variables:
|
|
221
218
|
if not all(variable in df.columns for variable in stats_variables):
|
|
@@ -235,7 +232,7 @@ def test_PCA_and_stats_variables(df, group_name, name, results_dir, cfg):
|
|
|
235
232
|
+ "\nPlease re-run & make sure all variables are present!"
|
|
236
233
|
)
|
|
237
234
|
print(stats_variable_mismatch_message)
|
|
238
|
-
write_issues_to_textfile(stats_variable_mismatch_message,
|
|
235
|
+
write_issues_to_textfile(stats_variable_mismatch_message, folderinfo)
|
|
239
236
|
raise ValueError(stats_variable_mismatch_message)
|
|
240
237
|
|
|
241
238
|
|
|
@@ -247,7 +244,7 @@ def import_and_combine_dfs(
|
|
|
247
244
|
tracking_software,
|
|
248
245
|
name,
|
|
249
246
|
which_leg,
|
|
250
|
-
|
|
247
|
+
folderinfo,
|
|
251
248
|
cfg,
|
|
252
249
|
):
|
|
253
250
|
"""Import one run's df at a time and combine to group-level df"""
|
|
@@ -274,11 +271,11 @@ def import_and_combine_dfs(
|
|
|
274
271
|
+ ".\nSkipping!"
|
|
275
272
|
)
|
|
276
273
|
print(this_message)
|
|
277
|
-
write_issues_to_textfile(this_message,
|
|
274
|
+
write_issues_to_textfile(this_message, folderinfo)
|
|
278
275
|
else:
|
|
279
276
|
df_copy = df.copy()
|
|
280
277
|
# test: are our PCA & stats variables present in this ID's dataset?
|
|
281
|
-
test_PCA_and_stats_variables(df_copy, group_name, name,
|
|
278
|
+
test_PCA_and_stats_variables(df_copy, group_name, name, folderinfo, cfg)
|
|
282
279
|
# add some final info & append to group_df
|
|
283
280
|
if tracking_software == "DLC":
|
|
284
281
|
# add this run's info to df (& prepare Stepcycle column)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# %% imports
|
|
2
|
-
from autogaita.resources.utils import bin_num_to_percentages
|
|
3
|
-
from autogaita.group.group_utils import save_figures
|
|
2
|
+
from autogaita.resources.utils import bin_num_to_percentages, write_issues_to_textfile
|
|
3
|
+
from autogaita.group.group_utils import save_figures
|
|
4
4
|
import os
|
|
5
5
|
import string
|
|
6
6
|
import pandas as pd
|
|
@@ -33,7 +33,6 @@ def PCA_main(avg_dfs, folderinfo, cfg, plot_panel_instance):
|
|
|
33
33
|
"""PCA on features of interest"""
|
|
34
34
|
|
|
35
35
|
# unpack
|
|
36
|
-
results_dir = folderinfo["results_dir"]
|
|
37
36
|
PCA_custom_scatter_PCs = cfg["PCA_custom_scatter_PCs"]
|
|
38
37
|
PCA_bins = cfg["PCA_bins"]
|
|
39
38
|
|
|
@@ -58,7 +57,7 @@ def PCA_main(avg_dfs, folderinfo, cfg, plot_panel_instance):
|
|
|
58
57
|
+ "var-explained approach!"
|
|
59
58
|
)
|
|
60
59
|
print(PCA_error_message_1)
|
|
61
|
-
write_issues_to_textfile(PCA_error_message_1,
|
|
60
|
+
write_issues_to_textfile(PCA_error_message_1, folderinfo)
|
|
62
61
|
return
|
|
63
62
|
# plot barplot of cumulative explained variance
|
|
64
63
|
plot_PCA_barplot(PCA_info, folderinfo, cfg, plot_panel_instance)
|
|
@@ -96,7 +95,6 @@ def convert_PCA_bins_to_list(folderinfo, cfg):
|
|
|
96
95
|
for this
|
|
97
96
|
"""
|
|
98
97
|
# unpack
|
|
99
|
-
results_dir = folderinfo["results_dir"]
|
|
100
98
|
PCA_bins = cfg["PCA_bins"]
|
|
101
99
|
bin_num = cfg["bin_num"]
|
|
102
100
|
|
|
@@ -121,7 +119,7 @@ def convert_PCA_bins_to_list(folderinfo, cfg):
|
|
|
121
119
|
+ "\nPlease check your input and try again!"
|
|
122
120
|
)
|
|
123
121
|
print(PCA_bins_error_message)
|
|
124
|
-
write_issues_to_textfile(PCA_bins_error_message,
|
|
122
|
+
write_issues_to_textfile(PCA_bins_error_message, folderinfo)
|
|
125
123
|
raise ValueError(PCA_bins_error_message)
|
|
126
124
|
|
|
127
125
|
else:
|
|
@@ -143,7 +141,6 @@ def create_PCA_df(avg_dfs, folderinfo, cfg):
|
|
|
143
141
|
"""Create a ID x ID_COL + features dataframe to be used by PCA"""
|
|
144
142
|
|
|
145
143
|
# unpack
|
|
146
|
-
results_dir = folderinfo["results_dir"]
|
|
147
144
|
group_names = folderinfo["group_names"]
|
|
148
145
|
PCA_vars = cfg["PCA_variables"]
|
|
149
146
|
bin_num = cfg["bin_num"]
|
|
@@ -193,7 +190,7 @@ def create_PCA_df(avg_dfs, folderinfo, cfg):
|
|
|
193
190
|
+ "This should never happen, please contact me!"
|
|
194
191
|
)
|
|
195
192
|
print(critical_PCA_df_error_message)
|
|
196
|
-
write_issues_to_textfile(critical_PCA_df_error_message,
|
|
193
|
+
write_issues_to_textfile(critical_PCA_df_error_message, folderinfo)
|
|
197
194
|
raise ValueError(critical_PCA_df_error_message)
|
|
198
195
|
# add colnames after the last mouse (makes concat'ing series 2 df easier)
|
|
199
196
|
PCA_df.columns = [GROUP_COL] + [ID_COL] + features
|
|
@@ -259,7 +256,8 @@ def PCA_info_to_xlsx(PCA_df, PCA_info, folderinfo, cfg):
|
|
|
259
256
|
|
|
260
257
|
# add column headers
|
|
261
258
|
for pc in range(number_of_PCs):
|
|
262
|
-
|
|
259
|
+
# pdb.set_trace()
|
|
260
|
+
sheet.cell(row=1, column=pc + 2, value="PC " + str(pc + 1))
|
|
263
261
|
# add cell values: explained variance
|
|
264
262
|
sheet.cell(row=2, column=1, value="Explained Var. (%)")
|
|
265
263
|
for pc in range(number_of_PCs):
|
|
@@ -372,7 +370,7 @@ def plot_PCA_scatterplots(
|
|
|
372
370
|
+ "!\nThe PC you wanted was not computed by PCA!"
|
|
373
371
|
)
|
|
374
372
|
print(invalid_custom_PC_scatter_message)
|
|
375
|
-
write_issues_to_textfile(invalid_custom_PC_scatter_message,
|
|
373
|
+
write_issues_to_textfile(invalid_custom_PC_scatter_message, folderinfo)
|
|
376
374
|
return
|
|
377
375
|
# after the test we can overwrite "real" number of PCs of full PCA here since
|
|
378
376
|
# we only use this value to know if we also do a 3D plot or not from here on
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# %% imports
|
|
2
|
-
from autogaita.resources.utils import bin_num_to_percentages
|
|
2
|
+
from autogaita.resources.utils import bin_num_to_percentages, write_issues_to_textfile
|
|
3
3
|
from autogaita.group.group_utils import (
|
|
4
4
|
check_mouse_conversion,
|
|
5
5
|
save_figures,
|
|
6
6
|
ytickconvert_mm_to_cm,
|
|
7
7
|
ylabel_velocity_and_acceleration,
|
|
8
|
-
write_issues_to_textfile,
|
|
9
8
|
)
|
|
10
9
|
import os
|
|
11
10
|
import sys
|
|
@@ -16,7 +15,7 @@ import openpyxl
|
|
|
16
15
|
from sklearn.utils import shuffle
|
|
17
16
|
import matplotlib.pyplot as plt
|
|
18
17
|
from scipy import stats
|
|
19
|
-
import pingouin as pg
|
|
18
|
+
import pingouin as pg # important for ANOVAs!
|
|
20
19
|
|
|
21
20
|
# %% constants
|
|
22
21
|
from autogaita.resources.constants import INFO_TEXT_WIDTH, ID_COL, SC_PERCENTAGE_COL
|
|
@@ -489,11 +488,14 @@ def extract_all_clusters(trueobs_results_df, contrast):
|
|
|
489
488
|
|
|
490
489
|
# ............................... sanity check . ......................................
|
|
491
490
|
def anova_design_sanity_check(stats_df, folderinfo, cfg):
|
|
492
|
-
"""Sanity check the anova_design input of the user based on stats_df's IDs
|
|
491
|
+
"""Sanity check the anova_design input of the user based on stats_df's IDs
|
|
492
|
+
Note
|
|
493
|
+
----
|
|
494
|
+
This function also catches cases in which a user might have a 2-way design and just wants to run Tukeys (see below for 2-way #1 and #2)
|
|
495
|
+
"""
|
|
493
496
|
|
|
494
497
|
# unpack
|
|
495
498
|
anova_design = cfg["anova_design"]
|
|
496
|
-
results_dir = folderinfo["results_dir"]
|
|
497
499
|
|
|
498
500
|
# get IDs for each group to check if they are unique
|
|
499
501
|
group_IDs = stats_df.groupby("Group")["ID"].unique()
|
|
@@ -508,7 +510,7 @@ def anova_design_sanity_check(stats_df, folderinfo, cfg):
|
|
|
508
510
|
if anova_design == "Mixed ANOVA":
|
|
509
511
|
if len(ID_list) == len(unique_ID_list): # check passed
|
|
510
512
|
return True
|
|
511
|
-
else:
|
|
513
|
+
else: # 2-way #1 is caught here (non-unique IDs when Mixed)
|
|
512
514
|
mixed_anova_error_message = (
|
|
513
515
|
"\n*********\n! ERROR !\n*********\n"
|
|
514
516
|
+ "\nANOVA design seems wrong - skipping ANOVA!"
|
|
@@ -518,7 +520,7 @@ def anova_design_sanity_check(stats_df, folderinfo, cfg):
|
|
|
518
520
|
+ str(group_IDs)
|
|
519
521
|
)
|
|
520
522
|
print(mixed_anova_error_message)
|
|
521
|
-
write_issues_to_textfile(mixed_anova_error_message,
|
|
523
|
+
write_issues_to_textfile(mixed_anova_error_message, folderinfo)
|
|
522
524
|
return False
|
|
523
525
|
# RM ANOVA - IDs in each group must be the same!
|
|
524
526
|
elif anova_design == "RM ANOVA":
|
|
@@ -539,9 +541,12 @@ def anova_design_sanity_check(stats_df, folderinfo, cfg):
|
|
|
539
541
|
+ "analyses will be included in RM ANOVA:\n\n"
|
|
540
542
|
+ str(valid_IDs)
|
|
541
543
|
)
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
544
|
+
if valid_IDs:
|
|
545
|
+
print(rm_anova_info_message)
|
|
546
|
+
write_issues_to_textfile(rm_anova_info_message, folderinfo)
|
|
547
|
+
return True
|
|
548
|
+
else: # 2-way #2 here: not all IDs in all groups in a RM design
|
|
549
|
+
return False
|
|
545
550
|
else:
|
|
546
551
|
rm_anova_error_message = (
|
|
547
552
|
"\n*********\n! ERROR !\n*********\n"
|
|
@@ -552,13 +557,20 @@ def anova_design_sanity_check(stats_df, folderinfo, cfg):
|
|
|
552
557
|
+ str(group_IDs)
|
|
553
558
|
)
|
|
554
559
|
print(rm_anova_error_message)
|
|
555
|
-
write_issues_to_textfile(rm_anova_error_message,
|
|
560
|
+
write_issues_to_textfile(rm_anova_error_message, folderinfo)
|
|
556
561
|
return False
|
|
557
562
|
|
|
558
563
|
|
|
559
564
|
# ............................... main function ......................................
|
|
560
565
|
def ANOVA_main(
|
|
561
|
-
stats_df,
|
|
566
|
+
stats_df,
|
|
567
|
+
g_avg_dfs,
|
|
568
|
+
g_std_dfs,
|
|
569
|
+
stats_var,
|
|
570
|
+
just_do_tukeys,
|
|
571
|
+
folderinfo,
|
|
572
|
+
cfg,
|
|
573
|
+
plot_panel_instance,
|
|
562
574
|
):
|
|
563
575
|
"""Perform a two-way RM-ANOVA with the factors group (between or within) & SC
|
|
564
576
|
percentage (within) on a given dependent variable
|
|
@@ -570,9 +582,10 @@ def ANOVA_main(
|
|
|
570
582
|
# initialise text file
|
|
571
583
|
initial_stats_textfile(stats_var, anova_design, folderinfo)
|
|
572
584
|
|
|
573
|
-
# run the
|
|
585
|
+
# run the fully RM or Mixed ANOVA
|
|
574
586
|
# => note pingouin checks both or sphericity by default
|
|
575
|
-
|
|
587
|
+
if just_do_tukeys is False:
|
|
588
|
+
ANOVA_result = run_ANOVA(stats_df, stats_var, cfg)
|
|
576
589
|
|
|
577
590
|
# run Tukeys for pairwise comparisons
|
|
578
591
|
# => always running multiple comparison tests as well. see Prism's doc for why
|
|
@@ -13,7 +13,7 @@ from autogaita.group.group_4_stats import (
|
|
|
13
13
|
ANOVA_main,
|
|
14
14
|
)
|
|
15
15
|
from autogaita.group.group_5_plots import plot_results
|
|
16
|
-
from autogaita.group.group_utils import print_start
|
|
16
|
+
from autogaita.group.group_utils import print_start, tukeys_only_info_message
|
|
17
17
|
from autogaita.resources.utils import print_finish, PlotPanel
|
|
18
18
|
import matplotlib
|
|
19
19
|
import matplotlib.pyplot as plt
|
|
@@ -105,13 +105,18 @@ def group(folderinfo, cfg):
|
|
|
105
105
|
|
|
106
106
|
# .................................. ANOVA ...................................
|
|
107
107
|
if cfg["do_anova"]: # indentation since we check for stats-vars here too!
|
|
108
|
-
if anova_design_sanity_check(stats_df, folderinfo, cfg):
|
|
108
|
+
if anova_design_sanity_check(stats_df, folderinfo, cfg) is not True:
|
|
109
|
+
just_do_tukeys = True
|
|
110
|
+
tukeys_only_info_message(folderinfo)
|
|
111
|
+
else:
|
|
112
|
+
just_do_tukeys = False
|
|
109
113
|
for stats_var in cfg["stats_variables"]:
|
|
110
114
|
ANOVA_main(
|
|
111
115
|
stats_df,
|
|
112
116
|
g_avg_dfs,
|
|
113
117
|
g_std_dfs,
|
|
114
118
|
stats_var,
|
|
119
|
+
just_do_tukeys,
|
|
115
120
|
folderinfo,
|
|
116
121
|
cfg,
|
|
117
122
|
plot_panel_instance,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
|
-
|
|
3
|
-
from autogaita.resources.constants import
|
|
2
|
+
from autogaita.resources.utils import write_issues_to_textfile
|
|
3
|
+
from autogaita.resources.constants import INFO_TEXT_WIDTH
|
|
4
4
|
from autogaita.group.group_constants import (
|
|
5
5
|
GROUP_CONFIG_TXT_FILENAME,
|
|
6
6
|
PCA_CUSTOM_SCATTER_OUTER_SEPARATOR,
|
|
@@ -63,6 +63,11 @@ def print_start(folderinfo, cfg):
|
|
|
63
63
|
cfg["PCA_custom_scatter_PCs"] = cfg["PCA_custom_scatter_PCs"].replace(
|
|
64
64
|
" ", "" # remove spaces for user if they included them (not allowed!)
|
|
65
65
|
)
|
|
66
|
+
# string cannot end with the ; separator this will break later
|
|
67
|
+
while cfg["PCA_custom_scatter_PCs"].endswith( # in case users are funny
|
|
68
|
+
PCA_CUSTOM_SCATTER_OUTER_SEPARATOR
|
|
69
|
+
):
|
|
70
|
+
cfg["PCA_custom_scatter_PCs"] = cfg["PCA_custom_scatter_PCs"][:-1]
|
|
66
71
|
start_string += "\n\nCustom Scatterplot Configuration:"
|
|
67
72
|
for i, custom_scatter_PCs in enumerate(
|
|
68
73
|
cfg["PCA_custom_scatter_PCs"].split(PCA_CUSTOM_SCATTER_OUTER_SEPARATOR)
|
|
@@ -156,13 +161,17 @@ def ylabel_velocity_and_acceleration(feature, unit, sampling_rate):
|
|
|
156
161
|
|
|
157
162
|
|
|
158
163
|
# %% ........................ misc. helper functions .................................
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
def tukeys_only_info_message(folderinfo):
|
|
165
|
+
"""Inform user about the fact that we are only doing Tukeys due to our ANOVA sanity check failing"""
|
|
166
|
+
tukeys_only_info_message = (
|
|
167
|
+
"\n***********\n! WARNING !\n***********\n\n"
|
|
168
|
+
+ "Your ANOVA settings were wrong.This either happens because: \n 1) You ran "
|
|
169
|
+
+ "a one-way ANOVA with wrong inputs (there should be another message about "
|
|
170
|
+
+ "this) or \n 2) You attempted to run a two-way design which is not "
|
|
171
|
+
+ "supported yet.\nWe will run Tukey's test for multiple comparisons anyways."
|
|
172
|
+
)
|
|
173
|
+
print(tukeys_only_info_message)
|
|
174
|
+
write_issues_to_textfile(tukeys_only_info_message, folderinfo)
|
|
166
175
|
|
|
167
176
|
|
|
168
177
|
def check_mouse_conversion(feature, cfg, **kwargs):
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"group_names": [
|
|
4
|
+
"3m_5mm",
|
|
5
|
+
"3m_12mm",
|
|
6
|
+
"3m_25mm",
|
|
7
|
+
"",
|
|
8
|
+
"",
|
|
9
|
+
""
|
|
10
|
+
],
|
|
11
|
+
"group_dirs": [
|
|
12
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/5mm/9w",
|
|
13
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/12mm/9w",
|
|
14
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/25mm/9w",
|
|
15
|
+
"",
|
|
16
|
+
"",
|
|
17
|
+
""
|
|
18
|
+
],
|
|
19
|
+
"results_dir": "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/3m3BeamsForPaper"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"do_permtest": false,
|
|
23
|
+
"do_anova": true,
|
|
24
|
+
"anova_design": "RM ANOVA",
|
|
25
|
+
"permutation_number": "10000",
|
|
26
|
+
"stats_threshold": "0.05",
|
|
27
|
+
"which_leg": "right",
|
|
28
|
+
"PCA_n_components": "0.9",
|
|
29
|
+
"PCA_custom_scatter_PCs": "1,3;2,3;2,3,4;",
|
|
30
|
+
"PCA_save_3D_video": true,
|
|
31
|
+
"PCA_bins": "",
|
|
32
|
+
"plot_SE": true,
|
|
33
|
+
"color_palette": "inferno",
|
|
34
|
+
"dont_show_plots": false,
|
|
35
|
+
"legend_outside": true,
|
|
36
|
+
"stats_variables": [
|
|
37
|
+
"Hip x",
|
|
38
|
+
"Hip y",
|
|
39
|
+
"Knee x",
|
|
40
|
+
"Knee y",
|
|
41
|
+
"Ankle x",
|
|
42
|
+
"Ankle y",
|
|
43
|
+
"Hind paw tao x",
|
|
44
|
+
"Hind paw tao y",
|
|
45
|
+
"Hind paw tao Velocity",
|
|
46
|
+
"Ankle Velocity",
|
|
47
|
+
"Knee Velocity",
|
|
48
|
+
"Ankle Angle",
|
|
49
|
+
"Knee Angle",
|
|
50
|
+
"Hip Angle"
|
|
51
|
+
],
|
|
52
|
+
"PCA_variables": [
|
|
53
|
+
"Nose x",
|
|
54
|
+
"Nose y",
|
|
55
|
+
"Ear base x",
|
|
56
|
+
"Ear base y",
|
|
57
|
+
"Front paw tao x",
|
|
58
|
+
"Front paw tao y",
|
|
59
|
+
"Wrist x",
|
|
60
|
+
"Wrist y",
|
|
61
|
+
"Elbow x",
|
|
62
|
+
"Elbow y",
|
|
63
|
+
"Lower Shoulder x",
|
|
64
|
+
"Lower Shoulder y",
|
|
65
|
+
"Upper Shoulder x",
|
|
66
|
+
"Upper Shoulder y",
|
|
67
|
+
"Iliac Crest x",
|
|
68
|
+
"Iliac Crest y",
|
|
69
|
+
"Hip x",
|
|
70
|
+
"Hip y",
|
|
71
|
+
"Knee x",
|
|
72
|
+
"Knee y",
|
|
73
|
+
"Ankle x",
|
|
74
|
+
"Ankle y",
|
|
75
|
+
"Hind paw tao x",
|
|
76
|
+
"Hind paw tao y",
|
|
77
|
+
"Tail base y",
|
|
78
|
+
"Tail center x",
|
|
79
|
+
"Tail center y",
|
|
80
|
+
"Tail tip x",
|
|
81
|
+
"Tail tip y",
|
|
82
|
+
"Hind paw tao Velocity",
|
|
83
|
+
"Hind paw tao Acceleration",
|
|
84
|
+
"Ankle Velocity",
|
|
85
|
+
"Ankle Acceleration",
|
|
86
|
+
"Knee Velocity",
|
|
87
|
+
"Knee Acceleration",
|
|
88
|
+
"Hip Velocity",
|
|
89
|
+
"Hip Acceleration",
|
|
90
|
+
"Iliac Crest Velocity",
|
|
91
|
+
"Iliac Crest Acceleration",
|
|
92
|
+
"Ankle Angle",
|
|
93
|
+
"Knee Angle",
|
|
94
|
+
"Hip Angle",
|
|
95
|
+
"Wrist Angle",
|
|
96
|
+
"Elbow Angle",
|
|
97
|
+
"Lower Shoulder Angle",
|
|
98
|
+
"Iliac Crest Angle",
|
|
99
|
+
"Ankle Angle Velocity",
|
|
100
|
+
"Ankle Angle Acceleration",
|
|
101
|
+
"Knee Angle Acceleration",
|
|
102
|
+
"Hip Angle Velocity",
|
|
103
|
+
"Hip Angle Acceleration",
|
|
104
|
+
"Wrist Angle Velocity",
|
|
105
|
+
"Wrist Angle Acceleration",
|
|
106
|
+
"Elbow Angle Velocity",
|
|
107
|
+
"Elbow Angle Acceleration",
|
|
108
|
+
"Lower Shoulder Angle Velocity",
|
|
109
|
+
"Lower Shoulder Angle Acceleration",
|
|
110
|
+
"Iliac Crest Angle Velocity",
|
|
111
|
+
"Iliac Crest Angle Acceleration"
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: autogaita
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: Automatic Gait Analysis in Python. A toolbox to streamline and standardise the analysis of kinematics across species after ML-based body posture tracking. Despite being optimised for gait analyses, AutoGaitA has the potential to be used for any kind of kinematic analysis.
|
|
5
5
|
Home-page: https://github.com/mahan-hosseini/AutoGaitA/
|
|
6
6
|
Author: Mahan Hosseini
|
|
@@ -26,7 +26,7 @@ if platform.system() == "Darwin":
|
|
|
26
26
|
setup(
|
|
27
27
|
name="autogaita",
|
|
28
28
|
python_requires=">=3.10",
|
|
29
|
-
version="1.0.
|
|
29
|
+
version="1.0.3", # rc == release candidate (before release is finished)
|
|
30
30
|
author="Mahan Hosseini",
|
|
31
31
|
description="Automatic Gait Analysis in Python. A toolbox to streamline and standardise the analysis of kinematics across species after ML-based body posture tracking. Despite being optimised for gait analyses, AutoGaitA has the potential to be used for any kind of kinematic analysis.",
|
|
32
32
|
packages=find_packages(),
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import autogaita
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def group_dlcrun():
|
|
5
|
-
"""
|
|
6
|
-
Batchrun script to run AutoGaitA Group for Results obtained with AutoGaitA DLC.
|
|
7
|
-
folderinfo & cfg dictionaries must be configured as explained in our documentation. See the "AutoGaitA without the GUI" section of our documentation for references to in-depth explanations to all dictionary keys (note that each key of dicts corresponds to some object in the AutoGaitA Group GUI)
|
|
8
|
-
"""
|
|
9
|
-
# folderinfo
|
|
10
|
-
# => Note that length of folderinfo's group_names & group_dirs lists determines how # many groups are compared.
|
|
11
|
-
# => Also note that indices must correspond (i.e., idx # 1's name will be used # for dataset stored in group_dir's idx 1)
|
|
12
|
-
folderinfo = {}
|
|
13
|
-
folderinfo["group_names"] = [
|
|
14
|
-
# RM Dataset
|
|
15
|
-
"5mm",
|
|
16
|
-
"12mm",
|
|
17
|
-
"25mm",
|
|
18
|
-
# Interaction Issue Dataset
|
|
19
|
-
# "Control",
|
|
20
|
-
# "Silenced",
|
|
21
|
-
# Testing Dataset
|
|
22
|
-
# "one",
|
|
23
|
-
# "two",
|
|
24
|
-
]
|
|
25
|
-
folderinfo["group_dirs"] = [
|
|
26
|
-
# --------------------------
|
|
27
|
-
# Full Dataset (39 subjects)
|
|
28
|
-
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Control Full",
|
|
29
|
-
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Silenced Full/",
|
|
30
|
-
# --------------------------
|
|
31
|
-
# Reduced Dataset (5 subjects)
|
|
32
|
-
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Control",
|
|
33
|
-
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Silenced/",
|
|
34
|
-
# --------------------------
|
|
35
|
-
# Testing Dataset
|
|
36
|
-
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/Group 1/",
|
|
37
|
-
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/Group 2/",
|
|
38
|
-
# --------------------------
|
|
39
|
-
# RM Dataset (example data in repo)
|
|
40
|
-
"/Users/mahan/sciebo/PythonCode/gaita_repo/example data/5mm/Results/",
|
|
41
|
-
"/Users/mahan/sciebo/PythonCode/gaita_repo/example data/12mm/Results/",
|
|
42
|
-
"/Users/mahan/sciebo/PythonCode/gaita_repo/example data/25mm/Results/",
|
|
43
|
-
]
|
|
44
|
-
folderinfo["results_dir"] = (
|
|
45
|
-
"/Users/mahan/sciebo/Research/AutoGaitA/Mouse/example_data_results/"
|
|
46
|
-
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Mahan Results/"
|
|
47
|
-
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/GroupResults/"
|
|
48
|
-
)
|
|
49
|
-
# cfg
|
|
50
|
-
cfg = {}
|
|
51
|
-
cfg["do_permtest"] = False # True
|
|
52
|
-
cfg["do_anova"] = True
|
|
53
|
-
cfg["permutation_number"] = 100
|
|
54
|
-
cfg["PCA_n_components"] = 6
|
|
55
|
-
# cfg["PCA_n_components"] = 0.33
|
|
56
|
-
# cfg["PCA_custom_scatter_PCs"] = "4,5,6;4,5;2,4,6"
|
|
57
|
-
cfg["PCA_custom_scatter_PCs"] = ""
|
|
58
|
-
cfg["PCA_save_3D_video"] = False # True
|
|
59
|
-
cfg["PCA_bins"] = "" # "0-10,24,50-75"
|
|
60
|
-
cfg["stats_threshold"] = 0.05
|
|
61
|
-
cfg["plot_SE"] = False
|
|
62
|
-
cfg["color_palette"] = "viridis"
|
|
63
|
-
cfg["dont_show_plots"] = True
|
|
64
|
-
cfg["legend_outside"] = True
|
|
65
|
-
cfg["which_leg"] = "left"
|
|
66
|
-
cfg["anova_design"] = "RM ANOVA"
|
|
67
|
-
# cfg["anova_design"] = "Mixed ANOVA"
|
|
68
|
-
cfg["permutation_number"] = 100
|
|
69
|
-
cfg["PCA_variables"] = [
|
|
70
|
-
# "Hind paw tao y",
|
|
71
|
-
# "Ankle y",
|
|
72
|
-
# "Knee y",
|
|
73
|
-
# "Ankle Angle",
|
|
74
|
-
# "Knee Angle",
|
|
75
|
-
# "Nose x",
|
|
76
|
-
# "Knee y",
|
|
77
|
-
# "Knee x",
|
|
78
|
-
# "Knee Velocity",
|
|
79
|
-
# "Knee Acceleration",
|
|
80
|
-
# "Knee Angle",
|
|
81
|
-
# "Knee Angle Velocity",
|
|
82
|
-
# "Knee Angle Acceleration",
|
|
83
|
-
# "Hip Angle",
|
|
84
|
-
]
|
|
85
|
-
cfg["stats_variables"] = [
|
|
86
|
-
"Hind paw tao y",
|
|
87
|
-
# "Ankle y",
|
|
88
|
-
"Knee y",
|
|
89
|
-
# "Ankle Angle",
|
|
90
|
-
"Knee Angle",
|
|
91
|
-
# "Nose x",
|
|
92
|
-
# "Knee y",
|
|
93
|
-
"Knee x",
|
|
94
|
-
# "Knee Velocity",
|
|
95
|
-
# "Knee Acceleration",
|
|
96
|
-
# "Knee Angle",
|
|
97
|
-
# "Knee Angle Velocity",
|
|
98
|
-
# "Knee Angle Acceleration",
|
|
99
|
-
# "Hip Angle",
|
|
100
|
-
# "Elbow Angle"
|
|
101
|
-
]
|
|
102
|
-
# run
|
|
103
|
-
autogaita.group(folderinfo, cfg)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
# %% what happens if we just hit run
|
|
107
|
-
if __name__ == "__main__":
|
|
108
|
-
group_dlcrun()
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"group_names": [
|
|
4
|
-
"",
|
|
5
|
-
"",
|
|
6
|
-
"",
|
|
7
|
-
"",
|
|
8
|
-
"",
|
|
9
|
-
""
|
|
10
|
-
],
|
|
11
|
-
"group_dirs": [
|
|
12
|
-
"",
|
|
13
|
-
"",
|
|
14
|
-
"",
|
|
15
|
-
"",
|
|
16
|
-
"",
|
|
17
|
-
""
|
|
18
|
-
],
|
|
19
|
-
"results_dir": ""
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"do_permtest": true,
|
|
23
|
-
"do_anova": false,
|
|
24
|
-
"anova_design": "RM ANOVA",
|
|
25
|
-
"permutation_number": "10000",
|
|
26
|
-
"stats_threshold": "0.05",
|
|
27
|
-
"which_leg": "right",
|
|
28
|
-
"PCA_n_components": "3",
|
|
29
|
-
"PCA_custom_scatter_PCs": "",
|
|
30
|
-
"PCA_save_3D_video": false,
|
|
31
|
-
"PCA_bins": "",
|
|
32
|
-
"plot_SE": false,
|
|
33
|
-
"color_palette": "Set2",
|
|
34
|
-
"dont_show_plots": false,
|
|
35
|
-
"legend_outside": true,
|
|
36
|
-
"stats_variables": [
|
|
37
|
-
],
|
|
38
|
-
"PCA_variables": [
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{autogaita-1.0.2 → autogaita-1.0.3}/autogaita/universal3D/universal3D_datafile_preparation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|