From ef11f5e40ec0b8ef90a00b9d98d81cca2ff5d8d9 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 7 Oct 2020 15:58:14 +0300 Subject: Convert cmp function into a key function * wqflask/wqflask/correlation_matrix/show_corr_matrix.py (sortEigenVectors): Convert the comparison function into a key function. See: https://docs.python.org/3/howto/sorting.html#the-old-way-using-the-cmp-parameter --- wqflask/wqflask/correlation_matrix/show_corr_matrix.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py index c0d84aa2..f24b9f7f 100644 --- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py +++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py @@ -28,6 +28,7 @@ import utility.logger from base import data_set from functools import reduce +from functools import cmp_to_key from rpy2.robjects.packages import importr from utility import webqtlUtil @@ -268,7 +269,7 @@ def sortEigenVectors(vector): for item in eigenValues: combines.append([eigenValues[i], eigenVectors[i]]) i += 1 - combines.sort(webqtlUtil.cmpEigenValue) + sorted(combines, key=cmp_to_key(webqtlUtil.cmpEigenValue)) A = [] B = [] for item in combines: -- cgit v1.2.3