-
Notifications
You must be signed in to change notification settings - Fork 537
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add categorical patient level filtering for generic-assay-data-counts (…
…#11155) * Add patient level filtering for aggregation * Patient level filtering works for non-NA * Categorical patient level filtering & clean up * Use new generic assay table schema
- Loading branch information
1 parent
cc16f2c
commit b72ddaa
Showing
12 changed files
with
239 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
src/test/java/org/cbioportal/persistence/mybatisclickhouse/GenericAssayDataCountsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package org.cbioportal.persistence.mybatisclickhouse; | ||
|
||
import org.cbioportal.model.GenericAssayDataCount; | ||
import org.cbioportal.model.GenericAssayDataCountItem; | ||
import org.cbioportal.persistence.helper.StudyViewFilterHelper; | ||
import org.cbioportal.persistence.mybatisclickhouse.config.MyBatisConfig; | ||
import org.cbioportal.web.parameter.GenericAssayDataFilter; | ||
import org.cbioportal.web.parameter.StudyViewFilter; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.test.annotation.DirtiesContext; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
import java.util.List; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@RunWith(SpringRunner.class) | ||
@Import(MyBatisConfig.class) | ||
@DataJpaTest | ||
@DirtiesContext | ||
@AutoConfigureTestDatabase(replace= AutoConfigureTestDatabase.Replace.NONE) | ||
@ContextConfiguration(initializers = AbstractTestcontainers.Initializer.class) | ||
public class GenericAssayDataCountsTest extends AbstractTestcontainers { | ||
|
||
private static final String ACC_TCGA = "acc_tcga"; | ||
private static final String STUDY_GENIE_PUB = "study_genie_pub"; | ||
|
||
@Autowired | ||
private StudyViewMapper studyViewMapper; | ||
|
||
@Test | ||
public void getSampleCategoricalGenericAssayDataCounts() { | ||
StudyViewFilter studyViewFilter = new StudyViewFilter(); | ||
studyViewFilter.setStudyIds(List.of(ACC_TCGA)); | ||
|
||
GenericAssayDataFilter genericAssayDataFilter = new GenericAssayDataFilter("1p_status", "armlevel_cna"); | ||
List<GenericAssayDataCountItem> actualCounts = studyViewMapper.getGenericAssayDataCounts( | ||
StudyViewFilterHelper.build(studyViewFilter, null, null), | ||
List.of(genericAssayDataFilter) | ||
); | ||
|
||
List<GenericAssayDataCountItem> expectedCounts = List.of( | ||
new GenericAssayDataCountItem("1p_status", List.of( | ||
new GenericAssayDataCount("Loss", 1), | ||
new GenericAssayDataCount("Gain", 1), | ||
new GenericAssayDataCount("Unchanged", 1), | ||
new GenericAssayDataCount("NA", 1) | ||
)) | ||
); | ||
|
||
assertThat(actualCounts) | ||
.usingRecursiveComparison() | ||
.ignoringCollectionOrder() | ||
.isEqualTo(expectedCounts); | ||
} | ||
|
||
@Test | ||
public void getPatientCategoricalGenericAssayDataCounts() { | ||
StudyViewFilter studyViewFilter = new StudyViewFilter(); | ||
studyViewFilter.setStudyIds(List.of(STUDY_GENIE_PUB)); | ||
|
||
GenericAssayDataFilter genericAssayDataFilter = new GenericAssayDataFilter("DMETS_DX_ADRENAL", "distant_mets"); | ||
List<GenericAssayDataCountItem> actualCounts = studyViewMapper.getGenericAssayDataCounts( | ||
StudyViewFilterHelper.build(studyViewFilter, null, null), | ||
List.of(genericAssayDataFilter) | ||
); | ||
|
||
List<GenericAssayDataCountItem> expectedCounts = List.of( | ||
new GenericAssayDataCountItem("DMETS_DX_ADRENAL", List.of( | ||
new GenericAssayDataCount("No", 9), | ||
new GenericAssayDataCount("Yes", 1), | ||
new GenericAssayDataCount("NA", 14) | ||
)) | ||
); | ||
|
||
assertThat(actualCounts) | ||
.usingRecursiveComparison() | ||
.ignoringCollectionOrder() | ||
.isEqualTo(expectedCounts); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.