-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for frequency in multi-study view #11331
base: master
Are you sure you want to change the base?
Conversation
@inodb Eugenio worked on fixing one of the open issues, could you point us to some potential reviewers please? |
List<S> studyAlterationCountByGenes = dataFetcher.apply(studyMolecularProfileCaseIdentifiers); | ||
if (includeFrequency) { | ||
Long studyProfiledCasesCount = includeFrequencyFunction.apply(studyMolecularProfileCaseIdentifiers, studyAlterationCountByGenes); | ||
profiledCasesCount.updateAndGet(v -> v + studyProfiledCasesCount); | ||
} | ||
Map<String, S> studyResult = new HashMap<>(); | ||
studyAlterationCountByGenes.forEach(datum -> { | ||
String key = datum.getUniqueEventKey(); | ||
studyResult.put(key, datum); | ||
}); | ||
List<S> allGene= new ArrayList<>(totalResult.values()); | ||
allGene.forEach(datum -> { | ||
String key = datum.getUniqueEventKey(); | ||
S alterationCountByGene = totalResult.get(key); | ||
alterationCountByGene.setNumberOfProfiledCases(alterationCountByGene.getNumberOfProfiledCases() + studyMolecularProfileCaseIdentifiers.size()); | ||
Set<String> matchingGenePanelIds = new HashSet<>(); | ||
if (!alterationCountByGene.getMatchingGenePanelIds().isEmpty()) { | ||
matchingGenePanelIds.addAll(alterationCountByGene.getMatchingGenePanelIds()); | ||
} | ||
if (!datum.getMatchingGenePanelIds().isEmpty()) { | ||
matchingGenePanelIds.addAll(datum.getMatchingGenePanelIds()); | ||
} | ||
alterationCountByGene.setMatchingGenePanelIds(matchingGenePanelIds); | ||
totalResult.put(key, alterationCountByGene); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets break this out into functions instead of one big anonymous function. Also, can we add some comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the code to a separate function updateAlterationGeneCountsMap mimicking setupAlterationGeneCountsMap (see new commit at https://github.com/eugeniomazzone/cbioportal/tree/master)
@@ -148,7 +148,8 @@ public static <S extends AlterationCountBase> void setupAlterationGeneCountsMap( | |||
S alterationCountByGene = totalResult.get(key); | |||
alterationCountByGene.setTotalCount(alterationCountByGene.getTotalCount() + datum.getTotalCount()); | |||
alterationCountByGene.setNumberOfAlteredCases(alterationCountByGene.getNumberOfAlteredCases() + datum.getNumberOfAlteredCases()); | |||
alterationCountByGene.setNumberOfProfiledCases(alterationCountByGene.getNumberOfProfiledCases() + datum.getNumberOfProfiledCases()); | |||
alterationCountByGene.setNumberOfProfiledCases(0); | |||
//alterationCountByGene.setNumberOfProfiledCases(alterationCountByGene.getNumberOfProfiledCases() + datum.getNumberOfProfiledCases()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it just commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old line is now removed (see new commit at https://github.com/eugeniomazzone/cbioportal/tree/master)
Tests are not passing. Could you run |
It looks like legacy is not reporting "not_profiled" status correctly. Compare the following curl with /api/ vs /api/column-store/ and you'll see the difference. The legacy implementation in master does report the not-profiled samples.
|
Today, I've looked at the tests (haven't done that before). I've added the new function to the tests and I've initialized a MolecularProfileCaseIdentifier with generic names for each sample to make it work. Finally, it's now specified that some function are called twice. |
Quality Gate passedIssues Measures |
Fix #10967
Describe changes proposed in this pull request:
After the fix, the frequency displayed on the multi-study view appear to be correct as it's 23.8% as expected instead of 100%.
Before fix:
After fix: