From 5c68a6dc03035699a250d43bf0da416d72d1fd0e Mon Sep 17 00:00:00 2001 From: adkinsrs Date: Fri, 5 Jan 2024 15:18:04 -0500 Subject: [PATCH] bugfixes --- www/cgi/get_dataset_comparison.cgi | 9 +++++++-- www/js/compare_datasets.v2.js | 8 +++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/www/cgi/get_dataset_comparison.cgi b/www/cgi/get_dataset_comparison.cgi index e9b07ba9..7325dbba 100755 --- a/www/cgi/get_dataset_comparison.cgi +++ b/www/cgi/get_dataset_comparison.cgi @@ -85,8 +85,13 @@ def main(): # add the composite column for ranked grouping if perform_ranking == True: - sc.pp.filter_cells(adata, min_genes=10) - sc.pp.filter_genes(adata, min_cells=1) + try: + # TODO: Had the tool crash here and apache restart resolved it. Need to investigate. + sc.pp.filter_cells(adata, min_genes=10) + sc.pp.filter_genes(adata, min_cells=1) + except Exception as e: + msg = "scanpy.pp.filter_cells or scanpy.pp.filter_genes failed.\n{}".format(str(e)) + return_error_response(msg) try: sc.tl.rank_genes_groups(adata, "compare", groups=["x"], reference="y", n_genes=0, rankby_abs=False, copy=False, method=statistical_test, corr_method='benjamini-hochberg', log_transformed=False) diff --git a/www/js/compare_datasets.v2.js b/www/js/compare_datasets.v2.js index b73d8be3..626fe356 100644 --- a/www/js/compare_datasets.v2.js +++ b/www/js/compare_datasets.v2.js @@ -372,11 +372,8 @@ const fetchAggregations = async (datasetId, analysisId, filters) => { const fetchDatasetComparison = async (datasetId, filters, compareKey, conditionX, conditionY, foldChangeCutoff, stDevNumCutoff, logBase, statisticalTestAction) => { try { return await apiCallsMixin.fetchDatasetComparison(datasetId, filters, compareKey, conditionX, conditionY, foldChangeCutoff, stDevNumCutoff, logBase, statisticalTestAction); - return data; } catch (error) { - logErrorInConsole(error); const msg = "Could not fetch dataset comparison. Please contact the gEAR team." - createToast(msg); throw new Error(msg); } } @@ -657,10 +654,11 @@ const plotDataToGraph = (data) => { type: "scatter", text: passing.labels, marker: { - color: [].fill(passColor, 0, passing.x.length), size: 4, }, } + + passingObj.marker.color = new Array(passingObj.x.length).fill(passColor, 0, passingObj.x.length); const failingObj = { id: failing.id, pvals: failing.pvals, @@ -672,10 +670,10 @@ const plotDataToGraph = (data) => { type: "scatter", text: failing.labels, marker: { - color: [].fill(failColor, 0, failing.x.length), size: 4, }, } + failingObj.marker.color = new Array(failingObj.x.length).fill(failColor, 0, failingObj.x.length); plotData.push(passingObj); plotData.push(failingObj); } else {