1313INTENSITY_ROOT = "/mnt/vast-nhr/projects/nim00007/data/moser/cochlea-lightsheet/mobie_project/cochlea-lightsheet/tables/measurements2" # noqa
1414
1515# The cochlea for the CHReef analysis.
16- COCHLEAE = [
17- "M_LR_000143_L" ,
18- "M_LR_000144_L" ,
19- "M_LR_000145_L" ,
20- "M_LR_000153_L" ,
21- "M_LR_000155_L" ,
22- "M_LR_000189_L" ,
23- "M_LR_000143_R" ,
24- "M_LR_000144_R" ,
25- "M_LR_000145_R" ,
26- "M_LR_000153_R" ,
27- "M_LR_000155_R" ,
28- "M_LR_000189_R" ,
29- ]
30-
31- COCHLEAE_GERBIL = [
32- "G_EK_000049_L" ,
33- "G_EK_000049_R" ,
34- ]
35-
36-
37- COCHLEAE_ALIAS = {
38- "M_LR_000143_L" : "M0L" ,
39- "M_LR_000144_L" : "M05L" ,
40- "M_LR_000145_L" : "M06L" ,
41- "M_LR_000153_L" : "M07L" ,
42- "M_LR_000155_L" : "M08L" ,
43- "M_LR_000189_L" : "M09L" ,
44- "M_LR_000143_R" : "M0R" ,
45- "M_LR_000144_R" : "M05R" ,
46- "M_LR_000145_R" : "M06R" ,
47- "M_LR_000153_R" : "M07R" ,
48- "M_LR_000155_R" : "M08R" ,
49- "M_LR_000189_R" : "M09R" ,
50- "G_EK_000049_L" : "G1L" ,
51- "G_EK_000049_R" : "G1R" ,
16+ COCHLEAE_DICT = {
17+ "M_LR_000143_L" : {"alias" : "M0L" , "component" : [1 ]},
18+ "M_LR_000144_L" : {"alias" : "M05L" , "component" : [1 ]},
19+ "M_LR_000145_L" : {"alias" : "M06L" , "component" : [1 ]},
20+ "M_LR_000153_L" : {"alias" : "M07L" , "component" : [1 ]},
21+ "M_LR_000155_L" : {"alias" : "M08L" , "component" : [1 , 2 , 3 ]},
22+ "M_LR_000189_L" : {"alias" : "M09L" , "component" : [1 ]},
23+ "M_LR_000143_R" : {"alias" : "M0R" , "component" : [1 ]},
24+ "M_LR_000144_R" : {"alias" : "M05R" , "component" : [1 ]},
25+ "M_LR_000145_R" : {"alias" : "M06R" , "component" : [1 ]},
26+ "M_LR_000153_R" : {"alias" : "M07R" , "component" : [1 ]},
27+ "M_LR_000155_R" : {"alias" : "M08R" , "component" : [1 ]},
28+ "M_LR_000189_R" : {"alias" : "M09R" , "component" : [1 ]},
29+ "G_EK_000049_L" : {"alias" : "G1L" , "component" : [1 , 3 , 4 , 5 ]},
30+ "G_EK_000049_R" : {"alias" : "G1R" , "component" : [1 , 2 ]},
5231}
5332
5433png_dpi = 300
@@ -60,10 +39,10 @@ def get_chreef_data(animal="mouse"):
6039
6140 if animal == "mouse" :
6241 cache_path = "./chreef_data.pkl"
63- cochleae = COCHLEAE
42+ cochleae = [ key for key in COCHLEAE_DICT . keys () if "M_" in key ]
6443 else :
6544 cache_path = "./chreef_data_gerbil.pkl"
66- cochleae = COCHLEAE_GERBIL
45+ cochleae = [ key for key in COCHLEAE_DICT . keys () if "G_" in key ]
6746
6847 if os .path .exists (cache_path ):
6948 with open (cache_path , "rb" ) as f :
@@ -83,7 +62,9 @@ def get_chreef_data(animal="mouse"):
8362 table = pd .read_csv (table_content , sep = "\t " )
8463
8564 # May need to be adjusted for some cochleae.
86- table = table [table .component_labels == 1 ]
65+ component_labels = COCHLEAE_DICT [cochlea ]["component" ]
66+ print (cochlea , component_labels )
67+ table = table [table .component_labels .isin (component_labels )]
8768 # The relevant values for analysis.
8869 try :
8970 values = table [["label_id" , "length[µm]" , "frequency[kHz]" , "marker_labels" ]]
@@ -136,7 +117,7 @@ def fig_04c(chreef_data, save_path, plot=False, plot_by_side=False, use_alias=Tr
136117
137118 # TODO have central function for alias for all plots?
138119 if use_alias :
139- alias = [COCHLEAE_ALIAS [ k ] for k in chreef_data .keys ()]
120+ alias = [COCHLEAE_DICT [ k ][ "alias" ] for k in chreef_data .keys ()]
140121 else :
141122 alias = [name .replace ("_" , "" ).replace ("0" , "" ) for name in chreef_data .keys ()]
142123
@@ -206,7 +187,7 @@ def fig_04d(chreef_data, save_path, plot=False, plot_by_side=False, intensity=Fa
206187 """Transduction efficiency per cochlea.
207188 """
208189 if use_alias :
209- alias = [COCHLEAE_ALIAS [ k ] for k in chreef_data .keys ()]
190+ alias = [COCHLEAE_DICT [ k ][ "alias" ] for k in chreef_data .keys ()]
210191 else :
211192 alias = [name .replace ("_" , "" ).replace ("0" , "" ) for name in chreef_data .keys ()]
212193
@@ -237,7 +218,7 @@ def fig_04d(chreef_data, save_path, plot=False, plot_by_side=False, intensity=Fa
237218 main_label_size = 20
238219 sub_label_size = 16
239220 main_tick_size = 12
240- legendsize = 16
221+ legendsize = 16 if intensity else 12
241222
242223 label = "Intensity" if intensity else "Transduction efficiency"
243224 if plot_by_side :
@@ -274,7 +255,7 @@ def fig_04e(chreef_data, save_path, plot, intensity=False, gerbil=False, use_ali
274255 result = {"cochlea" : [], "octave_band" : [], "value" : []}
275256 for name , values in chreef_data .items ():
276257 if use_alias :
277- alias = COCHLEAE_ALIAS [name ]
258+ alias = COCHLEAE_DICT [name ][ "alias" ]
278259 else :
279260 alias = name .replace ("_" , "" ).replace ("0" , "" )
280261
0 commit comments