Skip to content

Commit 633e098

Browse files
authored
Ignore F-to-F sample type label updates (#127)
Ignore updates to labels if the sample type abbreviation for the new and existing label are both F. These are not meaningful changes. An exception is made if there are changes to the CMO patient ID prefix. Signed-off-by: Angelica Ochoa <15623749+ao508@users.noreply.github.com>
1 parent f5df93d commit 633e098

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

src/main/java/org/mskcc/smile/service/impl/CmoLabelGeneratorServiceImpl.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ private static Map<CmoSampleClass, String> initCmoSampleClassAbbrevMap() {
120120
* 1. cmo patient id prefix
121121
* 2. sample type abbreviation
122122
* 3. nucleic acid abbreviation
123+
* Note: if an existing label and the updated label both have sample type abbreviation 'F'
124+
* then keep the existing label since update is not meaningful to begin with
123125
* @param newCmoLabel
124126
* @param existingCmoLabel
125127
* @return Boolean
@@ -155,28 +157,36 @@ public Boolean igoSampleRequiresLabelUpdate(String newCmoLabel, String existingC
155157
+ "from database. Sample will be published to IGO_SAMPLE_UPDATE topic.");
156158
return Boolean.TRUE;
157159
}
160+
158161
// compare sample type abbreviation
159-
if (!compareMatcherGroups(matcherNewLabel, matcherExistingLabel, CMO_SAMPLE_TYPE_ABBREV_GROUP)) {
160-
String newSampleType = parseSampleTypeAbbrevFromCmoLabel(newCmoLabel);
161-
String existingSampleType = parseSampleTypeAbbrevFromCmoLabel(existingCmoLabel);
162+
Boolean isMatchingSampleTypeAbbrev = compareMatcherGroups(matcherNewLabel,
163+
matcherExistingLabel, CMO_SAMPLE_TYPE_ABBREV_GROUP);
164+
String newSampleType = parseSampleTypeAbbrevFromCmoLabel(newCmoLabel);
165+
String existingSampleType = parseSampleTypeAbbrevFromCmoLabel(existingCmoLabel);
166+
if (!isMatchingSampleTypeAbbrev) {
162167
if (!isSameKindOfSampleTypeAbbreviation(newSampleType, existingSampleType)) {
163168
LOG.info("Sample Type abbreviation differs between incoming IGO sample and matching IGO "
164169
+ "sample from database. Sample will be published to IGO_SAMPLE_UPDATE topic.");
165170
return Boolean.TRUE;
166171
}
172+
} else if (isMatchingSampleTypeAbbrev && existingSampleType.equals("F")) {
173+
return Boolean.FALSE;
167174
}
175+
168176
// compare sample counter (may change if alt id numbering corrections are being made)
169177
if (!compareMatcherGroups(matcherNewLabel, matcherExistingLabel, CMO_SAMPLE_COUNTER_GROUP)) {
170178
LOG.info("Sample Type counter differs between incoming IGO sample and matching IGO sample "
171179
+ "from database. Sample will be published to IGO_SAMPLE_UPDATE topic.");
172180
return Boolean.TRUE;
173181
}
182+
174183
// compare nucleic acid abbreviation
175184
if (!compareMatcherGroups(matcherNewLabel, matcherExistingLabel, CMO_SAMPLE_NUCACID_ABBREV_GROUP)) {
176185
LOG.info("Nucleic Acid abbreviation differs between incoming IGO sample and matching IGO sample "
177186
+ "from database. Sample will be published to IGO_SAMPLE_UPDATE topic.");
178187
return Boolean.TRUE;
179188
}
189+
180190
// compare nucleic acid counter (may change if alt id numbering corrections are being made)
181191
if (!compareNucleicAcidCounterGroups(matcherNewLabel, matcherExistingLabel)) {
182192
LOG.info("Nucleic Acid counter differs between incoming IGO sample and matching IGO sample "

src/test/java/org/mskcc/smile/CmoLabelGeneratorServiceTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,30 @@ public void testLabelRequiresUpdate() throws Exception {
500500
Assertions.assertTrue(requiresUpdate);
501501
}
502502

503+
@Test
504+
public void testSampleTypeFLabelRequiresUpdateChecks() throws Exception {
505+
// existing label for comparison
506+
String existingLabel = "C-MPJKLE-F002-d01";
507+
508+
// does not require an update
509+
String newLabel1 = "C-MPJKLE-F001-d01";
510+
Boolean requiresUpdate1 = cmoLabelGeneratorService.igoSampleRequiresLabelUpdate(newLabel1,
511+
existingLabel);
512+
Assertions.assertFalse(requiresUpdate1);
513+
514+
// requires an update because sample type T is a meaningful change
515+
String newLabel2 = "C-MPJKLE-T001-d01";
516+
Boolean requiresUpdate2 = cmoLabelGeneratorService.igoSampleRequiresLabelUpdate(newLabel2,
517+
existingLabel);
518+
Assertions.assertTrue(requiresUpdate2);
519+
520+
// requires an update because cmo patient id change is meaningful even though sample types are both F
521+
String newLabel3 = "C-ABCDEF-F001-d01";
522+
Boolean requiresUpdate3 = cmoLabelGeneratorService.igoSampleRequiresLabelUpdate(newLabel3,
523+
existingLabel);
524+
Assertions.assertTrue(requiresUpdate3);
525+
}
526+
503527
@Test
504528
public void testUpdateToSampleType() throws Exception {
505529
SampleMetadata sample1ExistingData = initSampleMetadata("SAMPLE_A_1", "C-BRC0DE-F001-d01",

0 commit comments

Comments
 (0)