Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dippindots committed Aug 29, 2024
1 parent e4fd443 commit 61b2b9c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ public interface StudyViewMapper {
Map<String, Integer> getMutationCounts(StudyViewFilterHelper studyViewFilterHelper, GenomicDataFilter genomicDataFilter);

List<GenomicDataCountItem> getMutationCountsByType(StudyViewFilterHelper studyViewFilterHelper, List<GenomicDataFilter> genomicDataFilters);

// TODO: update this with new parameters

List<ClinicalDataCount> getGenomicDataBinCounts(StudyViewFilterHelper studyViewFilterHelper, List<String> attributeIds);
List<ClinicalDataCount> getGenericAssayDataBinCounts(StudyViewFilterHelper studyViewFilterHelper, List<String> attributeIds);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ public <T extends DataBinCountFilter, S extends DataBinFilter, U extends DataBin
List<ClinicalDataCountItem> filteredClinicalDataCounts;
Map<String, ClinicalDataType> attributeDatatypeMap;
switch (dataBinCountFilter) {
// TODO: this is to support clinical data, but clinical data is not using this now. We should update controller to use this method later
case ClinicalDataBinCountFilter clinicalDataBinCountFilter -> {
unfilteredClinicalDataCounts = studyViewColumnarService.getClinicalDataCounts(partialFilter, uniqueKeys);
filteredClinicalDataCounts = studyViewColumnarService.getClinicalDataCounts(studyViewFilter, uniqueKeys);
// TODO: only do this for clinical data, because all genomic data and generic assay data are currently no patient level data
attributeDatatypeMap = studyViewColumnarService.getClinicalAttributeDatatypeMap();
}
case GenomicDataBinCountFilter genomicDataBinCountFilter -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,34 +722,25 @@ public List<String> getUniqkeyKeys(List<String> studyIds, List<String> caseIds)

public <T extends DataBinCountFilter, S extends DataBinFilter, U extends DataBin> List<U> getDataBins(
DataBinMethod dataBinMethod, T dataBinCountFilter) {
// get data bin filters based on the type of the filter
// either Genomic data or Generic Assay data
List<S> dataBinFilters = fetchDataBinFilters(dataBinCountFilter);

StudyViewFilter studyViewFilter = dataBinCountFilter.getStudyViewFilter();

if (dataBinFilters.size() == 1) {
removeSelfFromFilter(dataBinFilters.get(0), studyViewFilter);
}

// define result variables
List<U> resultDataBins;
List<String> filteredSampleIds = new ArrayList<>();
List<String> filteredStudyIds = new ArrayList<>();

// fetchData will fetch data from different services based on the type of the filter
// either Genomic data or Generic Assay data
// data been fetched and cast as Clinical data, then
List<Binnable> filteredData = fetchData(dataBinCountFilter, studyViewFilter, filteredSampleIds,
filteredStudyIds);

List<String> filteredUniqueSampleKeys = getUniqkeyKeys(filteredStudyIds, filteredSampleIds);

// data grouped by entity id
Map<String, List<Binnable>> filteredClinicalDataByAttributeId = filteredData.stream()
.collect(Collectors.groupingBy(Binnable::getAttrId));

// Dynamic is the default binning method

if (dataBinMethod == DataBinMethod.STATIC) {

StudyViewFilter filter = studyViewFilter == null ? null : new StudyViewFilter();
Expand All @@ -760,8 +751,6 @@ public <T extends DataBinCountFilter, S extends DataBinFilter, U extends DataBin

List<String> unfilteredSampleIds = new ArrayList<>();
List<String> unfilteredStudyIds = new ArrayList<>();
// get unfiltered data
// TODO: maybe we can try to optimize this step
List<Binnable> unfilteredData = fetchData(dataBinCountFilter, filter, unfilteredSampleIds,
unfilteredStudyIds);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,16 +566,9 @@
count(value) as count
FROM genetic_alteration_derived_gaofei
<where>
-- type='sample' AND
<include refid="applyStudyViewFilter">
<property name="filter_type" value="'SAMPLE_ID_ONLY'"/>
</include>
<!-- <if test="filteredAttributeValues != null and !filteredAttributeValues.isEmpty()">-->
<!-- AND UPPER(value) NOT IN-->
<!-- <foreach item="filteredAttributeValue" collection="filteredAttributeValues" open="(" separator="," close=")">-->
<!-- #{filteredAttributeValue}-->
<!-- </foreach>-->
<!-- </if>-->
AND concat(hugo_gene_symbol, profile_type) IN
<foreach item="attributeId" collection="attributeIds" open="(" separator="," close=")">
#{attributeId}
Expand All @@ -594,16 +587,9 @@
count(value) as count
FROM generic_assay_data_derived_gaofei
<where>
-- type='sample' AND
<include refid="applyStudyViewFilter">
<property name="filter_type" value="'SAMPLE_ID_ONLY'"/>
</include>
<!-- <if test="filteredAttributeValues != null and !filteredAttributeValues.isEmpty()">-->
<!-- AND UPPER(value) NOT IN-->
<!-- <foreach item="filteredAttributeValue" collection="filteredAttributeValues" open="(" separator="," close=")">-->
<!-- #{filteredAttributeValue}-->
<!-- </foreach>-->
<!-- </if>-->
AND concat(entity_stable_id, profile_type) IN
<foreach item="attributeId" collection="attributeIds" open="(" separator="," close=")">
#{attributeId}
Expand Down

0 comments on commit 61b2b9c

Please sign in to comment.