Skip to content

Commit

Permalink
Rename and codument better method to updateCaseLists
Browse files Browse the repository at this point in the history
  • Loading branch information
forus committed Jun 27, 2024
1 parent 28dfa05 commit 2dd1e62
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void run() {
this.caseListSampleIdToSampleIds.put(cancerStudyStableId + "_all", this.allSampleIds);
Map<String, Set<String>> readCaseListSampleIds = readCaseListFiles();
this.caseListSampleIdToSampleIds.putAll(readCaseListSampleIds);
updateCaseLists(this.caseListSampleIdToSampleIds);
updateCaseListsForTheStudy(this.caseListSampleIdToSampleIds);
}

private Map<String, Set<String>> readCaseListFiles() {
Expand All @@ -96,7 +96,20 @@ private Map<String, Set<String>> readCaseListFiles() {
return result;
}

private void updateCaseLists(Map<String, Set<String>> caseListSampleIdToSampleIds) {
/**
* Updates the sample lists according to the steps below:
*
* 1. New sample IDs provided in the `caseListSampleIdToSampleIds` map are added to their corresponding case lists.
* 2. These sample IDs are removed from any other case lists within the same study.
*
* @param caseListSampleIdToSampleIds A map where the key is the case list stable ID and the value is a set of sample IDs
* to be added to the corresponding case list.
* Note: This map only includes the case lists that need to be updated with new sample IDs.
* Existing case lists in the study that are not in the map will not be dropped,
* but the provided sample IDs will be removed from these lists if present.
* @throws RuntimeException if any DAO operations fail or if a case list with a specified stable ID is not found.
*/
private void updateCaseListsForTheStudy(Map<String, Set<String>> caseListSampleIdToSampleIds) {
DaoCancerStudy.reCacheAll();
try {
for (Map.Entry<String, Set<String>> caseListStableIdToSampleIds : caseListSampleIdToSampleIds.entrySet()) {
Expand Down

0 comments on commit 2dd1e62

Please sign in to comment.