-
Notifications
You must be signed in to change notification settings - Fork 591
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 |
import org.cbioportal.model.GisticToGene; | ||
import org.cbioportal.model.MolecularProfile; | ||
import org.cbioportal.model.MutSig; | ||
import org.cbioportal.model.*; |
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.
Could you release the imports so they're not abbreviated? In this case we would know which classes are being used. If it's a auto feature in the IDE it can be turned off.
@@ -280,6 +281,21 @@ private <S extends AlterationCountBase> Pair<List<S>, Long> getAlterationGeneCou | |||
} | |||
AlterationCountServiceUtil.setupAlterationGeneCountsMap(studyAlterationCountByGenes, totalResult); | |||
}); | |||
|
|||
// Update number of profiled case considering the whole selected sample cohort |
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.
For this second part it looks mostly duplicated from above old code. Is this intended? Could you elaborate?
totalResult.put(key, datum); | ||
} | ||
}); | ||
} | ||
|
||
public static <S extends AlterationCountBase> void updateAlterationGeneCountsMap( |
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.
Also some comments explaining this function would be great. We're implementing new coding guidelines so it'll help us to add JavaDocs in the future. Thanks
Hi @eugeniomazzone I left some more comments. Also I'm seeing there're 5 new issues from SonarQube results. Could you see to address that? Thank you! |
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: