Skip to content

Commit

Permalink
Add 'igoComplete: false' to sample-level validation report (#55)
Browse files Browse the repository at this point in the history
* Add 'igoComplete: false' to sample-level validation report

* Add test

* Update test function's comment

* Fix typing of sampleMap
  • Loading branch information
qu8n authored Jul 14, 2023
1 parent 881d9d8 commit c79562b
Show file tree
Hide file tree
Showing 4 changed files with 302 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ public Map<String, Object> generateCmoSampleValidationMap(Map<String, Object> sa
validationReport.put("recipe", "missing");
}
}

if (!hasCmoPatientId(sampleMap)) {
validationStatus = Boolean.FALSE;
validationReport.put("cmoPatientId", "missing");
Expand All @@ -303,6 +302,10 @@ public Map<String, Object> generateCmoSampleValidationMap(Map<String, Object> 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;
Expand Down Expand Up @@ -486,6 +489,10 @@ private Boolean hasFastQs(Map<String, Object> sampleMap) {
return Boolean.FALSE;
}

private Boolean isIgoComplete(Map<String, Object> sampleMap) {
return (Boolean) sampleMap.get("igoComplete");
}

/**
* Determines whether sample has a valid specimen type or has a valid alternative
* to fall back on.
Expand Down
27 changes: 26 additions & 1 deletion src/test/java/org/mskcc/smile/ValidRequestCheckerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String, Object> requestJsonMap = mapper.readValue(modifiedRequestJson, Map.class);
Object[] sampleList = mapper.convertValue(requestJsonMap.get("samples"),
Object[].class);
for (Object sample: sampleList) {
Map<String, Object> sampleMap = mapper.convertValue(sample, Map.class);
Map<String, Object> sampleStatus = mapper.convertValue(sampleMap.get("status"), Map.class);
if (!Boolean.valueOf(sampleMap.get("igoComplete").toString())) {
Assert.assertFalse((Boolean) sampleStatus.get("validationStatus"));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
{
"requestId": "MOCKREQUEST1_B",
"recipe": "GENESET101_BAITS",
"projectManagerName": "Bar, Foo",
"piEmail": "[email protected]",
"labHeadName": "Foo Bar",
"labHeadEmail": "[email protected]",
"investigatorName": "John Smith",
"investigatorEmail": "[email protected]",
"dataAnalystName": "Poin Dexter",
"dataAnalystEmail": "[email protected]",
"otherContactEmails": "[email protected]",
"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"
}
9 changes: 5 additions & 4 deletions src/test/resources/data/mocked_request_data_details.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
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.

0 comments on commit c79562b

Please sign in to comment.