@@ -12,7 +12,7 @@ def get_legend_patch(y_sample, sample_color):
1212 '''
1313
1414 ### make a dictionary of colors annd samples
15- my_color = {y_sample [i ]: sample_color [i ] for i in range (len (y_sample ))}
15+ my_color = {y_sample . iloc [i ]: sample_color [i ] for i in range (len (y_sample ))}
1616
1717 ### make a legend patch based on my_color
1818 legend_patch = [mpatches .Patch (color = my_color [i ], label = i ) for i in np .unique (y_sample )]
@@ -52,14 +52,14 @@ def get_colors_dict_ratLiver(y_sample, y_strain,y_cell_type):
5252
5353 ### make a dictionary of colors for each strain in y_strain
5454 my_color = {'DA' : 'red' , 'LEW' : 'blue' }
55- strain_color = [my_color [y_strain [i ]] for i in range (len (y_strain ))]
55+ strain_color = [my_color [y_strain . iloc [i ]] for i in range (len (y_strain ))]
5656
5757
5858 ### make a dictionary of colors for each 16 cluster in y_cluster. use np.unique(y_cell_type)
5959 ### generate 16 colors using the following code:
6060 my_color = {i : "#" + '' .join ([random .choice ('0123456789ABCDEF' ) for j in range (6 )])
6161 for i in np .unique (y_cell_type )}
62- cell_type_color = [my_color [y_cell_type [i ]] for i in range (len (y_cell_type ))]
62+ cell_type_color = [my_color [y_cell_type . iloc [i ]] for i in range (len (y_cell_type ))]
6363
6464 return {'sample' : sample_color , 'strain' : strain_color , 'cell_type' :cell_type_color }
6565
@@ -75,13 +75,13 @@ def get_colors_dict_humanLiver(y_sample, y_cell_type):
7575
7676 ### make a dictionary of colors for each sample in y_sample
7777 my_color = {'P1TLH' : 'red' ,'P3TLH' : 'orange' , 'P2TLH' : 'blue' , 'P5TLH' : 'purple' ,'P4TLH' : 'green' }
78- sample_color = [my_color [y_sample [i ]] for i in range (len (y_sample ))]
78+ sample_color = [my_color [y_sample . iloc [i ]] for i in range (len (y_sample ))]
7979
8080 ### make a dictionary of colors for each 16 cluster in y_cluster. use np.unique(y_cluster)
8181 ### generate 16 colors using the following code:
8282 my_color = {i : "#" + '' .join ([random .choice ('0123456789ABCDEF' ) for j in range (6 )])
8383 for i in np .unique (y_cell_type )}
84- cell_type_color = [my_color [y_cell_type [i ]] for i in range (len (y_cell_type ))]
84+ cell_type_color = [my_color [y_cell_type . iloc [i ]] for i in range (len (y_cell_type ))]
8585
8686 return {'sample' : sample_color , 'cell_type' :cell_type_color }
8787
@@ -98,17 +98,17 @@ def get_colors_dict_humanKidney(y_sample, y_sex, y_cell_type):
9898 ### make a dictionary of colors for each sample in y_sample
9999 my_color = {i : "#" + '' .join ([random .choice ('0123456789ABCDEF' ) for j in range (6 )])
100100 for i in np .unique (y_sample )}
101- sample_color = [my_color [y_sample [i ]] for i in range (len (y_sample ))]
101+ sample_color = [my_color [y_sample . iloc [i ]] for i in range (len (y_sample ))]
102102
103103 ### make a dictionary of colors for each strain in y_strain
104104 my_color = {'Male' : 'forestgreen' , 'Female' : 'hotpink' }
105- sex_color = [my_color [y_sex [i ]] for i in range (len (y_sex ))]
105+ sex_color = [my_color [y_sex . iloc [i ]] for i in range (len (y_sex ))]
106106
107107 ### make a dictionary of colors for each 16 cluster in y_cluster. use np.unique(y_cluster)
108108 ### generate 16 colors using the following code:
109109 my_color = {i : "#" + '' .join ([random .choice ('0123456789ABCDEF' ) for j in range (6 )])
110110 for i in np .unique (y_cell_type )}
111- cell_type_color = [my_color [y_cell_type [i ]] for i in range (len (y_cell_type ))]
111+ cell_type_color = [my_color [y_cell_type . iloc [i ]] for i in range (len (y_cell_type ))]
112112
113113 return {'sample' : sample_color , 'sex' :sex_color , 'cell_type' :cell_type_color }
114114
@@ -124,17 +124,17 @@ def get_colors_dict_humanPBMC(y_sample, y_stim, y_cell_type):
124124 ### make a dictionary of colors for each sample in y_sample
125125 my_color = {i : "#" + '' .join ([random .choice ('0123456789ABCDEF' ) for j in range (6 )])
126126 for i in np .unique (y_sample )}
127- sample_color = [my_color [y_sample [i ]] for i in range (len (y_sample ))]
127+ sample_color = [my_color [y_sample . iloc [i ]] for i in range (len (y_sample ))]
128128
129129 ### make a dictionary of colors for each strain in y_strain
130130 my_color = {'stim' : 'red' , 'ctrl' : 'blue' }
131- stim_color = [my_color [y_stim [i ]] for i in range (len (y_stim ))]
131+ stim_color = [my_color [y_stim . iloc [i ]] for i in range (len (y_stim ))]
132132
133133 ### make a dictionary of colors for each 16 cluster in y_cluster. use np.unique(y_cluster)
134134 ### generate 16 colors using the following code:
135135 my_color = {i : "#" + '' .join ([random .choice ('0123456789ABCDEF' ) for j in range (6 )])
136136 for i in np .unique (y_cell_type )}
137- cell_type_color = [my_color [y_cell_type [i ]] for i in range (len (y_cell_type ))]
137+ cell_type_color = [my_color [y_cell_type . iloc [i ]] for i in range (len (y_cell_type ))]
138138
139139 return {'sample' : sample_color , 'stim' :stim_color , 'cell_type' :cell_type_color }
140140
0 commit comments