Skip to content

Commit

Permalink
Merge pull request #41 from deeptools/revert-40-fixfit_cut_intervals
Browse files Browse the repository at this point in the history
Revert "Fix fit cut intervals"
  • Loading branch information
joachimwolff authored Jul 19, 2021
2 parents 6ca77d1 + 4a9d523 commit c44f5ed
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions hicmatrix/HiCMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from intervaltree import IntervalTree, Interval
import cooler
import time
from collections import Counter

from .utilities import toBytes
from .utilities import toString
Expand Down Expand Up @@ -170,7 +169,7 @@ def getBinSize(self):
return self.bin_size
# If there are more bins, the diff will be compared
# to the median of the differences between starts
median = int(np.median(np.concatenate([np.diff([start for chro, start, end, extra in self.cut_intervals if chro == cur_chrom]) for cur_chrom, nb in Counter(chrom).items() if nb > 1])))
median = int(np.median(np.diff(start)))

# check if the bin size is
# homogeneous
Expand Down Expand Up @@ -335,7 +334,7 @@ def fit_cut_intervals(cut_intervals):
return cut_intervals
chrom, start, end, extra = zip(*cut_intervals)

median = int(np.median(np.concatenate([np.diff([start for chro, start, end, extra in cut_intervals if chro == cur_chrom]) for cur_chrom, nb in Counter(chrom).items() if nb > 1])))
median = int(np.median(np.diff(start)))
diff = np.array(end) - np.array(start)
# check if the bin size is homogeneous
if len(np.flatnonzero(diff != median)) > (len(diff) * 0.01):
Expand Down

0 comments on commit c44f5ed

Please sign in to comment.