diff --git a/pyproject.toml b/pyproject.toml index d55915d..2ce477f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "ModDotPlot" -version = "0.8.7" +version = "0.8.8" requires-python = ">= 3.7" dependencies = [ "pysam", diff --git a/src/moddotplot/const.py b/src/moddotplot/const.py index 3066b1d..7e0bf70 100644 --- a/src/moddotplot/const.py +++ b/src/moddotplot/const.py @@ -1,4 +1,4 @@ -VERSION = "0.8.7" +VERSION = "0.8.8" COLS = [ "#query_name", "query_start", diff --git a/src/moddotplot/moddotplot.py b/src/moddotplot/moddotplot.py index 368573f..bd4aab4 100644 --- a/src/moddotplot/moddotplot.py +++ b/src/moddotplot/moddotplot.py @@ -922,29 +922,13 @@ def main(): # TODO: Optimize computations so that largest sequence doesn't need to be redone all the time if (args.compare or args.compare_only) and len(sequences) > 1: # Set window size to args.window. Otherwise, set it to n/resolution - win = args.window - res = args.resolution - if args.window: - res = math.ceil(len(sequences[0][1]) / args.window) - else: - win = math.ceil(len(sequences[0][1]) / args.resolution) - if win < args.modimizer: - args.modimizer = win - - seq_sparsity = round(win / args.modimizer) - if seq_sparsity <= args.modimizer: - seq_sparsity = 2 ** int(math.log2(seq_sparsity)) - else: - seq_sparsity = 2 ** (int(math.log2(seq_sparsity - 1)) + 1) - expectation = round(win / seq_sparsity) if args.grid: grid_vals = [] for i in range(len(sequences)): - larger_seq = sequences[i][1] - for j in range(i + 1, len(sequences)): + larger_seq = sequences[i][1] smaller_seq = sequences[j][1] larger_length = len(larger_seq) smaller_length = len(smaller_seq) @@ -958,6 +942,22 @@ def main(): smaller_length = len(smaller_seq) larger_seq_name = sequences[j][0] smaller_seq_name = sequences[i][0] + + win = args.window + res = args.resolution + if args.window: + res = math.ceil(smaller_length / args.window) + else: + win = math.ceil(smaller_length / args.resolution) + if win < args.modimizer: + args.modimizer = win + + seq_sparsity = round(win / args.modimizer) + if seq_sparsity <= args.modimizer: + seq_sparsity = 2 ** int(math.log2(seq_sparsity)) + else: + seq_sparsity = 2 ** (int(math.log2(seq_sparsity - 1)) + 1) + expectation = round(win / seq_sparsity) print( f"Computing pairwise identity matrix for {larger_seq_name} and {smaller_seq_name}... \n" )