From a5c044d01b82dda3808da0181461d87287b100df Mon Sep 17 00:00:00 2001 From: Lingyun Zhao <33519183+lingyun1010@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:49:14 +0100 Subject: [PATCH] Update SQL for non-priority case in cell plot (#384) * Update SQL for non-priority case in cell plot * Update test for unique cell plot methods * Update UMAP and t-SNE format in test * Debug default parameter and method SQL * Remove the hard code test on cell plot method test --- .../ebi/atlas/experimentpage/cellplot/CellPlotDao.java | 6 ++++-- .../atlas/experimentpage/cellplot/CellPlotDaoIT.java | 10 +--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/uk/ac/ebi/atlas/experimentpage/cellplot/CellPlotDao.java b/app/src/main/java/uk/ac/ebi/atlas/experimentpage/cellplot/CellPlotDao.java index aa62448a0..9b9b0eaa8 100644 --- a/app/src/main/java/uk/ac/ebi/atlas/experimentpage/cellplot/CellPlotDao.java +++ b/app/src/main/java/uk/ac/ebi/atlas/experimentpage/cellplot/CellPlotDao.java @@ -157,14 +157,16 @@ public List fetchCellPlotParameter(String experimentAccession, String me private static final String SELECT_DEFAULT_PLOT_METHOD_AND_PARAMETERISATION = - "SELECT dr.method, jsonb_array_elements(dr.parameterisation) parameterisation " + + "SELECT DISTINCT dr.method, jsonb_array_elements(dr.parameterisation) parameterisation " + "FROM scxa_dimension_reduction dr " + "JOIN (SELECT method, max(priority) as prt " + "FROM scxa_dimension_reduction " + "WHERE experiment_accession=:experiment_accession " + " GROUP BY method) fi " + "ON dr.method = fi.method " + - "AND dr.priority = fi.prt"; + "AND dr.priority = fi.prt " + + "WHERE experiment_accession=:experiment_accession " + + "ORDER BY parameterisation"; public Map> fetchDefaultPlotMethodWithParameterisation(String experimentAccession) { var namedParameters = ImmutableMap.of("experiment_accession", experimentAccession); diff --git a/app/src/test/java/uk/ac/ebi/atlas/experimentpage/cellplot/CellPlotDaoIT.java b/app/src/test/java/uk/ac/ebi/atlas/experimentpage/cellplot/CellPlotDaoIT.java index 14ea14d0e..1652bcc43 100644 --- a/app/src/test/java/uk/ac/ebi/atlas/experimentpage/cellplot/CellPlotDaoIT.java +++ b/app/src/test/java/uk/ac/ebi/atlas/experimentpage/cellplot/CellPlotDaoIT.java @@ -173,15 +173,7 @@ void fetchExpressionPlotWithInvalidGeneIdHasNoExpression(String experimentAccess parameterisation)) .allSatisfy(dto -> assertThat(dto).hasFieldOrPropertyWithValue("expressionLevel", 0.0)); } - - @Test - void fetchDefaultPlotMethodAndParameterisationForTheExistingExperiment() { - var defaultPlotMethodResult = subject.fetchDefaultPlotMethodWithParameterisation( - jdbcTestUtils.fetchExperimentAccessionByMaxPriority()); - - assertThat(defaultPlotMethodResult.keySet()).contains("umap","tsne"); - } - + @Test void fetchEmptyResultsIfExperimentDoesNotHaveDefaultPlotMethod(){ assertThat(subject.fetchDefaultPlotMethodWithParameterisation("fooBar"))