diff options
-rw-r--r-- | wqflask/base/trait.py | 1 | ||||
-rw-r--r-- | wqflask/wqflask/collect.py | 23 | ||||
-rw-r--r-- | wqflask/wqflask/marker_regression/display_mapping_results.py | 2 | ||||
-rw-r--r-- | wqflask/wqflask/marker_regression/qtlreaper_mapping.py | 11 | ||||
-rw-r--r-- | wqflask/wqflask/partial_correlations_views.py | 2 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js | 2 |
6 files changed, 33 insertions, 8 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index f0749858..ee5dda38 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -94,6 +94,7 @@ class GeneralTrait: self.num_overlap = None self.strand_probe = None self.symbol = None + self.abbreviation = None self.display_name = self.name self.LRS_score_repr = "N/A" diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index 815bb7c1..de61323a 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -200,18 +200,33 @@ def trait_info_str(trait): return (trt.symbol or trt.abbreviation or "N/A")[:20] def __lrs(trt): - return ( - f"{float(trait.LRS_score_repr):0.3f}" if float(trait.LRS_score_repr) > 0 - else f"{trait.LRS_score_repr}") + if trait.dataset.type == "Geno": + return 0 + else: + return ( + f"{float(trait.LRS_score_repr):0.3f}" if float(trait.LRS_score_repr) > 0 + else f"{trait.LRS_score_repr}") + + def __lrs_location(trt): + if hasattr(trt, "LRS_location_repr"): + return trt.LRS_location_repr + else: + return "N/A" def __location(trt): if hasattr(trt, "location_repr"): return trt.location_repr return None + def __mean(trt): + if trait.mean: + return trt.mean + else: + return 0 + return "{}|||{}|||{}|||{}|||{}|||{:0.3f}|||{}|||{}".format( trait.name, trait.dataset.name, __trait_desc(trait), __symbol(trait), - __location(trait), trait.mean, __lrs(trait), trait.LRS_location_repr) + __location(trait), __mean(trait), __lrs(trait), __lrs_location(trait)) @app.route("/collections/view") def view_collection(): diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 920a8d30..034c352b 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -2637,7 +2637,7 @@ class DisplayMappingResults: break m += 1 - if self.manhattan_plot != True: + if self.manhattan_plot != True and len(LRSCoordXY) > 1: draw_open_polygon(canvas, xy=LRSCoordXY, outline=thisLRSColor, width=lrsEdgeWidth) diff --git a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py index 801674e1..c4b495d7 100644 --- a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py +++ b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py @@ -183,7 +183,16 @@ def natural_sort(marker_list): Function to naturally sort numbers + strings, adopted from user Mark Byers here: https://stackoverflow.com/questions/4836710/does-python-have-a-built-in-function-for-string-natural-sort Changed to return indices instead of values, though, since the same reordering needs to be applied to bootstrap results """ - convert = lambda text: int(text) if text.isdigit() else text.lower() + + def convert(text): + if text.isdigit(): + return int(text) + else: + if text != "M": + return text.lower() + else: + return "z" + alphanum_key = lambda key: [convert(c) for c in re.split( '([0-9]+)', str(marker_list[key]['chr']))] return sorted(list(range(len(marker_list))), key=alphanum_key) diff --git a/wqflask/wqflask/partial_correlations_views.py b/wqflask/wqflask/partial_correlations_views.py index 659b49e9..41bbe7d7 100644 --- a/wqflask/wqflask/partial_correlations_views.py +++ b/wqflask/wqflask/partial_correlations_views.py @@ -236,7 +236,7 @@ def partial_correlations(): } return handle_response(requests.post( url=f"{GN_SERVER_URL}api/correlation/partial", - json=json.dumps(post_data))) + json=post_data)) for error in args["errors"]: flash(error, "alert-danger") diff --git a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js index 1bae8773..4a8b724d 100644 --- a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js +++ b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js @@ -108,7 +108,7 @@ var sr_layout = { xanchor: 'right', y: 1.05, yanchor: 'top', - text: '<i>r</i> = ' + js_data.srr_value.toFixed(3) + ', <i>P</i> = ' + js_data.srp_value.toExponential(3) + ', <i>n</i> = ' + js_data.num_overlap, + text: '<i>rho</i> = ' + js_data.srr_value.toFixed(3) + ', <i>P</i> = ' + js_data.srp_value.toExponential(3) + ', <i>n</i> = ' + js_data.num_overlap, showarrow: false, font: { size: 14 |