-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths2_fig_prelim.py
153 lines (133 loc) · 5.82 KB
/
s2_fig_prelim.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib import rcParams
import scipy,random, matplotlib, itertools, glob, os, platform, getpass
import numpy as np
import matplotlib.gridspec as gridspec
from pathlib import Path
if getpass.getuser() == "mengxing":
git_dir = Path("/home/mengxing/GIT/THATRACT2_paper")
elif getpass.getuser() == "lmengxing":
if platform.system() == "Linux":
git_dir = Path("/bcbl/home/home_g-m/lmengxing/TESTDATA/GIT/THATRACT2_paper")
elif platform.system() == "Windows":
git_dir = Path("F:\TESTDATA\GIT\THATRACT2_paper")
raw_csv = Path(f"{git_dir}/raw_csv")
sns.set_style("darkgrid")
corr = pd.read_csv(raw_csv / "correlation_all_index.csv")
# plot Profile correlation between test-retest
corr_TRT = corr[corr["btw"]=="test-retest_AL_07"]
corr_TRT_des = pd.read_csv(raw_csv / "correlation_description_TRT.csv")
fig, axes = plt.subplots()
sns.stripplot(y="TCK", x="fa_y", order = corr_TRT_des.TCK.unique(),
data=corr_TRT, alpha = 0.5, ax = axes)
sns.pointplot(y="TCK", x="mean", order = corr_TRT_des.TCK.unique(),
data=corr_TRT_des, alpha = 0.55, ax = axes, join=False)
plt.xticks(rotation = -90)
plt.show()
# plot Profile correlation between AL06 AL07
corr_com = corr[~(corr["btw"]=="test-retest_AL_07")]
corr_com_des = pd.read_csv(raw_csv / "correlation_description_computation.csv")
corr_com_des = corr_com_des.sort_values(by="mean")
fig, axes = plt.subplots()
sns.stripplot(y="TCK", x="fa_y", order = corr_com_des.TCK.unique(),
data=corr_com, alpha = 0.5, ax = axes)
sns.pointplot(y="TCK", x="mean", order = corr_com_des.TCK.unique(),
data=corr_com_des, alpha = 0.55, ax = axes, join=False)
plt.xticks(rotation = -90)
plt.show()
### plot pairwise agreement bewtwee test-retest
# bundle adjacency
pairwise = pd.read_csv(git_dir / "pairwise.csv")
pairwise_TRT = pairwise[pairwise["btw"]=="T01vsT02"]
mean = pairwise_TRT.groupby("TCK").mean()
mean = mean.sort_values(by = "bundle_adjacency_voxels")
mean["TCK"]=mean.index
order = mean.TCK.unique()
fig, axes = plt.subplots()
sns.stripplot(y="TCK", x = "bundle_adjacency_voxels", data = pairwise_TRT,
order=order )
sns.pointplot(y="TCK", x = "bundle_adjacency_voxels", data = mean,
order = order, join = False)
plt.xticks(rotation = -90)
plt.tight_layout()
plt.show()
# dice
mean = mean.sort_values(by = "dice_voxels")
mean["TCK"]=mean.index
order = mean.TCK.unique()
fig, axes = plt.subplots()
sns.stripplot(y="TCK", x = "dice_voxels", data = pairwise_TRT,
order=order )
sns.pointplot(y="TCK", x = "dice_voxels", data = mean,
order = order, join = False)
plt.xticks(rotation = -90)
plt.tight_layout()
plt.show()
### plot pairwise agreement bewtwee computational
# bundle adjacency
pairwise = pd.read_csv(git_dir / "pairwise.csv")
pairwise_0607 = pairwise[pairwise["btw"]=="comAL_06vscomAL_07"]
mean = pairwise_0607.groupby("TCK").mean()
mean = mean.sort_values(by = "bundle_adjacency_voxels")
mean["TCK"]=mean.index
order = mean.TCK.unique()
fig, axes = plt.subplots()
sns.stripplot(y="TCK", x = "bundle_adjacency_voxels", data = pairwise_0607,
order=order )
sns.pointplot(y="TCK", x = "bundle_adjacency_voxels", data = mean,
order = order, join = False)
plt.xticks(rotation = -90)
#plt.tight_layout()
plt.show()
mean = mean.sort_values(by = "dice_voxels")
mean["TCK"]=mean.index
order = mean.TCK.unique()
fig, axes = plt.subplots()
sns.stripplot(y="TCK", x = "dice_voxels", data = pairwise_0607,
order=order )
sns.pointplot(y="TCK", x = "dice_voxels", data = mean,
order = order, join = False)
plt.xticks(rotation = -90)
plt.tight_layout()
plt.show()
# check the lowest values of specific tracts
corr = pd.read_csv("correlation_fa.csv")
pairwise = pd.read_csv(git_dir / "pairwise.csv")
pairwise_TRT = pairwise[pairwise["btw"]=="T01vsT02"]
# plot Profile correlation between test-retest
corr_TRT = corr[corr["btw"]=="T01vsT02"]
corr_TRT_des = pd.read_csv("correlation_description.csv")
# AL 12 50-130
corr_TRT[corr_TRT["TCK"] == "L_Area_25"].sort_values(by="corr")
pairwise_TRT[pairwise_TRT["TCK"] == "L_Area_25"][["SUBID","dice_voxels"]].sort_values(
by="dice_voxels")
# AL 5 nothing can be done, RTP profile problem
corr_TRT[corr_TRT["TCK"] == "Left-MammillaryBody"].sort_values(by="corr")
pairwise_TRT[pairwise_TRT["TCK"] == "Left-MammillaryBody"][["SUBID","dice_voxels"]].sort_values(
by="dice_voxels")
# AL 25
corr_TRT[corr_TRT["TCK"] == "R_posterior_OFC_Complex"].sort_values(by="corr")
pairwise_TRT[pairwise_TRT["TCK"] == "R_posterior_OFC_Complex"][["SUBID","dice_voxels"]].sort_values(
by="dice_voxels")
# AL 3
corr_TRT[corr_TRT["TCK"] == "L_Entorhinal_Cortex"].sort_values(by="corr")
pairwise_TRT[pairwise_TRT["TCK"] == "L_Entorhinal_Cortex"][["SUBID","dice_voxels"]].sort_values(
by="dice_voxels")
# AL 23
corr_TRT[corr_TRT["TCK"] == "L_Area_13l"].sort_values(by="corr")
pairwise_TRT[pairwise_TRT["TCK"] == "L_Area_13l"][["SUBID","dice_voxels"]].sort_values(
by="dice_voxels")
# AL 14
corr_TRT[corr_TRT["TCK"] == "L_Area_s32"].sort_values(by="corr")
pairwise_TRT[pairwise_TRT["TCK"] == "L_Area_s32"][["SUBID","dice_voxels"]].sort_values(
by="dice_voxels")
# AL 24
corr_TRT[corr_TRT["TCK"] == "L_Orbital_Frontal_Complex"].sort_values(by="corr")
pairwise_TRT[pairwise_TRT["TCK"] == "L_Orbital_Frontal_Complex"][["SUBID","dice_voxels"]].sort_values(
by="dice_voxels")
# AL 3
corr_TRT[corr_TRT["TCK"] == "L_Entorhinal_Cortex"].sort_values(by="corr")
pairwise_TRT[pairwise_TRT["TCK"] == "L_Entorhinal_Cortex"][["SUBID","dice_voxels"]].sort_values(
by="dice_voxels")