From 592673c099ddded729c1b0c1b408d7e4b538e4c8 Mon Sep 17 00:00:00 2001 From: Phlya Date: Thu, 31 Oct 2024 11:56:24 +0100 Subject: [PATCH] ignore distance limits with trans --- coolpuppy/coolpup.py | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/coolpuppy/coolpup.py b/coolpuppy/coolpup.py index 372e0d9..0894fca 100644 --- a/coolpuppy/coolpup.py +++ b/coolpuppy/coolpup.py @@ -243,12 +243,14 @@ def __init__( self.mindist = mindist if self.trans: warnings.warn("Ignoring mindist when using trans", stacklevel=2) + self.mindist = 0 if maxdist is None: self.maxdist = np.inf else: self.maxdist = maxdist if self.trans: warnings.warn("Ignoring maxdist when using trans", stacklevel=2) + self.maxdist = np.inf self.local = local self.subset = subset self.seed = seed @@ -437,14 +439,9 @@ def _control_regions(self, intervals2d, nshifts=0): ] + shift[:, np.newaxis] ) - control_intervals[ - ["stBin1", "endBin1", "stBin2", "endBin2"] - ] = control_intervals[ - ["stBin1", "endBin1", "stBin2", "endBin2"] - ] + np.round( - shift[:, np.newaxis] / self.resolution - ).astype( - int + control_intervals[["stBin1", "endBin1", "stBin2", "endBin2"]] = ( + control_intervals[["stBin1", "endBin1", "stBin2", "endBin2"]] + + np.round(shift[:, np.newaxis] / self.resolution).astype(int) ) intervals2d["kind"] = "ROI" control_intervals["kind"] = "control" @@ -1813,11 +1810,15 @@ def pileupsByDistanceWithControl( 0, "separation", normalized_pileups["distance_band"].apply( - lambda x: x - if x == "all" - else f"{x[0]/1000000}Mb-\n{x[1]/1000000}Mb" - if len(x) == 2 - else f"{x[0]/1000000}Mb+" + lambda x: ( + x + if x == "all" + else ( + f"{x[0]/1000000}Mb-\n{x[1]/1000000}Mb" + if len(x) == 2 + else f"{x[0]/1000000}Mb+" + ) + ) ), ) # Move "all" to the bottom while sorting the distances @@ -1893,11 +1894,15 @@ def pileupsByStrandByDistanceWithControl( 0, "separation", normalized_pileups["distance_band"].apply( - lambda x: x - if x == "all" - else f"{x[0]/1000000}Mb-\n{x[1]/1000000}Mb" - if len(x) == 2 - else f"{x[0]/1000000}Mb+" + lambda x: ( + x + if x == "all" + else ( + f"{x[0]/1000000}Mb-\n{x[1]/1000000}Mb" + if len(x) == 2 + else f"{x[0]/1000000}Mb+" + ) + ) ), ) # Move "all" to the bottom while sorting the distances