Skip to content

Commit

Permalink
Merge pull request #1 from sgicbpc/cna_util_store_cna_events_performa…
Browse files Browse the repository at this point in the history
…nce_improvement

Optimize CnaEvent lookup and storage in CnaUtil
  • Loading branch information
JREastonMarks authored Feb 13, 2024
2 parents 8515c49 + 9ce5721 commit f576a2b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main/java/org/mskcc/cbio/portal/util/CnaUtil.java
Original file line number Diff line number Diff line change
@@ -53,16 +53,14 @@ public static void storeCnaEvents(
if (!CNA.AMP.equals(cnaEvent.getAlteration()) && !CNA.HOMDEL.equals(cnaEvent.getAlteration())) {
continue;
}
Optional<CnaEvent.Event> existingCnaEvent = existingCnaEvents
.stream()
.filter(e -> e.equals(cnaEvent.getEvent()))
.findFirst();
if (existingCnaEvent.isPresent()) {
cnaEvent.setEventId(existingCnaEvent.get().getEventId());

CnaEvent.Event event = cnaEvent.getEvent()
if (existingCnaEvents.contains(event)) {
cnaEvent.setEventId(event.getEventId());
DaoCnaEvent.addCaseCnaEvent(cnaEvent, false);
} else {
DaoCnaEvent.addCaseCnaEvent(cnaEvent, true);
existingCnaEvents.add(cnaEvent.getEvent());
existingCnaEvents.add(event);
}
}
}

0 comments on commit f576a2b

Please sign in to comment.