Skip to content

Commit

Permalink
Update SQL for non-priority case in cell plot (#384)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
lingyun1010 authored Apr 9, 2024
1 parent 092fea1 commit a5c044d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,16 @@ public List<String> 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<String, List<JsonObject>> fetchDefaultPlotMethodWithParameterisation(String experimentAccession) {
var namedParameters = ImmutableMap.of("experiment_accession", experimentAccession);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit a5c044d

Please sign in to comment.