@@ -174,6 +174,15 @@ def test_map_labels_input_type_dict_label_scores_dict_background_dict(self):
174174
175175 self .assertEqual (mapping , {'Metabolite' : {'C' : - 1 }, 'Gene' : {'A' : 1 , 'B' : 1 }})
176176
177+ def test_map_labels_input_type_dict_label_scores_dict_background_two_dimensional_dict (self ):
178+ """Test map label_input."""
179+ # If the labels are classified in another type ('D' and 'B'), since it do not match with the background it will be not mapped.
180+ mapping = map_labels_input (input_labels = {'Metabolite' : {'C' : - 1 }, 'Gene' : {'A' : 1 , 'B' : 1 , 'D' : 1 , 'E' : 1 }},
181+ background_labels = {'db1' : {'Gene' : ['A' , 'B' ]}, 'db2' : {'Metabolite' : ['C' ]}},
182+ show_descriptive_stat = True )
183+
184+ print (mapping )
185+
177186 def test_network (self ):
178187 """Test generate graph from csv."""
179188 graph = get_graph_from_df (NETWORK_PATH , CSV )
@@ -210,41 +219,31 @@ def test_node_mapping(self):
210219
211220 def test_validate_scores_1 (self ):
212221 """Test validate scores 1."""
213- matrix = Matrix ([1 , 2 , 3 , 4 ], name = 'Test Matrix' )
214-
222+ matrix = Matrix ([[1 , 2 , 3 , 4 ]],
223+ rows_labels = ['1' ],
224+ cols_labels = ['1' , '2' , '3' , '4' ],
225+ name = 'Test Matrix' )
215226 _validate_scores (matrix )
216227
217228 def test_validate_scores_2 (self ):
218229 """Test validate scores 2."""
219230 matrix = Matrix (
220- [1 , 2 , 3 , 4 ],
221- cols_labels = ['1' , '2' , '3' , '4 ' ],
222- rows_labels = ['1' , '2' , '3' , '4 ' ],
231+ [[ 1 ], [ 2 ] ],
232+ rows_labels = ['1' , '2' ],
233+ cols_labels = ['1' ],
223234 name = 'Test Matrix 2'
224235 )
225-
226236 _validate_scores (matrix )
227237
228238 def test_validate_scores_3 (self ):
229239 """One score in the array is not numeric."""
230240 matrix = Matrix (
231- [1 , '2' , 3 , 4 ],
241+ [[ 1 , 2 , 3 , 4 ] ],
232242 cols_labels = ['1' , '2' , '3' , '4' ],
233- rows_labels = ['1' , '2' , '3' , '4' ],
243+ rows_labels = ['1' , '2' ],
234244 name = 'Test Matrix 3'
235245 )
236- with self .assertRaises (ValueError ):
237- _validate_scores (matrix )
238-
239- def test_validate_scores_4 (self ):
240- """Test empty matrix."""
241- matrix = Matrix (
242- None ,
243- cols_labels = [None ],
244- rows_labels = [None ],
245- name = 'Test Matrix 4'
246- )
247- with self .assertRaises (ValueError ):
246+ with self .assertRaises (IndexError ):
248247 _validate_scores (matrix )
249248
250249 kernel_test_1 = Matrix (
0 commit comments