From 3c6f1cfa26be7985de6b13c436dfaa6dddb46288 Mon Sep 17 00:00:00 2001 From: ao508 <15623749+ao508@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:02:59 -0800 Subject: [PATCH] Init commit - alt id support (#87) (#90) Use ALT IDs when assigning sample counter to CMO labels - Uses samples matching a given ALT ID when assigning sample counters in CMO labels - Updated mock data and added unit tests - Updated smile-server version Signed-off-by: Angelica Ochoa <15623749+ao508@users.noreply.github.com> --- pom.xml | 2 +- .../service/CmoLabelGeneratorService.java | 6 +- .../impl/CmoLabelGeneratorServiceImpl.java | 162 ++++++++--- .../LabelGenMessageHandlingServiceImpl.java | 24 +- .../impl/RequestReplyHandlingServiceImpl.java | 18 +- .../resources/application.properties.EXAMPLE | 1 + .../smile/CmoLabelGeneratorServiceTest.java | 217 ++++++++------ .../PortedLimsRestCmoLabelGenerationTest.java | 87 ++++-- ...d_request1_all_samples_missing_fastqs.json | 16 ++ ...mocked_request1_complete_tumor_normal.json | 16 ++ ...mplete_tumor_normal_updated_libraries.json | 268 ++++++++++++++++++ ...mocked_request1_sample_missing_fastqs.json | 16 ++ ...equest1_updated_complete_tumor_normal.json | 20 +- ...ed_request1a_sample_type_abbreviation.json | 16 ++ ...d_request1b_nucleic_acid_abbreviation.json | 16 ++ .../mocked_request1c_missing_all_samples.json | 16 ++ .../mocked_request1d_missing_few_samples.json | 16 ++ .../mocked_request1e_null_string_baitset.json | 16 ++ ...d_request2a_one_empty_sample_metadata.json | 4 + .../mocked_request2a_one_normal.json | 4 + .../mocked_request2b_missing_one_normal.json | 84 ++++++ .../mocked_request3_pooled_normals.json | 16 ++ .../mocked_request4_null_or_empty_values.json | 16 ++ .../mocked_request5_pt_multi_samples.json | 24 ++ .../mocked_request6_cmopt_after_swap.json | 16 ++ .../mocked_request6_cmopt_swap.json | 16 ++ .../mocked_request8_duplicate_cmo_labels.json | 150 ++++++++++ .../data/mocked_request_data_details.txt | 3 + ..._mocked_request8_duplicate_cmo_labels.json | 214 ++++++++++++++ 29 files changed, 1320 insertions(+), 160 deletions(-) create mode 100644 src/test/resources/data/incoming_requests/mocked_request1_complete_tumor_normal_updated_libraries.json create mode 100644 src/test/resources/data/incoming_requests/mocked_request8_duplicate_cmo_labels.json create mode 100644 src/test/resources/data/published_requests/outgoing_mocked_request8_duplicate_cmo_labels.json diff --git a/pom.xml b/pom.xml index b8edb5b..782802e 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,7 @@ 2.0.0.RELEASE com.github.mskcc.smile-server - 2.0.2.RELEASE + 2.1.0.RELEASE diff --git a/src/main/java/org/mskcc/smile/service/CmoLabelGeneratorService.java b/src/main/java/org/mskcc/smile/service/CmoLabelGeneratorService.java index 9604b94..ffff70e 100644 --- a/src/main/java/org/mskcc/smile/service/CmoLabelGeneratorService.java +++ b/src/main/java/org/mskcc/smile/service/CmoLabelGeneratorService.java @@ -12,8 +12,10 @@ */ public interface CmoLabelGeneratorService { String generateCmoSampleLabel(String requestId, - IgoSampleManifest sampleManifest, List existingPatientSamples); - String generateCmoSampleLabel(SampleMetadata sample, List existingPatientSamples); + IgoSampleManifest sampleManifest, List existingPatientSamples, + List samplesByAltId); + String generateCmoSampleLabel(SampleMetadata sample, List existingPatientSamples, + List samplesByAltId); Status generateSampleStatus(String requestId, IgoSampleManifest sampleManifest, List existingSamples) throws JsonProcessingException; Status generateSampleStatus(SampleMetadata sampleMetadata, diff --git a/src/main/java/org/mskcc/smile/service/impl/CmoLabelGeneratorServiceImpl.java b/src/main/java/org/mskcc/smile/service/impl/CmoLabelGeneratorServiceImpl.java index 75e356b..1ecce26 100644 --- a/src/main/java/org/mskcc/smile/service/impl/CmoLabelGeneratorServiceImpl.java +++ b/src/main/java/org/mskcc/smile/service/impl/CmoLabelGeneratorServiceImpl.java @@ -2,7 +2,9 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -166,7 +168,7 @@ private Boolean compareMatcherGroups(Matcher matcher1, Matcher matcher2, Integer @Override public String generateCmoSampleLabel(String requestId, IgoSampleManifest sampleManifest, - List existingSamples) { + List existingSamples, List samplesByAltId) { // if sample is a cellline sample then generate a cmo cellline label if (isCmoCelllineSample(sampleManifest)) { return generateCmoCelllineSampleLabel(requestId, sampleManifest.getInvestigatorSampleId()); @@ -176,7 +178,8 @@ public String generateCmoSampleLabel(String requestId, IgoSampleManifest sampleM String sampleTypeAbbreviation = resolveSampleTypeAbbreviation(sampleManifest); // resolve the sample counter value to use for the cmo label - Integer sampleCounter = resolveSampleIncrementValue(sampleManifest.getIgoId(), existingSamples); + Integer sampleCounter = resolveSampleIncrementValue(sampleManifest.getIgoId(), + existingSamples, samplesByAltId); String paddedSampleCounter = getPaddedIncrementString(sampleCounter, CMO_SAMPLE_COUNTER_STRING_PADDING); @@ -188,7 +191,8 @@ public String generateCmoSampleLabel(String requestId, IgoSampleManifest sampleM return null; } // get next increment for nucleic acid abbreviation - Integer nextNucAcidCounter = getNextNucleicAcidIncrement(nucleicAcidAbbreviation, existingSamples); + Integer nextNucAcidCounter = getNextNucleicAcidIncrement(sampleManifest.getIgoId(), + nucleicAcidAbbreviation, existingSamples, samplesByAltId); String paddedNucAcidCounter = getPaddedIncrementString(nextNucAcidCounter, CMO_SAMPLE_NUCACID_COUNTER_PADDING); @@ -200,7 +204,7 @@ public String generateCmoSampleLabel(String requestId, IgoSampleManifest sampleM @Override public String generateCmoSampleLabel(SampleMetadata sampleMetadata, - List existingSamples) { + List existingSamples, List samplesByAltId) { // if sample is a cellline sample then generate a cmo cellline label if (isCmoCelllineSample(sampleMetadata.getSampleClass(), sampleMetadata.getCmoSampleIdFields())) { return generateCmoCelllineSampleLabel(sampleMetadata.getIgoRequestId(), @@ -218,7 +222,8 @@ public String generateCmoSampleLabel(SampleMetadata sampleMetadata, } // resolve the sample counter value to use for the cmo label - Integer sampleCounter = resolveSampleIncrementValue(sampleMetadata.getPrimaryId(), existingSamples); + Integer sampleCounter = resolveSampleIncrementValue(sampleMetadata.getPrimaryId(), + existingSamples, samplesByAltId); String paddedSampleCounter = getPaddedIncrementString(sampleCounter, CMO_SAMPLE_COUNTER_STRING_PADDING); @@ -234,7 +239,8 @@ public String generateCmoSampleLabel(SampleMetadata sampleMetadata, return null; } // get next increment for nucleic acid abbreviation - Integer nextNucAcidCounter = getNextNucleicAcidIncrement(nucleicAcidAbbreviation, existingSamples); + Integer nextNucAcidCounter = getNextNucleicAcidIncrement(sampleMetadata.getPrimaryId(), + nucleicAcidAbbreviation, existingSamples, samplesByAltId); String paddedNucAcidCounter = getPaddedIncrementString(nextNucAcidCounter, CMO_SAMPLE_NUCACID_COUNTER_PADDING); @@ -437,11 +443,30 @@ private String getPaddedIncrementString(Integer increment, Integer padding) { * @param existingSamples * @return Integer */ - private Integer resolveSampleIncrementValue(String primaryId, List existingSamples) { - if (existingSamples.isEmpty()) { + private Integer resolveSampleIncrementValue(String primaryId, List existingSamples, + List samplesByAltId) { + if (existingSamples.isEmpty() && samplesByAltId.isEmpty()) { return 1; } + // if match isn't found by primary id then attempt to resolve count by checking increments + // of samples with matching alt ids + if (!samplesByAltId.isEmpty()) { + List altIdSampleCounters = new ArrayList<>(); + for (SampleMetadata sample : samplesByAltId) { + Matcher matcher = CMO_SAMPLE_ID_REGEX.matcher(sample.getCmoSampleName()); + if (matcher.find()) { + Integer increment = Integer.valueOf(matcher.group(CMO_SAMPLE_COUNTER_GROUP)); + altIdSampleCounters.add(increment); + } + } + if (altIdSampleCounters.size() == 1) { + return altIdSampleCounters.get(0); + } else { + return Collections.min(altIdSampleCounters); + } + } + // if we find a match by the primary id then return the increment parsed from // the matching sample's current cmo label for (SampleMetadata sample : existingSamples) { @@ -454,8 +479,9 @@ private Integer resolveSampleIncrementValue(String primaryId, List samples) { * from 01-99 (values less < 10 are filled in with zeros '0' to preserve 2-digit format). * From the time of implementation the first sample for a particular Nucleic Acid get 01. * @param nucleicAcidAbbreviation - * @param samples + * @param existingSamples * @return Integer */ - private Integer getNextNucleicAcidIncrement(String nucleicAcidAbbreviation, - List samples) { - if (samples.isEmpty()) { + private Integer getNextNucleicAcidIncrement(String primaryId, String nucleicAcidAbbreviation, + List existingSamples, List samplesByAltId) { + if (existingSamples.isEmpty() && samplesByAltId.isEmpty()) { return 1; } + + if (!samplesByAltId.isEmpty()) { + Integer maxIncrement = 0; + for (SampleMetadata sample : samplesByAltId) { + // ignore samples with empty cmo sample labels + if (StringUtils.isBlank(sample.getCmoSampleName())) { + continue; + } + // skip cell line samples as well + if (CMO_CELLLINE_ID_REGEX.matcher(sample.getCmoSampleName()).find()) { + continue; + } + + // if sample cmo label does not meet matcher criteria then skip + Matcher matcher = CMO_SAMPLE_ID_REGEX.matcher(sample.getCmoSampleName()); + if (!matcher.find()) { + continue; + } + + // skip labels that do not match the current nucleic acid abbreviation + String currentNucAcidAbbreviation = matcher.group(CMO_SAMPLE_NUCACID_ABBREV_GROUP); + if (!currentNucAcidAbbreviation.equals(nucleicAcidAbbreviation)) { + continue; + } + + Integer currentIncrement; + if (matcher.group(CMO_SAMPLE_NUCACID_COUNTER_GROUP) == null + || matcher.group(CMO_SAMPLE_NUCACID_COUNTER_GROUP).isEmpty()) { + currentIncrement = 1; + } else { + currentIncrement = Integer.valueOf(matcher.group(CMO_SAMPLE_NUCACID_COUNTER_GROUP)); + } + + // if primary id match is found then we know that this sample isn't actually being + // reprocessed and likely received some other metadata update that should not affect + // the label generation as far as the nuc acid counter is concerned + if (sample.getPrimaryId().equals(primaryId)) { + return currentIncrement; + } + + // update max increment if needed + if (currentIncrement > maxIncrement) { + maxIncrement = currentIncrement; + } + } + // assuming that this sample primary id does not already exist in the list of samples matching + // the same alt id means that we should use the max increment found + 1 + return maxIncrement + 1; + } + + // handle cases where alt ID hasn't been backfilled yet or maybe it's the first time + // that this alt ID will be appearing in the database + // otherwise extract the max counter from the current set of samples // do not rely on the size of the list having the exact same counter // to prevent accidentally giving samples the same counter - Integer maxIncrement = 0; - for (SampleMetadata sample : samples) { + for (SampleMetadata sample : existingSamples) { // skip samples with null cmo sample name (possible now that we allow all samples to get in db // even if they fail validation and/or fail label generation) if (StringUtils.isBlank(sample.getCmoSampleName())) { - LOG.warn("Skipping patient sample with null CMO sample label: CMO patient ID = " - + sample.getCmoPatientId() + ", sample primary ID = " + sample.getPrimaryId()); continue; } // skip cell line samples if (CMO_CELLLINE_ID_REGEX.matcher(sample.getCmoSampleName()).find()) { continue; } + Matcher matcher = CMO_SAMPLE_ID_REGEX.matcher(sample.getCmoSampleName()); + + // if label doesn't match the cmo label regex pattern then skip + if (!matcher.find()) { + continue; + } // increment assigned to the current sample is in group 3 of matcher - if (matcher.find()) { - // nucleic acid abbreviation determines which counters we consider - // when iterating through sample list - if (!matcher.group(CMO_SAMPLE_NUCACID_ABBREV_GROUP) - .equalsIgnoreCase(nucleicAcidAbbreviation)) { - continue; - } - Integer currentIncrement; - if (matcher.group(CMO_SAMPLE_NUCACID_COUNTER_GROUP) == null - || matcher.group(CMO_SAMPLE_NUCACID_COUNTER_GROUP).isEmpty()) { - currentIncrement = 1; - } else { - currentIncrement = Integer.valueOf(matcher.group(CMO_SAMPLE_NUCACID_COUNTER_GROUP)); - } - if (currentIncrement > maxIncrement) { - maxIncrement = currentIncrement; - } + // nucleic acid abbreviation determines which counters we consider + + // when iterating through sample list if nuc acid doesn't match then move + // on to the next one + if (!matcher.group(CMO_SAMPLE_NUCACID_ABBREV_GROUP) + .equalsIgnoreCase(nucleicAcidAbbreviation)) { + continue; + } + + Integer currentIncrement; + if (matcher.group(CMO_SAMPLE_NUCACID_COUNTER_GROUP) == null + || matcher.group(CMO_SAMPLE_NUCACID_COUNTER_GROUP).isEmpty()) { + currentIncrement = 1; + } else { + currentIncrement = Integer.valueOf(matcher.group(CMO_SAMPLE_NUCACID_COUNTER_GROUP)); + } + + // if primary id match is found then we know that this sample isn't actually being + // reprocessed and likely received some other metadata update that should not affect + // the label generation as far as the nuc acid counter is concerned + if (sample.getPrimaryId().equals(primaryId)) { + return currentIncrement; } } - return maxIncrement + 1; + // always return 1 by default if a primary id match isn't found and we are resolving the + // nuc acid counter since the nuc acid counter should be based on a per-unique sample + // basis and not by total patient samples + return 1; } private String generateCmoCelllineSampleLabel(String requestId, String sampleInvestigatorId) { diff --git a/src/main/java/org/mskcc/smile/service/impl/LabelGenMessageHandlingServiceImpl.java b/src/main/java/org/mskcc/smile/service/impl/LabelGenMessageHandlingServiceImpl.java index ab51fc7..35aed59 100644 --- a/src/main/java/org/mskcc/smile/service/impl/LabelGenMessageHandlingServiceImpl.java +++ b/src/main/java/org/mskcc/smile/service/impl/LabelGenMessageHandlingServiceImpl.java @@ -69,6 +69,9 @@ public class LabelGenMessageHandlingServiceImpl implements MessageHandlingServic @Value("${request_reply.samples_by_cmo_label_topic}") private String SAMPLES_BY_CMO_LABEL_REQREPLY_TOPIC; + @Value("${request_reply.samples_by_alt_id_topic}") + private String SAMPLES_BY_ALT_ID_REQREPLY_TOPIC; + @Autowired private CmoLabelGeneratorService cmoLabelGeneratorService; @@ -77,6 +80,7 @@ public class LabelGenMessageHandlingServiceImpl implements MessageHandlingServic private static boolean initialized = false; private static volatile boolean shutdownInitiated; private static final ExecutorService exec = Executors.newCachedThreadPool(); + private static final BlockingQueue cmoLabelGeneratorQueue = new LinkedBlockingQueue(); private static final BlockingQueue cmoPromotedLabelQueue = @@ -87,6 +91,7 @@ public class LabelGenMessageHandlingServiceImpl implements MessageHandlingServic new LinkedBlockingQueue(); private static final BlockingQueue cmoSampleLabelUpdateQueue = new LinkedBlockingQueue(); + private static CountDownLatch cmoLabelGeneratorShutdownLatch; private static CountDownLatch cmoPromotedLabelShutdownLatch; private static CountDownLatch newRequestPublisherShutdownLatch; @@ -229,9 +234,12 @@ public void run() { List existingSamples = patientSamplesMap.getOrDefault(sampleManifest.getCmoPatientId(), new ArrayList<>()); + List samplesByAltId + = getSamplesByAltId(sampleManifest.getAltid()); + // TODO resolve any issues that arise with errors in generating cmo label String newSampleCmoLabel = cmoLabelGeneratorService.generateCmoSampleLabel( - requestId, sampleManifest, existingSamples); + requestId, sampleManifest, existingSamples, samplesByAltId); if (newSampleCmoLabel == null) { sampleStatus = cmoLabelGeneratorService.generateSampleStatus( requestId, sampleManifest, existingSamples); @@ -391,6 +399,8 @@ public void run() { String origSampleJson = mapper.writeValueAsString(sample); List existingSamples = getExistingPatientSamples(sample.getCmoPatientId()); + List samplesByAltId + = getSamplesByAltId(sample.getAdditionalProperty("altId")); // Case when sample update json doesn't have status if (sample.getStatus() == null) { Status newSampleStatus = cmoLabelGeneratorService @@ -400,7 +410,8 @@ public void run() { if (sample.getStatus().getValidationStatus()) { // generate new cmo sample label and update sample metadata object String newCmoSampleLabel = - cmoLabelGeneratorService.generateCmoSampleLabel(sample, existingSamples); + cmoLabelGeneratorService.generateCmoSampleLabel(sample, + existingSamples, samplesByAltId); if (newCmoSampleLabel == null) { Status newSampleStatus = cmoLabelGeneratorService .generateSampleStatus(sample, existingSamples); @@ -601,6 +612,15 @@ private List getSamplesByCmoLabel(String cmoLabel) throws Except return new ArrayList<>(Arrays.asList(samplesByCmoLabel)); } + private List getSamplesByAltId(String altId) throws Exception { + Message reply = messagingGateway.request(SAMPLES_BY_ALT_ID_REQREPLY_TOPIC, + altId); + SampleMetadata[] samplesByAltId = mapper.readValue( + new String(reply.getData(), StandardCharsets.UTF_8), + SampleMetadata[].class); + return new ArrayList<>(Arrays.asList(samplesByAltId)); + } + private Boolean isCmoLabelAlreadyInUse(String primaryId, String cmoLabel) throws Exception { List samplesByCmoLabel = getSamplesByCmoLabel(cmoLabel); for (SampleMetadata sm : samplesByCmoLabel) { diff --git a/src/main/java/org/mskcc/smile/service/impl/RequestReplyHandlingServiceImpl.java b/src/main/java/org/mskcc/smile/service/impl/RequestReplyHandlingServiceImpl.java index 3cd6d26..6e9371b 100644 --- a/src/main/java/org/mskcc/smile/service/impl/RequestReplyHandlingServiceImpl.java +++ b/src/main/java/org/mskcc/smile/service/impl/RequestReplyHandlingServiceImpl.java @@ -38,6 +38,9 @@ public class RequestReplyHandlingServiceImpl implements RequestReplyHandlingServ @Value("${request_reply.patient_samples_topic:}") private String PATIENT_SAMPLES_REQUEST_TOPIC; + @Value("${request_reply.samples_by_alt_id_topic}") + private String SAMPLES_BY_ALT_ID_REQREPLY_TOPIC; + @Value("${num.new_request_handler_threads:1}") private int NUM_NEW_REQUEST_HANDLERS; @@ -92,9 +95,13 @@ public void run() { if (replyInfo != null) { SampleMetadata sample = mapper.readValue(replyInfo.getRequestMessage(), SampleMetadata.class); + List existingPatientSamples + = getExistingPatientSamples(sample.getCmoPatientId()); + List samplesByAltId + = getSamplesByAltId(sample.getAdditionalProperty("altId")); String updatedCmoSampleLabel = cmoLabelGeneratorService.generateCmoSampleLabel(sample, - getExistingPatientSamples(sample.getCmoPatientId())); + existingPatientSamples, samplesByAltId); //log replied to the message messagingGateway.replyPublish(replyInfo.getReplyTo(), updatedCmoSampleLabel); @@ -122,6 +129,15 @@ private List getExistingPatientSamples(String cmoPatientId) thro return new ArrayList<>(Arrays.asList(ptSamples)); } + private List getSamplesByAltId(String altId) throws Exception { + Message reply = messagingGateway.request(SAMPLES_BY_ALT_ID_REQREPLY_TOPIC, + altId); + SampleMetadata[] samplesByAltId = mapper.readValue( + new String(reply.getData(), StandardCharsets.UTF_8), + SampleMetadata[].class); + return new ArrayList<>(Arrays.asList(samplesByAltId)); + } + @Override public void initialize(Gateway gateway) throws Exception { if (!initialized) { diff --git a/src/main/resources/application.properties.EXAMPLE b/src/main/resources/application.properties.EXAMPLE index b893f67..e26d27a 100644 --- a/src/main/resources/application.properties.EXAMPLE +++ b/src/main/resources/application.properties.EXAMPLE @@ -27,6 +27,7 @@ smile.sample_update_topic= request_reply.patient_samples_topic= request_reply.cmo_label_generator_topic= request_reply.samples_by_cmo_label_topic= +request_reply.samples_by_alt_id_topic= # threading num.new_request_handler_threads= diff --git a/src/test/java/org/mskcc/smile/CmoLabelGeneratorServiceTest.java b/src/test/java/org/mskcc/smile/CmoLabelGeneratorServiceTest.java index 57ab786..b1c2032 100644 --- a/src/test/java/org/mskcc/smile/CmoLabelGeneratorServiceTest.java +++ b/src/test/java/org/mskcc/smile/CmoLabelGeneratorServiceTest.java @@ -1,7 +1,6 @@ package org.mskcc.smile; import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; import java.util.HashMap; @@ -26,6 +25,9 @@ public class CmoLabelGeneratorServiceTest { private final ObjectMapper mapper = new ObjectMapper(); + // setting as empty for now until alt id is fully supported + List DEFAULT_SAMPLES_BY_ALT_ID = new ArrayList<>(); + @Autowired private CmoLabelGeneratorService cmoLabelGeneratorService; @@ -57,36 +59,24 @@ public void testValidRequestJson() throws Exception { * a sample with metadata updates including igoId/primaryId * Expected behavior: Should return a label with * incremented sample count and new Sample Type Abbreviation - * @throws JsonProcessingException - * @throws CloneNotSupportedException - * @throws IllegalArgumentException + * @throws Exception */ @Test - public void testCmoLabelGenForSampleUpdate() throws JsonProcessingException, - IllegalArgumentException, CloneNotSupportedException { - MockJsonTestData requestJson = mockedRequestJsonDataMap - .get("mockPublishedRequest1JsonDataWith2T2N"); - // Parse requestMap and sampleList from mockPublishedRequest1JsonDataWith2T2N json - Map mappedRequestJson = mapper.readValue(requestJson.getJsonString(), Map.class); - SampleMetadata[] samples = mapper.convertValue(mappedRequestJson.get("samples"), - SampleMetadata[].class); - - // existing sample for patientId: C-MP789JR - List existingSamples = new ArrayList<>(); - existingSamples.add(samples[0]); - existingSamples.add(samples[1]); + public void testCmoLabelGenForSampleUpdate() throws Exception { + // existing samples for patientId: C-MP789JR + List existingSamples = + getPatientSamplesFromRequestJson("mockPublishedRequest1JsonDataWith2T2N", "C-MP789JR"); // updated SampleMetadata SampleMetadata updatedSample = mapper.convertValue( - samples[0].clone(), SampleMetadata.class); - updatedSample.setSampleClass("NewSpecimen"); + existingSamples.get(0).clone(), SampleMetadata.class); + updatedSample.setSampleClass("Non-PDX"); updatedSample.setPrimaryId("newPrimaryId"); // generate cmoLabel for sample with updates String newCmoLabel = cmoLabelGeneratorService.generateCmoSampleLabel( - updatedSample, existingSamples); - // if the cmo label before the update is C-MP789JR-X001-d - Assertions.assertEquals("C-MP789JR-P003-d02", newCmoLabel); + updatedSample, existingSamples, DEFAULT_SAMPLES_BY_ALT_ID); + Assertions.assertEquals("C-MP789JR-P003-d01", newCmoLabel); Status sampleStatus = cmoLabelGeneratorService.generateSampleStatus( updatedSample, existingSamples); @@ -99,40 +89,27 @@ public void testCmoLabelGenForSampleUpdate() throws JsonProcessingException, * a sample with metadata with updated cmoPatientId and primaryId/igoId * Expected behavior: Should return a label with * incremented sample count and new cmoPatientId - * @throws JsonProcessingException - * @throws JsonMappingException - * @throws CloneNotSupportedException - * @throws IllegalArgumentException + * @throws Exception */ @Test public void testCmoLabelGenForSampleWithPatientCorrection() - throws JsonMappingException, JsonProcessingException, - IllegalArgumentException, CloneNotSupportedException { - MockJsonTestData requestJson = mockedRequestJsonDataMap - .get("mockPublishedRequest1JsonDataWith2T2N"); - // Parse requestMap and sampleList from mockPublishedRequest1JsonDataWith2T2N json - Map mappedRequestJson = mapper.readValue( - requestJson.getJsonString(), Map.class); - SampleMetadata[] samples = mapper.convertValue(mappedRequestJson.get("samples"), - SampleMetadata[].class); - - // existing sample for patientId: C-MP789JR - List existingSamples = new ArrayList<>(); - existingSamples.add(samples[0]); - existingSamples.add(samples[1]); + throws Exception { + // existing samples for patientId: C-MP789JR + List existingSamples = + getPatientSamplesFromRequestJson("mockPublishedRequest1JsonDataWith2T2N", "C-MP789JR"); // updated SampleMetadata SampleMetadata updatedSample = mapper.convertValue( - samples[0].clone(), SampleMetadata.class); + existingSamples.get(0).clone(), SampleMetadata.class); updatedSample.setCmoPatientId("C-newPatient"); updatedSample.setPrimaryId("newIgoId"); // generate cmoLabel for sample with updates - String newCmoLabel = cmoLabelGeneratorService.generateCmoSampleLabel( - updatedSample, existingSamples); + String newCmoLabel = cmoLabelGeneratorService.generateCmoSampleLabel(updatedSample, + existingSamples, DEFAULT_SAMPLES_BY_ALT_ID); // if the cmo label before the update is C-MP789JR-X001-d - Assertions.assertEquals("C-newPatient-X003-d02", newCmoLabel); + Assertions.assertEquals("C-newPatient-X003-d01", newCmoLabel); Status sampleStatus = cmoLabelGeneratorService.generateSampleStatus( updatedSample, existingSamples); @@ -145,40 +122,30 @@ public void testCmoLabelGenForSampleWithPatientCorrection() * a sample with metadata with updated cmoPatientId and primaryId/igoId * Expected behavior: Should return a label with * only a new cmoPatientId change - * @throws JsonProcessingException - * @throws JsonMappingException - * @throws CloneNotSupportedException - * @throws IllegalArgumentException + * @throws Exception */ @Test public void testCmoLabelGenForExistingSampleWithPatientCorrection() - throws JsonMappingException, JsonProcessingException, - IllegalArgumentException, CloneNotSupportedException { - MockJsonTestData requestJson = mockedRequestJsonDataMap - .get("mockPublishedRequest1JsonDataWith2T2N"); - // Parse requestMap and sampleList from mockPublishedRequest1JsonDataWith2T2N json - Map mappedRequestJson = mapper.readValue( - requestJson.getJsonString(), Map.class); - SampleMetadata[] samples = mapper.convertValue(mappedRequestJson.get("samples"), - SampleMetadata[].class); - - // existing sample for patientId: C-MP789JR - List existingSamples = new ArrayList<>(); - existingSamples.add(samples[0]); - existingSamples.add(samples[1]); + throws Exception { + // existing samples for patientId: C-MP789JR + List existingSamples = + getPatientSamplesFromRequestJson("mockPublishedRequest1JsonDataWith2T2N", "C-MP789JR"); // updated SampleMetadata SampleMetadata updatedSample = mapper.convertValue( - samples[0].clone(), SampleMetadata.class); + existingSamples.get(0).clone(), SampleMetadata.class); updatedSample.setCmoPatientId("C-newPatient"); // generate cmoLabel for sample with updates - String newCmoLabel = cmoLabelGeneratorService.generateCmoSampleLabel( - updatedSample, existingSamples); + String newCmoLabel = cmoLabelGeneratorService.generateCmoSampleLabel(updatedSample, + existingSamples, DEFAULT_SAMPLES_BY_ALT_ID); - // if the cmo label before the update is C-MP789JR-X001-d - Assertions.assertEquals("C-newPatient-X001-d02", newCmoLabel); + // NOTE: now that the nucleic acid counter doesn't increment for unless it's + // another sample of the same alt id, the 'updatedCmoLabel' returned should + // have a nuc acid counter of 01 + // if the cmo label before the update is C-MP789JR-X001-d + Assertions.assertEquals("C-newPatient-X001-d01", newCmoLabel); Status sampleStatus = cmoLabelGeneratorService.generateSampleStatus( updatedSample, existingSamples); @@ -192,37 +159,26 @@ public void testCmoLabelGenForExistingSampleWithPatientCorrection() * - sample origin = whole blood * - sample class (specimen type) = other * Expected behavior: Should return null label. - * @throws JsonProcessingException - * @throws JsonMappingException - * @throws CloneNotSupportedException - * @throws IllegalArgumentException + * @throws Exception */ @Test public void testCmoLabelGenForSampleWithOtherSpecimenType() - throws JsonMappingException, JsonProcessingException, - IllegalArgumentException, CloneNotSupportedException { - MockJsonTestData requestJson = mockedRequestJsonDataMap - .get("mockPublishedRequest1JsonDataWith2T2N"); - // Parse requestMap and sampleList from mockPublishedRequest1JsonDataWith2T2N json - Map mappedRequestJson = mapper.readValue( - requestJson.getJsonString(), Map.class); - SampleMetadata[] samples = mapper.convertValue(mappedRequestJson.get("samples"), - SampleMetadata[].class); - - // existing sample for patientId: C-MP789JR - List existingSamples = new ArrayList<>(); + throws Exception { + // existing samples for patientId: C-MP789JR + List existingSamples = + getPatientSamplesFromRequestJson("mockPublishedRequest1JsonDataWith2T2N", "C-MP789JR"); // updated SampleMetadata SampleMetadata updatedSample = mapper.convertValue( - samples[0].clone(), SampleMetadata.class); + existingSamples.get(0).clone(), SampleMetadata.class); updatedSample.setSampleType("Other"); updatedSample.setSampleOrigin("Whole Blood"); updatedSample.setSampleClass("Other"); // generate cmoLabel for sample with spec type (sample type) = other - // should return null string - String newCmoLabel = cmoLabelGeneratorService.generateCmoSampleLabel( - updatedSample, existingSamples); + // should return label with 'F' sample type abbreviation and validaiton status = false + String newCmoLabel = cmoLabelGeneratorService.generateCmoSampleLabel(updatedSample, + existingSamples, DEFAULT_SAMPLES_BY_ALT_ID); Assertions.assertEquals("C-MP789JR-F001-d01", newCmoLabel); Status sampleStatus = cmoLabelGeneratorService.generateSampleStatus( @@ -231,6 +187,9 @@ public void testCmoLabelGenForSampleWithOtherSpecimenType() Assertions.assertNotSame(sampleStatus.getValidationReport(), (new HashMap()).toString()); } + /** + * Tests various sample updates for an incoming IGO sample manifest. + */ @Test public void testCmoCelllineLabelGenerationUpdates() { String requestId = "86793_T"; @@ -238,18 +197,18 @@ public void testCmoCelllineLabelGenerationUpdates() { // generate reference cell line sample label and assert it matches the expected value IgoSampleManifest sample = getSampleMetadata("86793_T_4", "C-76767", - SpecimenType.CELLLINE, NucleicAcid.DNA, "AMP1"); + SpecimenType.CELLLINE, NucleicAcid.DNA, "AMP1", "ABC-444"); String sampleLabel = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, - sample, existingSamples); + sample, existingSamples, DEFAULT_SAMPLES_BY_ALT_ID); String sampleExpectedLabel = "AMP1-86793T"; Assertions.assertEquals("AMP1-86793T", sampleLabel); // test label generated with new investigator id and assert // that the sample would require a label update IgoSampleManifest sampleUpdatedInvestigatorId = getSampleMetadata("86793_T_4", "C-76767", - SpecimenType.CELLLINE, NucleicAcid.DNA, "MIP2"); + SpecimenType.CELLLINE, NucleicAcid.DNA, "MIP2", "ABC-444"); String sampleUpdatedInvestigatorIdLabel = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, - sampleUpdatedInvestigatorId, existingSamples); + sampleUpdatedInvestigatorId, existingSamples, DEFAULT_SAMPLES_BY_ALT_ID); String expectedLabelWithInvestiagorIdUpdate = "MIP2-86793T"; Assertions.assertEquals(expectedLabelWithInvestiagorIdUpdate, sampleUpdatedInvestigatorIdLabel); // assert that the sample would require a label update @@ -259,14 +218,17 @@ public void testCmoCelllineLabelGenerationUpdates() { // test label generated with same investigator id as original sample // but with a different nucleic acid value IgoSampleManifest sampleUpdatedNaExtract = getSampleMetadata("86793_T_4", "C-76767", - SpecimenType.CELLLINE, NucleicAcid.CFDNA, "AMP1"); + SpecimenType.CELLLINE, NucleicAcid.CFDNA, "AMP1", "ABC-444"); String sampleUpdatedNaExtractLabel = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, - sampleUpdatedNaExtract, existingSamples); + sampleUpdatedNaExtract, existingSamples, DEFAULT_SAMPLES_BY_ALT_ID); Assertions.assertEquals(sampleExpectedLabel, sampleUpdatedNaExtractLabel); Assertions.assertFalse(cmoLabelGeneratorService.igoSampleRequiresLabelUpdate( sampleUpdatedNaExtractLabel, sampleExpectedLabel)); } + /** + * Tests 'F' resolved sample type abbreviation. + */ @Test public void testDefaultSampleTypeAbbreviation() { String sampleTypeAbbrev = cmoLabelGeneratorService.resolveSampleTypeAbbreviation("RapidAutopsy", @@ -298,14 +260,64 @@ public void testIncrementNucleicAcidCounter() throws Exception { Assertions.assertEquals(nextExpectedLabel, nextActualLabel); } + /** + * Tests a new sample (new primary id) with an existing alt id and has the + * same nucleic acid type as the samples matching the alt id. + * Expected behavior: sample should have the same resolved tumor counter + * and an incremented nuc acid counter. + * @throws Exception + */ + @Test + public void testNewSampleExistingAltIdDnaNucAcid() throws Exception { + // existing samples for patientId: C-MP789JR + List existingSamples = + getPatientSamplesFromRequestJson("mockPublishedRequest1JsonDataWith2T2N", "C-MP789JR"); + + // new sample from same source sample tissue and dna profile + SampleMetadata newSample1 = mapper.convertValue( + existingSamples.get(0).clone(), SampleMetadata.class); + newSample1.setPrimaryId("98755_B_1"); + newSample1.setSampleClass("Non-PDX"); + + // if no samples exist by the same alt id then the new sample should receive tumor counter #3 + String cmoLabelNoAltIds = cmoLabelGeneratorService.generateCmoSampleLabel(newSample1, + existingSamples, DEFAULT_SAMPLES_BY_ALT_ID); + Assertions.assertEquals("C-MP789JR-P003-d01", cmoLabelNoAltIds); + + // set up samples by alt id as same as existing samples + List samplesByAltId = + getPatientSamplesFromRequestJson("mockPublishedRequest1JsonDataWith2T2N", "C-MP789JR"); + + // if there are samples by the same alt id then the new sample should receive tumor counter #2 + // this is due to one of the samples from the alt id having both a #1 and #2 + String cmoLabelWithAltIds = cmoLabelGeneratorService.generateCmoSampleLabel(newSample1, + existingSamples, samplesByAltId); + Assertions.assertEquals("C-MP789JR-P001-d02", cmoLabelWithAltIds); + newSample1.setCmoSampleName(cmoLabelWithAltIds); + samplesByAltId.add(newSample1); + + // if there's another new sample coming in with the same alt id, same dna profile then + // the new label should have tumor counter #2 and dna counter #3 + SampleMetadata newSample2 = mapper.convertValue( + existingSamples.get(0).clone(), SampleMetadata.class); + newSample2.setPrimaryId("98989_C_4"); + newSample2.setSampleClass("Non-PDX"); + String cmoLabelWithAltIds2 = cmoLabelGeneratorService.generateCmoSampleLabel(newSample2, + existingSamples, samplesByAltId); + Assertions.assertEquals("C-MP789JR-P001-d03", cmoLabelWithAltIds2); + newSample2.setCmoSampleName(cmoLabelWithAltIds2); + samplesByAltId.add(newSample2); + } + private IgoSampleManifest getSampleMetadata(String igoId, String cmoPatientId, - SpecimenType specimenType, NucleicAcid naToExtract, String investigatorSampleId) { + SpecimenType specimenType, NucleicAcid naToExtract, String investigatorSampleId, String altId) { IgoSampleManifest sample = new IgoSampleManifest(); sample.setIgoId(igoId); sample.setCmoPatientId(cmoPatientId); sample.setSpecimenType(specimenType.getValue()); sample.setInvestigatorSampleId(investigatorSampleId); sample.setCmoSampleClass("Tumor"); + sample.setAltid(altId); Map cmoSampleIdFields = new HashMap<>(); cmoSampleIdFields.put("naToExtract", naToExtract.getValue()); @@ -313,4 +325,21 @@ private IgoSampleManifest getSampleMetadata(String igoId, String cmoPatientId, sample.setCmoSampleIdFields(cmoSampleIdFields); return sample; } + + private List getPatientSamplesFromRequestJson(String mockedRequestId, + String patientId) throws JsonProcessingException { + MockJsonTestData requestJson = mockedRequestJsonDataMap + .get(mockedRequestId); + Map mappedRequestJson = mapper.readValue(requestJson.getJsonString(), Map.class); + SampleMetadata[] samples = mapper.convertValue(mappedRequestJson.get("samples"), + SampleMetadata[].class); + + List existingSamples = new ArrayList<>(); + for (SampleMetadata sample : samples) { + if (sample.getCmoPatientId().equals(patientId)) { + existingSamples.add(sample); + } + } + return existingSamples; + } } diff --git a/src/test/java/org/mskcc/smile/PortedLimsRestCmoLabelGenerationTest.java b/src/test/java/org/mskcc/smile/PortedLimsRestCmoLabelGenerationTest.java index a4913d0..a989a03 100644 --- a/src/test/java/org/mskcc/smile/PortedLimsRestCmoLabelGenerationTest.java +++ b/src/test/java/org/mskcc/smile/PortedLimsRestCmoLabelGenerationTest.java @@ -33,6 +33,8 @@ @SpringBootTest(classes = LabelGeneratorTestApp.class) @Import(TestConfiguration.class) public class PortedLimsRestCmoLabelGenerationTest { + // setting as empty for now until alt id is fully supported + List SAMPLES_BY_ALT_ID = new ArrayList<>(); @Autowired private CmoLabelGeneratorService cmoLabelGeneratorService; @@ -54,7 +56,8 @@ public void testPatientNoExistingSamples() throws Exception { IgoSampleManifest sample = getSampleMetadata("4324", cmoPatientId, SpecimenType.XENOGRAFT, NucleicAcid.DNA); - String cmoId = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample, new ArrayList<>()); + String cmoId = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample, + new ArrayList<>(), SAMPLES_BY_ALT_ID); Assertions.assertEquals("C-1235-X001-d01", cmoId); } @@ -80,8 +83,13 @@ public void testPatientOneExistingSample() throws Exception { // get existing samples for given igo id and request id List existingSamples = Arrays.asList(existingSample); - String cmoId = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample, existingSamples); - Assertions.assertEquals("C-1235-X002-d02", cmoId); + String cmoId = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample, + existingSamples, SAMPLES_BY_ALT_ID); + + // keeping this "NotEquals" comparison for provenance - nucleic acid counter is now resolved + // on a unique sample basis (i.e., alt id) and not by total patient samples of a given nuc acid type + Assertions.assertNotEquals("C-1235-X002-d02", cmoId); + Assertions.assertEquals("C-1235-X002-d01", cmoId); } /** @@ -108,8 +116,13 @@ public void testPatientOneExistingSampleNucAcidCounter() throws Exception { // get existing samples for given igo id and request id List existingSamples = Arrays.asList(existingSample); - String cmoId = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample, existingSamples); - Assertions.assertEquals("C-1235-X002-d02", cmoId); + String cmoId = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample, + existingSamples, SAMPLES_BY_ALT_ID); + + // keeping this "NotEquals" comparison for provenance - nucleic acid counter is now resolved + // on a unique sample basis (i.e., alt id) and not by total patient samples of a given nuc acid type + Assertions.assertNotEquals("C-1235-X002-d02", cmoId); + Assertions.assertEquals("C-1235-X002-d01", cmoId); } /** @@ -133,8 +146,13 @@ public void testPatientOneSampleNextIncrement() throws Exception { // get existing samples for given igo id and request id List existingSamples = Arrays.asList(existingSample); - String cmoId = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample, existingSamples); - Assertions.assertEquals("C-1235-X013-d02", cmoId); + String cmoId = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample, + existingSamples, SAMPLES_BY_ALT_ID); + + // keeping this "NotEquals" comparison for provenance - nucleic acid counter is now resolved + // on a unique sample basis (i.e., alt id) and not by total patient samples of a given nuc acid type + Assertions.assertNotEquals("C-1235-X013-d02", cmoId); + Assertions.assertEquals("C-1235-X013-d01", cmoId); } /** @@ -162,7 +180,11 @@ public void testPatientOneSampleDiffRequest() throws Exception { // since nucleic acid abbreviation is different from existing sample, the // nucleic acid counter is also '01' - String cmoId = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample, existingSamples); + String cmoId = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample, + existingSamples, SAMPLES_BY_ALT_ID); + + // this test result remains as is since the nuc acid is different from existing ones and would + // recieve a nuc acid count of 1 anyway Assertions.assertEquals("C-1235-X002-r01", cmoId); } @@ -183,7 +205,7 @@ public void testPatientTwoSamplesSameSpecimenTypeNucleicAcid() throws Exception IgoSampleManifest sample1 = getSampleMetadata("4324_1", cmoPatientId, SpecimenType.XENOGRAFT, NucleicAcid.DNA); String cmoId1 = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, - sample1, new ArrayList<>()); + sample1, new ArrayList<>(), SAMPLES_BY_ALT_ID); Assertions.assertEquals("C-1235-X001-d01", cmoId1); // now we have one existing sample in this request for the same patient @@ -194,8 +216,13 @@ public void testPatientTwoSamplesSameSpecimenTypeNucleicAcid() throws Exception IgoSampleManifest sample2 = getSampleMetadata("4324_2", cmoPatientId, SpecimenType.XENOGRAFT, NucleicAcid.DNA); - String cmoId2 = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample2, existingSamples); - Assertions.assertEquals("C-1235-X002-d02", cmoId2); + String cmoId2 = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample2, + existingSamples, SAMPLES_BY_ALT_ID); + + // keeping this "NotEquals" comparison for provenance - nucleic acid counter is now resolved + // on a unique sample basis (i.e., alt id) and not by total patient samples of a given nuc acid type + Assertions.assertNotEquals("C-1235-X002-d02", cmoId2); + Assertions.assertEquals("C-1235-X002-d01", cmoId2); } /** @@ -215,7 +242,7 @@ public void testPatientTwoSamplesSameSpecimenTypeDiffNucleicAcid() throws Except IgoSampleManifest sample1 = getSampleMetadata("4324_1", cmoPatientId, SpecimenType.XENOGRAFT, NucleicAcid.DNA); String cmoId1 = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, - sample1, new ArrayList<>()); + sample1, new ArrayList<>(), SAMPLES_BY_ALT_ID); Assertions.assertEquals("C-1235-X001-d01", cmoId1); // now we have one existing sample in this request for the same patient @@ -226,7 +253,11 @@ public void testPatientTwoSamplesSameSpecimenTypeDiffNucleicAcid() throws Except IgoSampleManifest sample2 = getSampleMetadata("4324_2", cmoPatientId, SpecimenType.XENOGRAFT, NucleicAcid.RNA); - String cmoId2 = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample2, existingSamples); + String cmoId2 = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, sample2, + existingSamples, SAMPLES_BY_ALT_ID); + + // this test result remains as is since the nuc acid is different from existing ones and would + // recieve a nuc acid count of 1 anyway Assertions.assertEquals("C-1235-X002-r01", cmoId2); } @@ -248,7 +279,7 @@ public void testPatientTwoSamplesDiffSpecimenTypeSameRequestNucleicAcid() IgoSampleManifest sample1 = getSampleMetadata("4324_1", cmoPatientId, SpecimenType.XENOGRAFT, NucleicAcid.DNA); String cmoId1 = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, - sample1, new ArrayList<>()); + sample1, new ArrayList<>(), SAMPLES_BY_ALT_ID); Assertions.assertEquals("C-1235-X001-d01", cmoId1); // now we have one existing sample in this request for the same patient @@ -260,8 +291,12 @@ public void testPatientTwoSamplesDiffSpecimenTypeSameRequestNucleicAcid() IgoSampleManifest sample2 = getSampleMetadata("4324_2", cmoPatientId, SpecimenType.PDX, NucleicAcid.DNA); String cmoId2 = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, - sample2, existingSamples); - Assertions.assertEquals("C-1235-X002-d02", cmoId2); + sample2, existingSamples, SAMPLES_BY_ALT_ID); + + // keeping this "NotEquals" comparison for provenance - nucleic acid counter is now resolved + // on a unique sample basis (i.e., alt id) and not by total patient samples of a given nuc acid type + Assertions.assertNotEquals("C-1235-X002-d02", cmoId2); + Assertions.assertEquals("C-1235-X002-d01", cmoId2); } /** @@ -281,7 +316,7 @@ public void testPatientTwoSamplesDiffRequestSameeSpecimenTypeNucleicAcid() throw IgoSampleManifest sample1 = getSampleMetadata("4324_1", cmoPatientId, SpecimenType.ORGANOID, NucleicAcid.DNA); String cmoId1 = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, - sample1, new ArrayList<>()); + sample1, new ArrayList<>(), SAMPLES_BY_ALT_ID); Assertions.assertEquals("C-1235-G001-d01", cmoId1); // now we have one existing sample in this request for the same patient @@ -293,8 +328,12 @@ public void testPatientTwoSamplesDiffRequestSameeSpecimenTypeNucleicAcid() throw IgoSampleManifest sample2 = getSampleMetadata("4324_2", cmoPatientId, SpecimenType.ORGANOID, NucleicAcid.DNA); String cmoId2 = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, - sample2, existingSamples); - Assertions.assertEquals("C-1235-G002-d02", cmoId2); + sample2, existingSamples, SAMPLES_BY_ALT_ID); + + // keeping this "NotEquals" comparison for provenance - nucleic acid counter is now resolved + // on a unique sample basis (i.e., alt id) and not by total patient samples of a given nuc acid type + Assertions.assertNotEquals("C-1235-G002-d02", cmoId2); + Assertions.assertEquals("C-1235-G002-d01", cmoId2); } /** @@ -328,10 +367,14 @@ public void testIgoSampleWithNoLabelChangingMetadataUpdates() throws Exception { IgoSampleManifest updatedSample = getSampleMetadata("4324_1", cmoPatientId, SpecimenType.ORGANOID, NucleicAcid.DNA); String updatedCmoLabel = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, - updatedSample, existingSamples); + updatedSample, existingSamples, SAMPLES_BY_ALT_ID); + + // NOTE: now that the nucleic acid counter doesn't increment for unless it's + // another sample of the same alt id, the 'updatedCmoLabel' returned should + // have a nuc acid counter of 01 // confirm that the label generated would still increment even though it will // be determined that the sample cmo label does NOT need to be updated for this sample - Assertions.assertEquals("C-1235-G001-d03", updatedCmoLabel); + Assertions.assertEquals("C-1235-G001-d01", updatedCmoLabel); Boolean needsUpdates = cmoLabelGeneratorService.igoSampleRequiresLabelUpdate(updatedCmoLabel, cmoId1); Assertions.assertFalse(needsUpdates); @@ -365,7 +408,7 @@ public void testIgoSampleWithLabelChangingMetadataUpdates() throws Exception { IgoSampleManifest updatedSample = getSampleMetadata("4324_1", cmoPatientId, SpecimenType.ORGANOID, NucleicAcid.RNA); String updatedCmoLabel = cmoLabelGeneratorService.generateCmoSampleLabel(requestId, - updatedSample, existingSamples); + updatedSample, existingSamples, SAMPLES_BY_ALT_ID); Assertions.assertEquals("C-1235-G001-r01", updatedCmoLabel); Boolean needsUpdates = cmoLabelGeneratorService.igoSampleRequiresLabelUpdate(updatedCmoLabel, cmoId1); Assertions.assertTrue(needsUpdates); diff --git a/src/test/resources/data/incoming_requests/mocked_request1_all_samples_missing_fastqs.json b/src/test/resources/data/incoming_requests/mocked_request1_all_samples_missing_fastqs.json index 919e486..c3c2bc9 100644 --- a/src/test/resources/data/incoming_requests/mocked_request1_all_samples_missing_fastqs.json +++ b/src/test/resources/data/incoming_requests/mocked_request1_all_samples_missing_fastqs.json @@ -65,6 +65,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "PDX" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -105,6 +109,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "Blood" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -156,6 +164,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "PDX" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -208,6 +220,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "Blood" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request1_complete_tumor_normal.json b/src/test/resources/data/incoming_requests/mocked_request1_complete_tumor_normal.json index 28c6c2d..1926dcb 100644 --- a/src/test/resources/data/incoming_requests/mocked_request1_complete_tumor_normal.json +++ b/src/test/resources/data/incoming_requests/mocked_request1_complete_tumor_normal.json @@ -68,6 +68,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -123,6 +127,10 @@ "sampleType": "Whole Blood", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -178,6 +186,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -233,6 +245,10 @@ "sampleType": "Whole Blood", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request1_complete_tumor_normal_updated_libraries.json b/src/test/resources/data/incoming_requests/mocked_request1_complete_tumor_normal_updated_libraries.json new file mode 100644 index 0000000..fc8b77c --- /dev/null +++ b/src/test/resources/data/incoming_requests/mocked_request1_complete_tumor_normal_updated_libraries.json @@ -0,0 +1,268 @@ +{ + "requestId": "MOCKREQUEST1_B", + "recipe": "GENESET101_BAITS", + "projectManagerName": "Bar, Foo", + "piEmail": "request1pi@mskcc.org", + "labHeadName": "Foo Bar", + "labHeadEmail": "request1pi@mskcc.org", + "investigatorName": "John Smith", + "investigatorEmail": "smithj@mskcc.org", + "dataAnalystName": "Poin Dexter", + "dataAnalystEmail": "dexterp@mskcc.org", + "otherContactEmails": "dexterp@mskcc.org", + "dataAccessEmails": "", + "qcAccessEmails": "", + "isCmoRequest": true, + "bicAnalysis": false, + "samples": [ + { + "cmoSampleName": "C-MP789JR-X001-d", + "sampleName": "XXX002_P3_12345_L1", + "cmoSampleClass": "Primary", + "oncoTreeCode": "CLL", + "collectionYear": "", + "tubeId": "", + "qcReports": [], + "libraries": [ + { + "barcodeId": "IDT29", + "barcodeIndex": "ATTGAGGA", + "libraryIgoId": "MOCKREQUEST1_B_1_1_1_1_updated_library_id", + "libraryVolume": 35.0, + "libraryConcentrationNgul": 34.8, + "captureConcentrationNm": "11.49425287356322", + "captureInputNg": "900000.0", + "captureName": "Pool-MOCKREQUEST1_B-Tube7_1", + "runs": [ + { + "runMode": "HiSeq High Output", + "runId": "RUNID_0123", + "flowCellId": "X5KL2KKAY", + "readLength": "", + "runDate": "2018-06-05", + "flowCellLanes": [ + 5 + ], + "fastqs": [ + "/FASTQ/Project_MOCKREQUEST1_B/Sample_XXX002_P3_12345_L1_IGO_MOCKREQUEST1_B_1/XXX002_P3_12345_L1_IGO_MOCKREQUEST1_B_1_S82_R1_001.fastq.gz", + "/FASTQ/Project_MOCKREQUEST1_B/Sample_XXX002_P3_12345_L1_IGO_MOCKREQUEST1_B_1/XXX002_P3_12345_L1_IGO_MOCKREQUEST1_B_1_S82_R2_001.fastq.gz" + ] + } + ] + } + ], + "cmoPatientId": "C-MP789JR", + "igoId": "MOCKREQUEST1_B_1", + "investigatorSampleId": "XXX002_P3_12345_L1", + "species": "Human", + "sex": "F", + "tumorOrNormal": "Tumor", + "preservation": "Frozen", + "specimenType": "PDX", + "sampleOrigin": "Tissue", + "tissueLocation": "", + "baitSet": "GENESET101_BAITS", + "igoComplete": true, + "cmoSampleIdFields": { + "naToExtract": "", + "sampleType": "Tissue", + "normalizedPatientId": "MRN_REDACTED", + "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" + } + }, + { + "cmoSampleName": "C-MP789JR-N001-d", + "sampleName": "01-0012345a", + "cmoSampleClass": "Normal", + "oncoTreeCode": "CLL", + "collectionYear": "", + "tubeId": "", + "qcReports": [], + "libraries": [ + { + "barcodeId": "TNG41", + "barcodeIndex": "CGACTGGA", + "libraryIgoId": "MOCKREQUEST1_B_2_1_1_1", + "libraryVolume": 35.0, + "libraryConcentrationNgul": 33.5, + "captureConcentrationNm": "5.074626865671642", + "captureInputNg": "170.0", + "captureName": "Pool-MOCKREQUEST1_B-Tube7_1", + "runs": [ + { + "runMode": "HiSeq High Output", + "runId": "RUNID_0123", + "flowCellId": "X5KL2KKAY", + "readLength": "", + "runDate": "2018-06-05", + "flowCellLanes": [ + 5 + ], + "fastqs": [ + "/FASTQ/Project_MOCKREQUEST1_B/Sample_01-0012345a_IGO_MOCKREQUEST1_B_2/01-0012345a_IGO_MOCKREQUEST1_B_2_S83_R2_001.fastq.gz", + "/FASTQ/Project_MOCKREQUEST1_B/Sample_01-0012345a_IGO_MOCKREQUEST1_B_2/01-0012345a_IGO_MOCKREQUEST1_B_2_S83_R1_001.fastq.gz" + ] + } + ] + } + ], + "cmoPatientId": "C-MP789JR", + "igoId": "MOCKREQUEST1_B_2", + "investigatorSampleId": "01-0012345a", + "species": "Human", + "sex": "F", + "tumorOrNormal": "Normal", + "preservation": "Frozen", + "specimenType": "Blood", + "sampleOrigin": "Whole Blood", + "tissueLocation": "", + "baitSet": "GENESET101_BAITS", + "igoComplete": true, + "cmoSampleIdFields": { + "naToExtract": "", + "sampleType": "Whole Blood", + "normalizedPatientId": "MRN_REDACTED", + "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" + } + }, + { + "cmoSampleName": "C-8DH24X-X001-d", + "sampleName": "XXX002_P1_12348a_R_43", + "cmoSampleClass": "Primary", + "oncoTreeCode": "COAD", + "collectionYear": "", + "tubeId": "", + "qcReports": [], + "libraries": [ + { + "barcodeId": "TNG53", + "barcodeIndex": "GCTCGGTA", + "libraryIgoId": "MOCKREQUEST1_B_3_1_1_1", + "libraryVolume": 35.0, + "libraryConcentrationNgul": 35.2, + "captureConcentrationNm": "11.363636363636363", + "captureInputNg": "400.0", + "captureName": "Pool-MOCKREQUEST1_B-Tube7_1", + "runs": [ + { + "runMode": "HiSeq High Output", + "runId": "RUNID_0123", + "flowCellId": "X5KL2KKAY", + "readLength": "", + "runDate": "2018-06-05", + "flowCellLanes": [ + 5 + ], + "fastqs": [ + "/FASTQ/Project_MOCKREQUEST1_B/Sample_XXX002_P1_12348a_R_43_IGO_MOCKREQUEST1_B_3/XXX002_P1_12348a_R_43_IGO_MOCKREQUEST1_B_3_S84_R1_001.fastq.gz", + "/FASTQ/Project_MOCKREQUEST1_B/Sample_XXX002_P1_12348a_R_43_IGO_MOCKREQUEST1_B_3/XXX002_P1_12348a_R_43_IGO_MOCKREQUEST1_B_3_S84_R2_001.fastq.gz" + ] + } + ] + } + ], + "cmoPatientId": "C-8DH24X", + "igoId": "MOCKREQUEST1_B_3", + "investigatorSampleId": "XXX002_P1_12348a_R_43", + "species": "Human", + "sex": "M", + "tumorOrNormal": "Tumor", + "preservation": "Frozen", + "specimenType": "PDX", + "sampleOrigin": "Tissue", + "tissueLocation": "", + "baitSet": "GENESET101_BAITS", + "igoComplete": true, + "cmoSampleIdFields": { + "naToExtract": "", + "sampleType": "Tissue", + "normalizedPatientId": "MRN_REDACTED", + "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" + } + }, + { + "cmoSampleName": "C-8DH24X-N001-d", + "sampleName": "01-XXXXXXXa", + "cmoSampleClass": "Normal", + "oncoTreeCode": "COAD", + "collectionYear": "", + "tubeId": "", + "qcReports": [], + "libraries": [ + { + "barcodeId": "TNG65", + "barcodeIndex": "TGGAACAA", + "libraryIgoId": "MOCKREQUEST1_B_4_1_1_1", + "libraryVolume": 35.0, + "libraryConcentrationNgul": 34.1, + "captureConcentrationNm": "4.9853372434017595", + "captureInputNg": "170.0", + "captureName": "Pool-MOCKREQUEST1_B-Tube7_1", + "runs": [ + { + "runMode": "HiSeq High Output", + "runId": "RUNID_0123", + "flowCellId": "X5KL2KKAY", + "readLength": "", + "runDate": "2018-06-05", + "flowCellLanes": [ + 5 + ], + "fastqs": [ + "/FASTQ/Project_MOCKREQUEST1_B/Sample_01-XXXXXXXa_IGO_MOCKREQUEST1_B_4/01-XXXXXXXa_IGO_MOCKREQUEST1_B_4_S85_R1_001.fastq.gz", + "/FASTQ/Project_MOCKREQUEST1_B/Sample_01-XXXXXXXa_IGO_MOCKREQUEST1_B_4/01-XXXXXXXa_IGO_MOCKREQUEST1_B_4_S85_R2_001.fastq.gz" + ] + } + ] + } + ], + "cmoPatientId": "C-8DH24X", + "igoId": "MOCKREQUEST1_B_4", + "investigatorSampleId": "01-XXXXXXXa", + "species": "Human", + "sex": "M", + "tumorOrNormal": "Normal", + "preservation": "Frozen", + "specimenType": "Blood", + "sampleOrigin": "Whole Blood", + "tissueLocation": "", + "baitSet": "GENESET101_BAITS", + "igoComplete": true, + "cmoSampleIdFields": { + "naToExtract": "", + "sampleType": "Whole Blood", + "normalizedPatientId": "MRN_REDACTED", + "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" + } + } + ], + "pooledNormals": [ + "/FASTQ/Project_POOLEDNORMALS/Sample_FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA/FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA_S23_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA/FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA_S23_R2_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG_S86_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG_S86_R2_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG_S147_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG_S147_R2_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG_S196_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG_S196_R2_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT/MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT_S61_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT/MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT_S61_R2_001.fastq.gz" + ], + "projectId": "MOCKREQUEST1" +} diff --git a/src/test/resources/data/incoming_requests/mocked_request1_sample_missing_fastqs.json b/src/test/resources/data/incoming_requests/mocked_request1_sample_missing_fastqs.json index 4c9d30e..5a21866 100644 --- a/src/test/resources/data/incoming_requests/mocked_request1_sample_missing_fastqs.json +++ b/src/test/resources/data/incoming_requests/mocked_request1_sample_missing_fastqs.json @@ -68,6 +68,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "PDX" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -123,6 +127,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "Blood" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -174,6 +182,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "PDX" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -226,6 +238,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "Blood" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request1_updated_complete_tumor_normal.json b/src/test/resources/data/incoming_requests/mocked_request1_updated_complete_tumor_normal.json index c7d891a..52a9da6 100644 --- a/src/test/resources/data/incoming_requests/mocked_request1_updated_complete_tumor_normal.json +++ b/src/test/resources/data/incoming_requests/mocked_request1_updated_complete_tumor_normal.json @@ -11,8 +11,8 @@ "dataAnalystEmail": "dexterp@mskcc.org", "otherContactEmails": "dexterp@mskcc.org", "dataAccessEmails": "", - "qcAccessEmails": "", - "isCmoRequest": true, + "qcAccessEmails": "invalid-igo-update", + "isCmoRequest": false, "bicAnalysis": false, "samples": [ { @@ -68,6 +68,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -123,6 +127,10 @@ "sampleType": "Whole Blood", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -178,6 +186,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -233,6 +245,10 @@ "sampleType": "Whole Blood", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request1a_sample_type_abbreviation.json b/src/test/resources/data/incoming_requests/mocked_request1a_sample_type_abbreviation.json index 796b9b8..e258261 100644 --- a/src/test/resources/data/incoming_requests/mocked_request1a_sample_type_abbreviation.json +++ b/src/test/resources/data/incoming_requests/mocked_request1a_sample_type_abbreviation.json @@ -68,6 +68,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "PDX" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -123,6 +127,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "XenograftDerivedCellLine" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -178,6 +186,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "Exosome" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -233,6 +245,10 @@ "sampleType": "Whole Blood", "normalizedPatientId": "testingNormalizedPatientIdvalue", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request1b_nucleic_acid_abbreviation.json b/src/test/resources/data/incoming_requests/mocked_request1b_nucleic_acid_abbreviation.json index 62f01e1..69c5da8 100644 --- a/src/test/resources/data/incoming_requests/mocked_request1b_nucleic_acid_abbreviation.json +++ b/src/test/resources/data/incoming_requests/mocked_request1b_nucleic_acid_abbreviation.json @@ -68,6 +68,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "PDX" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -123,6 +127,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "Blood" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -178,6 +186,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "PDX" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -233,6 +245,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "Blood" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request1c_missing_all_samples.json b/src/test/resources/data/incoming_requests/mocked_request1c_missing_all_samples.json index 072380a..84bb8b3 100644 --- a/src/test/resources/data/incoming_requests/mocked_request1c_missing_all_samples.json +++ b/src/test/resources/data/incoming_requests/mocked_request1c_missing_all_samples.json @@ -68,6 +68,10 @@ "recipe": null, "normalizedPatientId": "wrongValue", "sampleType": "wrongValue" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -123,6 +127,10 @@ "recipe": null, "normalizedPatientId": "wrongValue", "sampleType": "wrongValue" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -178,6 +186,10 @@ "recipe": "", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "wrongValue" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -233,6 +245,10 @@ "sampleType": null, "normalizedPatientId": "wrongValue", "recipe": "" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request1d_missing_few_samples.json b/src/test/resources/data/incoming_requests/mocked_request1d_missing_few_samples.json index 7f8eec6..fcffd7d 100644 --- a/src/test/resources/data/incoming_requests/mocked_request1d_missing_few_samples.json +++ b/src/test/resources/data/incoming_requests/mocked_request1d_missing_few_samples.json @@ -68,6 +68,10 @@ "recipe": "", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -123,6 +127,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "", "sampleType": null + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -178,6 +186,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "PDX" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -233,6 +245,10 @@ "recipe": "GENESET101_BAITS", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "Blood" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request1e_null_string_baitset.json b/src/test/resources/data/incoming_requests/mocked_request1e_null_string_baitset.json index 7304271..beddf66 100644 --- a/src/test/resources/data/incoming_requests/mocked_request1e_null_string_baitset.json +++ b/src/test/resources/data/incoming_requests/mocked_request1e_null_string_baitset.json @@ -68,6 +68,10 @@ "recipe": "null", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "PDX" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -123,6 +127,10 @@ "recipe": "null", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "Blood" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -178,6 +186,10 @@ "recipe": "null", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "PDX" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -233,6 +245,10 @@ "recipe": "null", "normalizedPatientId": "testingNormalizedPatientIdvalue", "sampleType": "Blood" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request2a_one_empty_sample_metadata.json b/src/test/resources/data/incoming_requests/mocked_request2a_one_empty_sample_metadata.json index 85dc632..16ee629 100644 --- a/src/test/resources/data/incoming_requests/mocked_request2a_one_empty_sample_metadata.json +++ b/src/test/resources/data/incoming_requests/mocked_request2a_one_empty_sample_metadata.json @@ -66,6 +66,10 @@ "recipe": "", "normalizedPatientId": "", "sampleType": "" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request2a_one_normal.json b/src/test/resources/data/incoming_requests/mocked_request2a_one_normal.json index 1130076..fb605f5 100644 --- a/src/test/resources/data/incoming_requests/mocked_request2a_one_normal.json +++ b/src/test/resources/data/incoming_requests/mocked_request2a_one_normal.json @@ -77,6 +77,10 @@ "sampleType": "Buffy Coat", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request2b_missing_one_normal.json b/src/test/resources/data/incoming_requests/mocked_request2b_missing_one_normal.json index d2ad84c..a782be9 100644 --- a/src/test/resources/data/incoming_requests/mocked_request2b_missing_one_normal.json +++ b/src/test/resources/data/incoming_requests/mocked_request2b_missing_one_normal.json @@ -80,6 +80,10 @@ "sampleType": "Buffy Coat", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -147,6 +151,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -214,6 +222,10 @@ "sampleType": "", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -248,6 +260,10 @@ "sampleType": "Buffy Coat", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -315,6 +331,10 @@ "sampleType": "Buffy Coat", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -382,6 +402,10 @@ "sampleType": "Buffy Coat", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -449,6 +473,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -516,6 +544,10 @@ "sampleType": "Buffy Coat", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -583,6 +615,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -650,6 +686,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -717,6 +757,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -784,6 +828,10 @@ "sampleType": "Buffy Coat", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -851,6 +899,10 @@ "sampleType": "Buffy Coat", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -918,6 +970,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -985,6 +1041,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -1052,6 +1112,10 @@ "sampleType": "Buffy Coat", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -1119,6 +1183,10 @@ "sampleType": "Buffy Coat", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -1186,6 +1254,10 @@ "sampleType": "Buffy Coat", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -1253,6 +1325,10 @@ "sampleType": "Buffy Coat", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -1320,6 +1396,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -1387,6 +1467,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request3_pooled_normals.json b/src/test/resources/data/incoming_requests/mocked_request3_pooled_normals.json index d5f8fda..609756b 100644 --- a/src/test/resources/data/incoming_requests/mocked_request3_pooled_normals.json +++ b/src/test/resources/data/incoming_requests/mocked_request3_pooled_normals.json @@ -75,6 +75,10 @@ "sampleType": "Sorted Cells", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -137,6 +141,10 @@ "sampleType": "Sorted Cells", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -199,6 +207,10 @@ "sampleType": "Sorted Cells", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -261,6 +273,10 @@ "sampleType": "Sorted Cells", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request4_null_or_empty_values.json b/src/test/resources/data/incoming_requests/mocked_request4_null_or_empty_values.json index 65c14e2..a6ef38e 100644 --- a/src/test/resources/data/incoming_requests/mocked_request4_null_or_empty_values.json +++ b/src/test/resources/data/incoming_requests/mocked_request4_null_or_empty_values.json @@ -68,6 +68,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -123,6 +127,10 @@ "sampleType": "Whole Blood", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -178,6 +186,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -233,6 +245,10 @@ "sampleType": "Whole Blood", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request5_pt_multi_samples.json b/src/test/resources/data/incoming_requests/mocked_request5_pt_multi_samples.json index 278ec2a..ee3efd8 100644 --- a/src/test/resources/data/incoming_requests/mocked_request5_pt_multi_samples.json +++ b/src/test/resources/data/incoming_requests/mocked_request5_pt_multi_samples.json @@ -69,6 +69,10 @@ "sampleType": "Plasma", "normalizedPatientId": "MRN_REDACTED", "recipe": "null" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -123,6 +127,10 @@ "sampleType": "Plasma", "normalizedPatientId": "MRN_REDACTED", "recipe": "null" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -177,6 +185,10 @@ "sampleType": "Plasma", "normalizedPatientId": "MRN_REDACTED", "recipe": "null" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -231,6 +243,10 @@ "sampleType": "Plasma", "normalizedPatientId": "MRN_REDACTED", "recipe": "null" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -285,6 +301,10 @@ "sampleType": "Plasma", "normalizedPatientId": "MRN_REDACTED", "recipe": "null" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -339,6 +359,10 @@ "sampleType": "Plasma", "normalizedPatientId": "MRN_REDACTED", "recipe": "null" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request6_cmopt_after_swap.json b/src/test/resources/data/incoming_requests/mocked_request6_cmopt_after_swap.json index 012bab6..de188c0 100644 --- a/src/test/resources/data/incoming_requests/mocked_request6_cmopt_after_swap.json +++ b/src/test/resources/data/incoming_requests/mocked_request6_cmopt_after_swap.json @@ -68,6 +68,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -123,6 +127,10 @@ "sampleType": "Whole Blood", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -178,6 +186,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -233,6 +245,10 @@ "sampleType": "Whole Blood", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request6_cmopt_swap.json b/src/test/resources/data/incoming_requests/mocked_request6_cmopt_swap.json index 9a8084a..6d0b9fa 100644 --- a/src/test/resources/data/incoming_requests/mocked_request6_cmopt_swap.json +++ b/src/test/resources/data/incoming_requests/mocked_request6_cmopt_swap.json @@ -68,6 +68,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -123,6 +127,10 @@ "sampleType": "Whole Blood", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -178,6 +186,10 @@ "sampleType": "Tissue", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } }, { @@ -233,6 +245,10 @@ "sampleType": "Whole Blood", "normalizedPatientId": "MRN_REDACTED", "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" } } ], diff --git a/src/test/resources/data/incoming_requests/mocked_request8_duplicate_cmo_labels.json b/src/test/resources/data/incoming_requests/mocked_request8_duplicate_cmo_labels.json new file mode 100644 index 0000000..34d37b2 --- /dev/null +++ b/src/test/resources/data/incoming_requests/mocked_request8_duplicate_cmo_labels.json @@ -0,0 +1,150 @@ +{ + "requestId": "MOCKREQUEST8_D", + "recipe": "GENESET101_BAITS", + "projectManagerName": "Bar, Foo", + "piEmail": "request8pi@mskcc.org", + "labHeadName": "Foo Bar", + "labHeadEmail": "request1pi@mskcc.org", + "investigatorName": "John Smith", + "investigatorEmail": "smithj@mskcc.org", + "dataAnalystName": "Poin Dexter", + "dataAnalystEmail": "dexterp@mskcc.org", + "otherContactEmails": "dexterp@mskcc.org", + "dataAccessEmails": "", + "qcAccessEmails": "", + "isCmoRequest": true, + "bicAnalysis": false, + "samples": [ + { + "cmoSampleName": "C-MP636AP-N001-d", + "sampleName": "XXX002_P3_12345_L1", + "cmoSampleClass": "Primary", + "oncoTreeCode": "CLL", + "collectionYear": "", + "tubeId": "", + "qcReports": [], + "libraries": [ + { + "barcodeId": "IDT29", + "barcodeIndex": "ATTGAGGA", + "libraryIgoId": "MOCKREQUEST8_D_1_1_1_1", + "libraryVolume": 35.0, + "libraryConcentrationNgul": 34.8, + "captureConcentrationNm": "11.49425287356322", + "captureInputNg": "400.0", + "captureName": "Pool-MOCKREQUEST8_D-Tube7_1", + "runs": [ + { + "runMode": "HiSeq High Output", + "runId": "RUNID_0123", + "flowCellId": "X5KL2KKAY", + "readLength": "", + "runDate": "2018-06-05", + "flowCellLanes": [ + 5 + ], + "fastqs": [ + "/FASTQ/Project_MOCKREQUEST8_D/Sample_XXX002_P3_12345_L1_IGO_MOCKREQUEST8_D_1/XXX002_P3_12345_L1_IGO_MOCKREQUEST8_D_1_S82_R1_001.fastq.gz", + "/FASTQ/Project_MOCKREQUEST8_D/Sample_XXX002_P3_12345_L1_IGO_MOCKREQUEST8_D_1/XXX002_P3_12345_L1_IGO_MOCKREQUEST8_D_1_S82_R2_001.fastq.gz" + ] + } + ] + } + ], + "cmoPatientId": "C-MP636AP", + "igoId": "MOCKREQUEST8_D_1", + "investigatorSampleId": "NORMAL_SAMPLE8_123", + "species": "Human", + "sex": "F", + "tumorOrNormal": "Normal", + "preservation": "Frozen", + "specimenType": "PDX", + "sampleOrigin": "Tissue", + "tissueLocation": "", + "baitSet": "GENESET101_BAITS", + "igoComplete": true, + "cmoSampleIdFields": { + "naToExtract": "", + "sampleType": "Tissue", + "normalizedPatientId": "MRN_REDACTED", + "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" + } + }, + { + "cmoSampleName": "C-MP636AP-N001-d", + "sampleName": "01-0012345a", + "cmoSampleClass": "Normal", + "oncoTreeCode": "CLL", + "collectionYear": "", + "tubeId": "", + "qcReports": [], + "libraries": [ + { + "barcodeId": "TNG41", + "barcodeIndex": "CGACTGGA", + "libraryIgoId": "MOCKREQUEST8_D_2_1_1_1", + "libraryVolume": 35.0, + "libraryConcentrationNgul": 33.5, + "captureConcentrationNm": "5.074626865671642", + "captureInputNg": "170.0", + "captureName": "Pool-MOCKREQUEST8_D-Tube7_1", + "runs": [ + { + "runMode": "HiSeq High Output", + "runId": "RUNID_0123", + "flowCellId": "X5KL2KKAY", + "readLength": "", + "runDate": "2018-06-05", + "flowCellLanes": [ + 5 + ], + "fastqs": [ + "/FASTQ/Project_MOCKREQUEST8_D/Sample_01-0012345a_IGO_MOCKREQUEST8_D_2/01-0012345a_IGO_MOCKREQUEST8_D_2_S83_R2_001.fastq.gz", + "/FASTQ/Project_MOCKREQUEST8_D/Sample_01-0012345a_IGO_MOCKREQUEST8_D_2/01-0012345a_IGO_MOCKREQUEST8_D_2_S83_R1_001.fastq.gz" + ] + } + ] + } + ], + "cmoPatientId": "C-MP636AP", + "igoId": "MOCKREQUEST8_D_2", + "investigatorSampleId": "NORMAL_SAMPLE8_123", + "species": "Human", + "sex": "F", + "tumorOrNormal": "Normal", + "preservation": "Frozen", + "specimenType": "Blood", + "sampleOrigin": "Whole Blood", + "tissueLocation": "", + "baitSet": "GENESET101_BAITS", + "igoComplete": true, + "cmoSampleIdFields": { + "naToExtract": "", + "sampleType": "Whole Blood", + "normalizedPatientId": "MRN_REDACTED", + "recipe": "GENESET101_BAITS" + }, + "status": { + "validationStatus": true, + "validationReport": "{}" + } + } + ], + "pooledNormals": [ + "/FASTQ/Project_POOLEDNORMALS/Sample_FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA/FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA_S23_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA/FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA_S23_R2_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG_S86_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG_S86_R2_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG_S147_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG_S147_R2_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG_S196_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG_S196_R2_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT/MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT_S61_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT/MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT_S61_R2_001.fastq.gz" + ], + "projectId": "MOCKREQUEST1" +} diff --git a/src/test/resources/data/mocked_request_data_details.txt b/src/test/resources/data/mocked_request_data_details.txt index bed607f..7d7086e 100644 --- a/src/test/resources/data/mocked_request_data_details.txt +++ b/src/test/resources/data/mocked_request_data_details.txt @@ -25,5 +25,8 @@ mockRequest2aEmptySampleManifestValues incoming_requests/mocked_request2a_one_em mockRequest1SamplesMissingFastQs incoming_requests/mocked_request1_sample_missing_fastqs.json Mock requset json with 2 samples missing fastqs mockRequest1AllSamplesMissingFastQs incoming_requests/mocked_request1_all_samples_missing_fastqs.json Mock requset json with all samples missing fastqs mockRequest1eNullStringBaitSet incoming_requests/mocked_request1e_null_string_baitset.json Mock requset json with "null" baitset values +mockIncomingRequest1JsonDataWithLibraryUpdate incoming_requests/mocked_request1_complete_tumor_normal_updated_libraries.json Mock incoming request json with 2 tumor samples and 2 matching normals. Updated libraries for one sample. mockRequest7SamplesMissingPids incoming_requests/mocked_request7_samples_missing_pids.json Mock request where 3 of 4 samples are missing CMO patient IDs. mockValidatedRequest7SamplesMissingPids other_mocked_data/mocked_validated_request7_samples_missing_pids.json Request JSON after going through validation and sanity checks in request filter. Based on 'mockRequest7SamplesMissingPids'. +mockIncomingRequest8DupCmoLabels incoming_requests/mocked_request8_duplicate_cmo_labels.json Mock incoming request json with 2 normals with the same CMO labels. +mockPublishedRequest8DupCmoLabels published_requests/outgoing_mocked_request8_duplicate_cmo_labels.json Mock request json with 2 normals with the same CMO labels. diff --git a/src/test/resources/data/published_requests/outgoing_mocked_request8_duplicate_cmo_labels.json b/src/test/resources/data/published_requests/outgoing_mocked_request8_duplicate_cmo_labels.json new file mode 100644 index 0000000..bf816f2 --- /dev/null +++ b/src/test/resources/data/published_requests/outgoing_mocked_request8_duplicate_cmo_labels.json @@ -0,0 +1,214 @@ +{ + "smileRequestId": "c2319627-787a-4a9e-a062-bc75330f1849", + "igoProjectId": "MOCKREQUEST8", + "igoRequestId": "MOCKREQUEST8_D", + "genePanel": "GENESET101_BAITS", + "projectManagerName": "Bar, Foo", + "piEmail": "request8pi@mskcc.org", + "labHeadName": "Foo Bar", + "labHeadEmail": "request1pi@mskcc.org", + "investigatorName": "John Smith", + "investigatorEmail": "smithj@mskcc.org", + "dataAnalystName": "Poin Dexter", + "dataAnalystEmail": "dexterp@mskcc.org", + "otherContactEmails": "dexterp@mskcc.org", + "dataAccessEmails": "", + "qcAccessEmails": "", + "strand": null, + "libraryType": null, + "isCmoRequest": true, + "bicAnalysis": false, + "status": { + "validationStatus": true, + "validationReport": "{}" + }, + "requestJson": "{\"requestId\":\"MOCKREQUEST8_D\",\"projectId\":\"MOCKREQUEST1\",\"dataAccessEmails\":\"\",\"dataAnalystEmail\":\"dexterp@mskcc.org\",\"dataAnalystName\":\"Poin Dexter\",\"investigatorEmail\":\"smithj@mskcc.org\",\"investigatorName\":\"John Smith\",\"labHeadEmail\":\"request1pi@mskcc.org\",\"labHeadName\":\"Foo Bar\",\"libraryType\":null,\"otherContactEmails\":\"dexterp@mskcc.org\",\"piEmail\":\"request8pi@mskcc.org\",\"projectManagerName\":\"Bar, Foo\",\"qcAccessEmails\":\"\",\"recipe\":\"GENESET101_BAITS\",\"strand\":null,\"deliveryDate\":null,\"bicAnalysis\":false,\"isCmoRequest\":true,\"samples\":[{\"igoId\":\"MOCKREQUEST8_D_1\",\"cmoPatientId\":\"C-MP636AP\",\"cmoSampleName\":\"C-MP636AP-N001-d\",\"sampleName\":\"XXX002_P3_12345_L1\",\"baitSet\":\"GENESET101_BAITS\",\"cfDNA2dBarcode\":null,\"cmoInfoIgoId\":null,\"cmoSampleClass\":\"Primary\",\"collectionYear\":\"\",\"investigatorSampleId\":\"NORMAL_SAMPLE8_123\",\"oncoTreeCode\":\"CLL\",\"preservation\":\"Frozen\",\"sampleOrigin\":\"Tissue\",\"sex\":\"F\",\"species\":\"Human\",\"specimenType\":\"PDX\",\"tissueLocation\":\"\",\"tubeId\":\"\",\"tumorOrNormal\":\"Normal\",\"igoComplete\":true,\"qcReports\":[],\"libraries\":[{\"barcodeId\":\"IDT29\",\"barcodeIndex\":\"ATTGAGGA\",\"libraryIgoId\":\"MOCKREQUEST8_D_1_1_1_1\",\"libraryVolume\":35.0,\"libraryConcentrationNgul\":34.8,\"dnaInputNg\":null,\"captureConcentrationNm\":\"11.49425287356322\",\"captureInputNg\":\"400.0\",\"captureName\":\"Pool-MOCKREQUEST8_D-Tube7_1\",\"runs\":[{\"runMode\":\"HiSeq High Output\",\"runId\":\"RUNID_0123\",\"flowCellId\":\"X5KL2KKAY\",\"readLength\":\"\",\"runDate\":\"2018-06-05\",\"flowCellLanes\":[5],\"fastqs\":[\"/FASTQ/Project_MOCKREQUEST8_D/Sample_XXX002_P3_12345_L1_IGO_MOCKREQUEST8_D_1/XXX002_P3_12345_L1_IGO_MOCKREQUEST8_D_1_S82_R1_001.fastq.gz\",\"/FASTQ/Project_MOCKREQUEST8_D/Sample_XXX002_P3_12345_L1_IGO_MOCKREQUEST8_D_1/XXX002_P3_12345_L1_IGO_MOCKREQUEST8_D_1_S82_R2_001.fastq.gz\"]}]}],\"cmoSampleIdFields\":{\"naToExtract\":\"\",\"sampleType\":\"Tissue\",\"normalizedPatientId\":\"MRN_REDACTED\",\"recipe\":\"GENESET101_BAITS\"}},{\"igoId\":\"MOCKREQUEST8_D_2\",\"cmoPatientId\":\"C-MP636AP\",\"cmoSampleName\":\"C-MP636AP-N001-d\",\"sampleName\":\"01-0012345a\",\"baitSet\":\"GENESET101_BAITS\",\"cfDNA2dBarcode\":null,\"cmoInfoIgoId\":null,\"cmoSampleClass\":\"Normal\",\"collectionYear\":\"\",\"investigatorSampleId\":\"NORMAL_SAMPLE8_123\",\"oncoTreeCode\":\"CLL\",\"preservation\":\"Frozen\",\"sampleOrigin\":\"Whole Blood\",\"sex\":\"F\",\"species\":\"Human\",\"specimenType\":\"Blood\",\"tissueLocation\":\"\",\"tubeId\":\"\",\"tumorOrNormal\":\"Normal\",\"igoComplete\":true,\"qcReports\":[],\"libraries\":[{\"barcodeId\":\"TNG41\",\"barcodeIndex\":\"CGACTGGA\",\"libraryIgoId\":\"MOCKREQUEST8_D_2_1_1_1\",\"libraryVolume\":35.0,\"libraryConcentrationNgul\":33.5,\"dnaInputNg\":null,\"captureConcentrationNm\":\"5.074626865671642\",\"captureInputNg\":\"170.0\",\"captureName\":\"Pool-MOCKREQUEST8_D-Tube7_1\",\"runs\":[{\"runMode\":\"HiSeq High Output\",\"runId\":\"RUNID_0123\",\"flowCellId\":\"X5KL2KKAY\",\"readLength\":\"\",\"runDate\":\"2018-06-05\",\"flowCellLanes\":[5],\"fastqs\":[\"/FASTQ/Project_MOCKREQUEST8_D/Sample_01-0012345a_IGO_MOCKREQUEST8_D_2/01-0012345a_IGO_MOCKREQUEST8_D_2_S83_R2_001.fastq.gz\",\"/FASTQ/Project_MOCKREQUEST8_D/Sample_01-0012345a_IGO_MOCKREQUEST8_D_2/01-0012345a_IGO_MOCKREQUEST8_D_2_S83_R1_001.fastq.gz\"]}]}],\"cmoSampleIdFields\":{\"naToExtract\":\"\",\"sampleType\":\"Whole Blood\",\"normalizedPatientId\":\"MRN_REDACTED\",\"recipe\":\"GENESET101_BAITS\"}}],\"pooledNormals\":[\"/FASTQ/Project_POOLEDNORMALS/Sample_FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA/FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA_S23_R1_001.fastq.gz\",\"/FASTQ/Project_POOLEDNORMALS/Sample_FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA/FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA_S23_R2_001.fastq.gz\",\"/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG_S86_R1_001.fastq.gz\",\"/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG_S86_R2_001.fastq.gz\",\"/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG_S147_R1_001.fastq.gz\",\"/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG_S147_R2_001.fastq.gz\",\"/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG_S196_R1_001.fastq.gz\",\"/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG_S196_R2_001.fastq.gz\",\"/FASTQ/Project_POOLEDNORMALS/Sample_MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT/MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT_S61_R1_001.fastq.gz\",\"/FASTQ/Project_POOLEDNORMALS/Sample_MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT/MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT_S61_R2_001.fastq.gz\"]}", + "pooledNormals": [ + "/FASTQ/Project_POOLEDNORMALS/Sample_FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA/FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA_S23_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA/FFPEPOOLEDNORMAL_IGO_GENESET101_TAGCTTGA_S23_R2_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG_S86_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_AMBIGUOUS_TTAGGCTG_S86_R2_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG_S147_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_HEMESET_v1_TTAGGCTG_S147_R2_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG_S196_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG/FROZENPOOLEDNORMAL_IGO_GENESET101_TTAGGCTG_S196_R2_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT/MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT_S61_R1_001.fastq.gz", + "/FASTQ/Project_POOLEDNORMALS/Sample_MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT/MOUSEPOOLEDNORMAL_IGO_AMBIGUOUS_GGCGTCAT_S61_R2_001.fastq.gz" + ], + "samples": [ + { + "smileSampleId": "00a9d4df-dc88-4c6e-9535-3a0a80453a63", + "smilePatientId": "bac03a20-c092-4121-968f-21ebd3670323", + "primaryId": "MOCKREQUEST8_D_1", + "cmoPatientId": "C-MP636AP", + "cmoSampleName": "C-MP636AP-N001-d", + "sampleName": "XXX002_P3_12345_L1", + "cmoInfoIgoId": null, + "investigatorSampleId": "NORMAL_SAMPLE8_123", + "importDate": "2024-11-21", + "sampleType": "Primary", + "oncotreeCode": "CLL", + "collectionYear": "", + "tubeId": "", + "cfDNA2dBarcode": null, + "species": "Human", + "sex": "F", + "tumorOrNormal": "Normal", + "preservation": "Frozen", + "sampleClass": "PDX", + "sampleOrigin": "Tissue", + "tissueLocation": "", + "genePanel": "GENESET101_BAITS", + "baitSet": "GENESET101_BAITS", + "datasource": "igo", + "igoComplete": true, + "status": { + "validationStatus": true, + "validationReport": "{}" + }, + "cmoSampleIdFields": { + "naToExtract": "", + "sampleType": "Tissue", + "normalizedPatientId": "MRN_REDACTED", + "recipe": "GENESET101_BAITS" + }, + "qcReports": [], + "libraries": [ + { + "barcodeId": "IDT29", + "barcodeIndex": "ATTGAGGA", + "libraryIgoId": "MOCKREQUEST8_D_1_1_1_1", + "libraryVolume": 35.0, + "libraryConcentrationNgul": 34.8, + "dnaInputNg": null, + "captureConcentrationNm": "11.49425287356322", + "captureInputNg": "400.0", + "captureName": "Pool-MOCKREQUEST8_D-Tube7_1", + "runs": [ + { + "runMode": "HiSeq High Output", + "runId": "RUNID_0123", + "flowCellId": "X5KL2KKAY", + "readLength": "", + "runDate": "2018-06-05", + "flowCellLanes": [ + 5 + ], + "fastqs": [ + "/FASTQ/Project_MOCKREQUEST8_D/Sample_XXX002_P3_12345_L1_IGO_MOCKREQUEST8_D_1/XXX002_P3_12345_L1_IGO_MOCKREQUEST8_D_1_S82_R1_001.fastq.gz", + "/FASTQ/Project_MOCKREQUEST8_D/Sample_XXX002_P3_12345_L1_IGO_MOCKREQUEST8_D_1/XXX002_P3_12345_L1_IGO_MOCKREQUEST8_D_1_S82_R2_001.fastq.gz" + ] + } + ] + } + ], + "sampleAliases": [ + { + "value": "NORMAL_SAMPLE8_123", + "namespace": "investigatorId" + }, + { + "value": "MOCKREQUEST8_D_1", + "namespace": "igoId" + } + ], + "patientAliases": [ + { + "value": "C-MP636AP", + "namespace": "cmoId" + } + ], + "additionalProperties": { + "igoRequestId": "MOCKREQUEST8_D", + "isCmoSample": "true" + } + }, + { + "smileSampleId": "8c20b119-b2ba-477d-a332-9a3252b296b9", + "smilePatientId": "bac03a20-c092-4121-968f-21ebd3670323", + "primaryId": "MOCKREQUEST8_D_2", + "cmoPatientId": "C-MP636AP", + "cmoSampleName": "C-MP636AP-N001-d", + "sampleName": "01-0012345a", + "cmoInfoIgoId": null, + "investigatorSampleId": "NORMAL_SAMPLE8_123", + "importDate": "2024-11-21", + "sampleType": "Normal", + "oncotreeCode": "CLL", + "collectionYear": "", + "tubeId": "", + "cfDNA2dBarcode": null, + "species": "Human", + "sex": "F", + "tumorOrNormal": "Normal", + "preservation": "Frozen", + "sampleClass": "Blood", + "sampleOrigin": "Whole Blood", + "tissueLocation": "", + "genePanel": "GENESET101_BAITS", + "baitSet": "GENESET101_BAITS", + "datasource": "igo", + "igoComplete": true, + "status": { + "validationStatus": true, + "validationReport": "{}" + }, + "cmoSampleIdFields": { + "naToExtract": "", + "sampleType": "Whole Blood", + "normalizedPatientId": "MRN_REDACTED", + "recipe": "GENESET101_BAITS" + }, + "qcReports": [], + "libraries": [ + { + "barcodeId": "TNG41", + "barcodeIndex": "CGACTGGA", + "libraryIgoId": "MOCKREQUEST8_D_2_1_1_1", + "libraryVolume": 35.0, + "libraryConcentrationNgul": 33.5, + "dnaInputNg": null, + "captureConcentrationNm": "5.074626865671642", + "captureInputNg": "170.0", + "captureName": "Pool-MOCKREQUEST8_D-Tube7_1", + "runs": [ + { + "runMode": "HiSeq High Output", + "runId": "RUNID_0123", + "flowCellId": "X5KL2KKAY", + "readLength": "", + "runDate": "2018-06-05", + "flowCellLanes": [ + 5 + ], + "fastqs": [ + "/FASTQ/Project_MOCKREQUEST8_D/Sample_01-0012345a_IGO_MOCKREQUEST8_D_2/01-0012345a_IGO_MOCKREQUEST8_D_2_S83_R2_001.fastq.gz", + "/FASTQ/Project_MOCKREQUEST8_D/Sample_01-0012345a_IGO_MOCKREQUEST8_D_2/01-0012345a_IGO_MOCKREQUEST8_D_2_S83_R1_001.fastq.gz" + ] + } + ] + } + ], + "sampleAliases": [ + { + "value": "NORMAL_SAMPLE8_123", + "namespace": "investigatorId" + }, + { + "value": "MOCKREQUEST8_D_2", + "namespace": "igoId" + } + ], + "patientAliases": [ + { + "value": "C-MP636AP", + "namespace": "cmoId" + } + ], + "additionalProperties": { + "igoRequestId": "MOCKREQUEST8_D", + "isCmoSample": "true" + } + } + ] +}