From c79562bb2a1ce03fde4b2972fc293120541bf6ee Mon Sep 17 00:00:00 2001 From: Quan Nguyen <86090707+qu8n@users.noreply.github.com> Date: Fri, 14 Jul 2023 13:47:58 -0400 Subject: [PATCH] Add 'igoComplete: false' to sample-level validation report (#55) * Add 'igoComplete: false' to sample-level validation report * Add test * Update test function's comment * Fix typing of sampleMap --- .../service/impl/ValidRequestCheckerImpl.java | 9 +- .../mskcc/smile/ValidRequestCheckerTest.java | 27 +- .../mocked_request8_false_igo_complete.json | 263 ++++++++++++++++++ .../data/mocked_request_data_details.txt | 9 +- 4 files changed, 302 insertions(+), 6 deletions(-) create mode 100644 src/test/resources/data/incoming_requests/mocked_request8_false_igo_complete.json diff --git a/src/main/java/org/mskcc/smile/service/impl/ValidRequestCheckerImpl.java b/src/main/java/org/mskcc/smile/service/impl/ValidRequestCheckerImpl.java index 9b5351b..4a615e7 100644 --- a/src/main/java/org/mskcc/smile/service/impl/ValidRequestCheckerImpl.java +++ b/src/main/java/org/mskcc/smile/service/impl/ValidRequestCheckerImpl.java @@ -281,7 +281,6 @@ public Map generateCmoSampleValidationMap(Map sa validationReport.put("recipe", "missing"); } } - if (!hasCmoPatientId(sampleMap)) { validationStatus = Boolean.FALSE; validationReport.put("cmoPatientId", "missing"); @@ -303,6 +302,10 @@ public Map generateCmoSampleValidationMap(Map sa validationStatus = Boolean.FALSE; validationReport.put("fastQs", "missing"); } + if (!isIgoComplete(sampleMap)) { + validationStatus = Boolean.FALSE; + validationReport.put("igoComplete", "false"); + } validationMap.put("validationStatus", validationStatus); validationMap.put("validationReport", validationReport); return validationMap; @@ -486,6 +489,10 @@ private Boolean hasFastQs(Map sampleMap) { return Boolean.FALSE; } + private Boolean isIgoComplete(Map sampleMap) { + return (Boolean) sampleMap.get("igoComplete"); + } + /** * Determines whether sample has a valid specimen type or has a valid alternative * to fall back on. diff --git a/src/test/java/org/mskcc/smile/ValidRequestCheckerTest.java b/src/test/java/org/mskcc/smile/ValidRequestCheckerTest.java index b0ad6cb..ab5bba4 100644 --- a/src/test/java/org/mskcc/smile/ValidRequestCheckerTest.java +++ b/src/test/java/org/mskcc/smile/ValidRequestCheckerTest.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import java.util.Map; -import junit.framework.Assert; +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mskcc.smile.config.MockDataConfig; @@ -335,4 +335,29 @@ public void testRequestSamplesMissingPatientIds() throws Exception { Object[].class); Assert.assertTrue(failedSamplesList.length == 3); } + + /** + * Test for handling request with 2 out of 4 samples having igoComplete set to false. + * + */ + @Test + public void testRequestJsonWithSamplesHavingFalseIgoComplete() throws Exception { + MockJsonTestData requestJson = mockedRequestJsonDataMap + .get("mockRequest8FalseIgoComplete"); + + String modifiedRequestJson = validRequestChecker + .getFilteredValidRequestJson(requestJson.getJsonString()); + Assert.assertNotNull(modifiedRequestJson); + + Map requestJsonMap = mapper.readValue(modifiedRequestJson, Map.class); + Object[] sampleList = mapper.convertValue(requestJsonMap.get("samples"), + Object[].class); + for (Object sample: sampleList) { + Map sampleMap = mapper.convertValue(sample, Map.class); + Map sampleStatus = mapper.convertValue(sampleMap.get("status"), Map.class); + if (!Boolean.valueOf(sampleMap.get("igoComplete").toString())) { + Assert.assertFalse((Boolean) sampleStatus.get("validationStatus")); + } + } + } } diff --git a/src/test/resources/data/incoming_requests/mocked_request8_false_igo_complete.json b/src/test/resources/data/incoming_requests/mocked_request8_false_igo_complete.json new file mode 100644 index 0000000..4227879 --- /dev/null +++ b/src/test/resources/data/incoming_requests/mocked_request8_false_igo_complete.json @@ -0,0 +1,263 @@ +{ + "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", + "libraryVolume": 35.0, + "libraryConcentrationNgul": 34.8, + "captureConcentrationNm": "11.49425287356322", + "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_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": false, + "cmoSampleIdFields": { + "naToExtract": "", + "sampleType": "Tissue", + "normalizedPatientId": "MRN_REDACTED", + "recipe": "GENESET101_BAITS" + } + }, + { + "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": false, + "cmoSampleIdFields": { + "naToExtract": "", + "sampleType": "Whole Blood", + "normalizedPatientId": "MRN_REDACTED", + "recipe": "GENESET101_BAITS" + } + }, + { + "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" + } + }, + { + "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": [] + }, + { + "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" + } + } + ], + "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 a826ef9..0e3c357 100644 --- a/src/test/resources/data/mocked_request_data_details.txt +++ b/src/test/resources/data/mocked_request_data_details.txt @@ -22,8 +22,9 @@ mockRequest1cJsonDataWithMAS incoming_requests/mocked_request1c_missing_all_samp mockRequest1dJsonDataWithMFS incoming_requests/mocked_request1d_missing_few_samples.json Mock request json with 2 invalid and 2 valid samples mockRequest4JsonNullOrEmptyValues incoming_requests/mocked_request4_null_or_empty_values.json Mock request json with null or empty values. mockRequest2aEmptySampleManifestValues incoming_requests/mocked_request2a_one_empty_sample_metadata.json Mock request json with empty sample metadata fields. -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 +mockRequest1SamplesMissingFastQs incoming_requests/mocked_request1_sample_missing_fastqs.json Mock request json with 2 samples missing fastqs +mockRequest1AllSamplesMissingFastQs incoming_requests/mocked_request1_all_samples_missing_fastqs.json Mock request json with all samples missing fastqs +mockRequest1eNullStringBaitSet incoming_requests/mocked_request1e_null_string_baitset.json Mock request json with "null" baitset values 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'. \ No newline at end of file +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'. +mockRequest8FalseIgoComplete incoming_requests/mocked_request8_false_igo_complete.json Mock request where 2 of 4 samples has igoComplete set to false. \ No newline at end of file