From 753f7da6a468606aa672235c839054e3b913ac83 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 24 Mar 2022 20:00:52 +0000 Subject: Fix qtlreaper results sorting to deal with M as chromosome (should be at the end) Not sure how best to do this; I just had the sort algorithm change "M" to "z" (which will always be sorted last, behind X and Y) --- wqflask/wqflask/marker_regression/qtlreaper_mapping.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3 From 1964871492efdb09b0c85861fb4d9018acdfb7e6 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 24 Mar 2022 20:02:59 +0000 Subject: Check if there's only one coordinate for interval mapping This is meant to deal with edge cases where there's only a single coordinate for a chromosome when doing interval mapping (which causes an error, since interval mapping requires that markers be linked within each chromosome) --- wqflask/wqflask/marker_regression/display_mapping_results.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3