@@ -50,13 +50,20 @@ def build_graph(self, nodesFile, edgesFile, allEdgesFile):
5050 if not self .nodes_plan_a or row [2 ] in self .nodes_plan_a :
5151 self .Vertices .append (row [1 ])
5252 vertex_id = len (self .Vertices ) - 1
53- self .Vertices_attributes [row [1 ]] = (row [2 ], list (map (float , row [3 ].split (";" ))), vertex_id )
53+ self .Vertices_attributes [row [1 ]] = (
54+ row [2 ],
55+ list (map (float , row [3 ].split (";" ))),
56+ vertex_id ,
57+ )
5458
5559 if not self .nodes_plan_b or row [2 ] in self .nodes_plan_b :
5660 self .Whole_Vertices .append (row [1 ])
5761 vertex_id = len (self .Whole_Vertices ) - 1
5862 self .Whole_Vertices_attributes [row [1 ]] = (
59- row [2 ], list (map (float , row [3 ].split (";" ))), vertex_id )
63+ row [2 ],
64+ list (map (float , row [3 ].split (";" ))),
65+ vertex_id ,
66+ )
6067
6168 nodesDict [row [0 ]] = row [1 ]
6269
@@ -70,7 +77,10 @@ def build_graph(self, nodesFile, edgesFile, allEdgesFile):
7077 node2_id = row [1 ]
7178 node1 = nodesDict [node1_id ]
7279 node2 = nodesDict [node2_id ]
73- if node1 in self .Vertices_attributes and node2 in self .Vertices_attributes :
80+ if (
81+ node1 in self .Vertices_attributes
82+ and node2 in self .Vertices_attributes
83+ ):
7484 node1_label = self .Vertices_attributes [node1 ][0 ]
7585 if node1_label == self .full_loci :
7686 self .Edges .append ([node2_id , node1_id ])
@@ -145,7 +155,9 @@ def build_graph(self, nodesFile, edgesFile, allEdgesFile):
145155 del sorted_indices
146156
147157 # Create a list of the first appearance of a number in the 0 column in the matrix
148- unique_values , first_occurrences_indices = np .unique (self .Edges [:, 0 ], return_index = True )
158+ unique_values , first_occurrences_indices = np .unique (
159+ self .Edges [:, 0 ], return_index = True
160+ )
149161
150162 j = 0
151163 for i in range (0 , self .Vertices .shape [0 ]):
@@ -162,7 +174,9 @@ def build_graph(self, nodesFile, edgesFile, allEdgesFile):
162174 del unique_values , first_occurrences_indices
163175
164176 # Create a list of the first appearance of a number in the 0 column in the matrix
165- unique_values , first_occurrences_indices = np .unique (self .Whole_Edges [:, 0 ], return_index = True )
177+ unique_values , first_occurrences_indices = np .unique (
178+ self .Whole_Edges [:, 0 ], return_index = True
179+ )
166180
167181 j = 0
168182 for i in range (0 , self .Whole_Vertices .shape [0 ]):
@@ -182,7 +196,9 @@ def build_graph(self, nodesFile, edgesFile, allEdgesFile):
182196 self .Whole_Neighbors_start .append (int (len (self .Whole_Vertices )))
183197
184198 self .Neighbors_start = np .array (self .Neighbors_start , dtype = np .uint32 )
185- self .Whole_Neighbors_start = np .array (self .Whole_Neighbors_start , dtype = np .uint32 )
199+ self .Whole_Neighbors_start = np .array (
200+ self .Whole_Neighbors_start , dtype = np .uint32
201+ )
186202
187203 # Take the first column out of the Edges arrays
188204 ### Do the following to massive save of memory
@@ -249,7 +265,13 @@ def adjs_query(self, alleleList):
249265 allele_id = self .Vertices_attributes [allele ][2 ]
250266 # Find the neighbors of the allele
251267 allele_neighbors = self .Vertices [
252- self .Edges [range (self .Neighbors_start [allele_id ], self .Neighbors_start [allele_id + 1 ])]]
268+ self .Edges [
269+ range (
270+ self .Neighbors_start [allele_id ],
271+ self .Neighbors_start [allele_id + 1 ],
272+ )
273+ ]
274+ ]
253275 # The frequencies of the neighbors to the dictionary
254276 for adj in allele_neighbors :
255277 adjDict [adj ] = self .Vertices_attributes [adj ][1 ]
@@ -271,9 +293,14 @@ def adjs_query_by_color(self, alleleList, labelA, labelB):
271293
272294 if connector in self .Whole_Vertices_attributes :
273295 connector_id = self .Whole_Vertices_attributes [connector ]
274- alleles = self .Whole_Vertices [self .Whole_Edges [range (self .Whole_Neighbors_start [connector_id ],
275- self .Whole_Neighbors_start [
276- connector_id + 1 ])]]
296+ alleles = self .Whole_Vertices [
297+ self .Whole_Edges [
298+ range (
299+ self .Whole_Neighbors_start [connector_id ],
300+ self .Whole_Neighbors_start [connector_id + 1 ],
301+ )
302+ ]
303+ ]
277304
278305 for adj in alleles :
279306 adjDict [adj ] = self .Whole_Vertices_attributes [adj ][1 ]
0 commit comments