From 3298bdb6eebb7d6f2bfa2c9aa7d76bc79bb360d7 Mon Sep 17 00:00:00 2001 From: Hyeshik Chang Date: Fri, 9 Sep 2016 18:10:52 +0900 Subject: [PATCH] Tune optimal parameter searching for robust processes. --- conf/defaults.conf | 2 +- scripts/calculate-optimal-parameters.py | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/conf/defaults.conf b/conf/defaults.conf index a771473..a6a72c9 100644 --- a/conf/defaults.conf +++ b/conf/defaults.conf @@ -80,7 +80,7 @@ polyA_seeder: polya_sampling_gap: 3 dist_sampling_bins: 1000 cutoff_score_search_low: 0.0 - cutoff_score_search_high: 0.6 + cutoff_score_search_high: [0.4, 0.6] minimum_spots_for_dist_sampling: 300 favored_spots_for_dist_sampling: 500 kde_bandwidth_for_dist: 0.1 diff --git a/scripts/calculate-optimal-parameters.py b/scripts/calculate-optimal-parameters.py index cda70b0..da53f5f 100755 --- a/scripts/calculate-optimal-parameters.py +++ b/scripts/calculate-optimal-parameters.py @@ -61,10 +61,14 @@ def find_eqodds_point(poscounts, negcounts, xsamples): logLRfun = lambda x: np.log(max(VERY_SMALL_PROBABILITY, poskde(x)) / max(VERY_SMALL_PROBABILITY, negkde(x))) - try: - return optimize.bisect(logLRfun, CUTOFF_RANGE_LOW, CUTOFF_RANGE_HIGH) - except ValueError: - return + for cutoff_limit_high in CUTOFF_RANGE_HIGH: + try: + r = optimize.bisect(logLRfun, CUTOFF_RANGE_LOW, cutoff_limit_high) + if CUTOFF_RANGE_LOW < r < cutoff_limit_high: + return r + except ValueError: + pass + return def find_all_eqodds_point(poscounts, negcounts, xsamples): cycles_to_try = np.where((poscounts.sum(axis=1) >= MIN_SPOTS_FOR_DIST) & @@ -156,7 +160,9 @@ def calculate_optimal_cutoffs(sigdists, tiles): tile_cutoffs_inferred = {} for tileid, tile_cutoffs in tile_cutoffs.items(): cutoffs = tile_cutoffs.copy() - for c in set(all_cycles) - set(tile_cutoffs.keys()): + determined_cycles = set(cycle for cycle, cutoff in cutoffs.items() + if cutoff is not None) + for c in set(all_cycles) - determined_cycles: cutoffs[c] = runwide_cutoffs_inferred[c] tile_cutoffs_inferred[tileid] = cutoffs