@@ -221,7 +221,7 @@ def get_min_max_values(self,regions,low_percentile,high_percentile):
221
221
for a in range (len (regions )):
222
222
for b in range (a ,len (regions )):
223
223
if (not self .interactions_across_regions ) and a != b : continue
224
- region1 ,region2 = correct_region_chr (regions [a ],c .chromnames ), correct_region_chr (regions [b ],c .chromnames )
224
+ region1 ,region2 = correct_region_chr (regions [a ],c .chromnames ), correct_region_chr (regions [b ],c .chromnames , file = self . file )
225
225
mat = c .matrix (balance = True ).fetch (region1 .chr + ":" + str (region1 .start )+ "-" + str (region1 .end ),
226
226
region2 .chr + ":" + str (region2 .start )+ "-" + str (region2 .end ))
227
227
mat [np .isnan (mat )]= 0
@@ -236,9 +236,15 @@ def find_angle(self,regions,boxes,max_bindist):
236
236
min_angle = 100
237
237
if boxes [0 ]["left" ]> boxes [0 ]["right" ]: min_angle = - 100
238
238
for a in range (len (regions )):
239
- region1 = correct_region_chr (regions [a ],c .chromnames )
239
+ region1 = correct_region_chr (regions [a ],c .chromnames , file = self . file )
240
240
box1 = boxes [a ]
241
- mat = 1 + c .matrix (balance = True ).fetch (region1 .chr + ":" + str (region1 .start )+ "-" + str (region1 .end ))
241
+ try :
242
+ mat = 1 + c .matrix (balance = True ).fetch (region1 .chr + ":" + str (region1 .start )+ "-" + str (region1 .end ))
243
+ except ValueError :
244
+ raise KnownException ("Could not retrieve region " + region1 .chr + ":" + str (region1 .start )+ "-" + str (region1 .end )+ " in file " + self .file + "." \
245
+ " Make sure that the region that you specified does not extend beyond the chromosome length, and that you did not subset your .cool file." )
246
+ except Exception as e :
247
+ raise e
242
248
width = (box1 ["right" ]- box1 ["left" ]) / mat .shape [0 ]
243
249
height = (box1 ["top" ]- box1 ["bottom" ]) / max_bindist
244
250
angle = height / width
0 commit comments