Skip to content

Commit

Permalink
[GLT-4065] added extraction substep TAT fields (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
djcooke authored Jun 13, 2024
1 parent 7663ba6 commit 9c34ee4
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 1 deletion.
12 changes: 12 additions & 0 deletions cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Sample.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public class Sample {
private final BigDecimal relativeCpgInRegions;
private final BigDecimal methylationBeta;
private final Integer peReads;
private final LocalDate transferDate;

private Sample(Builder builder) {
this.id = requireNonNull(builder.id);
Expand Down Expand Up @@ -124,6 +125,7 @@ private Sample(Builder builder) {
this.latestActivityDate = Stream.of(createdDate, qcDate, dataReviewDate)
.filter(Objects::nonNull).max(LocalDate::compareTo).orElseThrow();
}
this.transferDate = builder.transferDate;
}

@Override
Expand Down Expand Up @@ -340,6 +342,10 @@ public Integer getPeReads() {
return peReads;
}

public LocalDate getTransferDate() {
return transferDate;
}

@Override
public int hashCode() {
return Objects.hash(id, run, sequencingLane);
Expand Down Expand Up @@ -398,6 +404,7 @@ public static class Builder {
private BigDecimal methylationBeta;
private Integer peReads;
private LocalDate latestActivityDate;
private LocalDate transferDate;

public Sample build() {
return new Sample(this);
Expand Down Expand Up @@ -662,5 +669,10 @@ public Builder latestActivityDate(LocalDate latestActivityDate) {
return this;
}

public Builder transferDate(LocalDate transferDate) {
this.transferDate = transferDate;
return this;
}

}
}
36 changes: 36 additions & 0 deletions cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public class Test {
private final String tissueType;
private final String libraryDesignCode;
private final int extractionDaysSpent;
private final int extractionPreparationDaysSpent;
private final int extractionQcDaysSpent;
private final int extractionTransferDaysSpent;
private final int libraryPreparationDaysSpent;
private final int libraryQualificationDaysSpent;
private final int libraryQualificationLoadingDaysSpent;
Expand Down Expand Up @@ -74,6 +77,9 @@ private Test(Builder builder) {
}

this.extractionDaysSpent = builder.extractionDaysSpent;
this.extractionPreparationDaysSpent = builder.extractionPreparationDaysSpent;
this.extractionQcDaysSpent = builder.extractionQcDaysSpent;
this.extractionTransferDaysSpent = builder.extractionTransferDaysSpent;
this.libraryPreparationDaysSpent = builder.libraryPreparationDaysSpent;
this.libraryQualificationDaysSpent = builder.libraryQualificationDaysSpent;
this.libraryQualificationLoadingDaysSpent = builder.libraryQualificationLoadingDaysSpent;
Expand Down Expand Up @@ -149,6 +155,18 @@ public int getExtractionDaysSpent() {
return extractionDaysSpent;
}

public int getExtractionPreparationDaysSpent() {
return extractionPreparationDaysSpent;
}

public int getExtractionQcDaysSpent() {
return extractionQcDaysSpent;
}

public int getExtractionTransferDaysSpent() {
return extractionTransferDaysSpent;
}

public int getLibraryPreparationDaysSpent() {
return libraryPreparationDaysSpent;
}
Expand Down Expand Up @@ -203,6 +221,9 @@ public static class Builder {
private String tissueOrigin;
private String tissueType;
private int extractionDaysSpent;
private int extractionPreparationDaysSpent;
private int extractionQcDaysSpent;
private int extractionTransferDaysSpent;
private int libraryPreparationDaysSpent;
private int libraryQualificationDaysSpent;
private int libraryQualificationLoadingDaysSpent;
Expand Down Expand Up @@ -293,6 +314,21 @@ public Builder extractionDaysSpent(int days) {
return this;
}

public Builder extractionPreparationDaysSpent(int days) {
this.extractionPreparationDaysSpent = days;
return this;
}

public Builder extractionQcDaysSpent(int days) {
this.extractionQcDaysSpent = days;
return this;
}

public Builder extractionTransferDaysSpent(int days) {
this.extractionTransferDaysSpent = days;
return this;
}

public Builder libraryPreparationDaysSpent(int days) {
this.libraryPreparationDaysSpent = days;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ private static void assertSampleEqual(Sample one, Sample two) {
assertEquals(one.getRelativeCpgInRegions(), two.getRelativeCpgInRegions());
assertEquals(one.getMethylationBeta(), two.getMethylationBeta());
assertEquals(one.getPeReads(), two.getPeReads());
assertEquals(one.getTransferDate(), two.getTransferDate());
}

private static void assertTestEqual(Test one, Test two) {
Expand All @@ -436,6 +437,9 @@ private static void assertTestEqual(Test one, Test two) {
assertEquals(one.getTissueType(), two.getTissueType());
assertEquals(one.getLibraryDesignCode(), two.getLibraryDesignCode());
assertEquals(one.getExtractionDaysSpent(), two.getExtractionDaysSpent());
assertEquals(one.getExtractionPreparationDaysSpent(), two.getExtractionPreparationDaysSpent());
assertEquals(one.getExtractionQcDaysSpent(), two.getExtractionQcDaysSpent());
assertEquals(one.getExtractionTransferDaysSpent(), two.getExtractionTransferDaysSpent());
assertEquals(one.getLibraryPreparationDaysSpent(), two.getLibraryPreparationDaysSpent());
assertEquals(one.getLibraryQualificationDaysSpent(), two.getLibraryQualificationDaysSpent());
assertEquals(one.getLibraryQualificationLoadingDaysSpent(),
Expand Down Expand Up @@ -712,6 +716,7 @@ private static Sample makeSample(String name) {
.relativeCpgInRegions(new BigDecimal("6.66"))
.methylationBeta(new BigDecimal("7.77"))
.peReads(35)
.transferDate(LocalDate.of(2024, 06, 11))
.build();
}

Expand All @@ -731,7 +736,10 @@ private static Test makeTest() {
.tissueOrigin("Lv")
.tissueType("P")
.libraryDesignCode("WG")
.extractionDaysSpent(1)
.extractionDaysSpent(3)
.extractionPreparationDaysSpent(1)
.extractionQcDaysSpent(0)
.extractionTransferDaysSpent(2)
.libraryPreparationDaysSpent(2)
.libraryQualificationDaysSpent(3)
.libraryQualificationLoadingDaysSpent(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ protected Map<String, Sample> loadSamples(FileReader fileReader, Map<String, Don
.dataReviewUser(parseString(json, "data_review_user"))
.dataReviewDate(parseDate(json, "data_review_date"))
.sequencingLane(parseString(json, "sequencing_lane"))
.transferDate(parseDate(json, "transfer_date"))
.build();
});

Expand Down Expand Up @@ -729,6 +730,11 @@ private List<Test> parseTests(JsonNode json, String fieldName, Map<String, Sampl
.fullDepthSequencings(
parseIdsAndGet(testNode, "full_depth_sequencing_ids", JsonNode::asText, samplesById))
.extractionDaysSpent(parseInteger(testNode, "extraction_days_spent", true))
.extractionPreparationDaysSpent(
parseInteger(testNode, "extraction_preparation_days_spent", true))
.extractionQcDaysSpent(parseInteger(testNode, "extraction_qc_days_spent", true))
.extractionTransferDaysSpent(
parseInteger(testNode, "extraction_transfer_days_spent", true))
.libraryPreparationDaysSpent(
parseInteger(testNode, "library_preparation_days_spent", true))
.libraryQualificationDaysSpent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ private static void assertSample(Sample sample) {
assertEquals("PROJ_1289_Ly_R_nn_1-1", sample.getName());
assertEquals(Boolean.TRUE, sample.getQcPassed());
assertEquals(LocalDate.of(2021, 7, 19), sample.getQcDate());
assertNull(sample.getTransferDate());
}

private static void assertRun(Run run) {
Expand Down Expand Up @@ -169,6 +170,9 @@ public void testLoad() throws Exception {
assertEquals("PROJ_1289_Ly_R_PE_567_WG", fullDepth.getName());
assertEquals(Boolean.TRUE, fullDepth.getQcPassed());
assertEquals(1, test.getExtractionDaysSpent());
assertEquals(0, test.getExtractionPreparationDaysSpent());
assertEquals(0, test.getExtractionQcDaysSpent());
assertEquals(1, test.getExtractionTransferDaysSpent());
assertEquals(2, test.getLibraryPreparationDaysSpent());
assertEquals(6, test.getLibraryQualificationDaysSpent());
assertEquals(1, test.getLibraryQualificationLoadingDaysSpent());
Expand Down
9 changes: 9 additions & 0 deletions cardea-server/src/test/resources/testdata/cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
"library_qualification_ids": ["5459_1_LDI73620", "5467_1_LDI73620"],
"full_depth_sequencing_ids": ["5476_1_LDI73620"],
"extraction_days_spent": 1,
"extraction_preparation_days_spent": 0,
"extraction_qc_days_spent": 0,
"extraction_transfer_days_spent": 1,
"library_preparation_days_spent": 2,
"library_qualification_days_spent": 6,
"library_qualification_loading_days_spent": 1,
Expand All @@ -55,6 +58,9 @@
"library_qualification_ids": ["5460_1_LDI73998"],
"full_depth_sequencing_ids": ["5481_1_LDI73998"],
"extraction_days_spent": 0,
"extraction_preparation_days_spent": 0,
"extraction_qc_days_spent": 0,
"extraction_transfer_days_spent": 0,
"library_preparation_days_spent": 0,
"library_qualification_days_spent": 0,
"library_qualification_loading_days_spent": 0,
Expand All @@ -80,6 +86,9 @@
"library_qualification_ids": ["5459_1_LDI73621", "5467_1_LDI73621"],
"full_depth_sequencing_ids": ["5476_1_LDI73621", "5540_1_LDI73621"],
"extraction_days_spent": 0,
"extraction_preparation_days_spent": 0,
"extraction_qc_days_spent": 0,
"extraction_transfer_days_spent": 0,
"library_preparation_days_spent": 0,
"library_qualification_days_spent": 0,
"library_qualification_loading_days_spent": 0,
Expand Down
20 changes: 20 additions & 0 deletions cardea-server/src/test/resources/testdata/samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"requisitioned": true,
"requisition_id": 512,
"qcable_type": "receipt_inspection",
"transfer_date": null,
"mean_insert": null,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -98,6 +99,7 @@
"requisitioned": true,
"requisition_id": 512,
"qcable_type": "receipt_inspection",
"transfer_date": null,
"mean_insert": null,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -153,6 +155,7 @@
"requisitioned": true,
"requisition_id": 512,
"qcable_type": "receipt_inspection",
"transfer_date": null,
"mean_insert": null,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -208,6 +211,7 @@
"requisitioned": true,
"requisition_id": 512,
"qcable_type": "receipt_inspection",
"transfer_date": null,
"mean_insert": null,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -263,6 +267,7 @@
"requisitioned": true,
"requisition_id": 512,
"qcable_type": "receipt_inspection",
"transfer_date": null,
"mean_insert": null,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -318,6 +323,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "extraction",
"transfer_date": "2021-07-19T19:01:38-04:00",
"mean_insert": null,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -373,6 +379,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "library_preparation",
"transfer_date": null,
"mean_insert": null,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -428,6 +435,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "library_qualification",
"transfer_date": null,
"mean_insert": 303.2,
"clusters_per_sample": 116636,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -480,6 +488,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "library_qualification",
"transfer_date": null,
"mean_insert": 298.9,
"clusters_per_sample": 150570,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -535,6 +544,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "full_depth_sequencing",
"transfer_date": null,
"mean_insert": 311.2,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -590,6 +600,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "extraction",
"transfer_date": "2021-07-19T19:56:00-04:00",
"mean_insert": null,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -645,6 +656,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "library_preparation",
"transfer_date": null,
"mean_insert": null,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -700,6 +712,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "library_preparation",
"transfer_date": null,
"mean_insert": null,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -755,6 +768,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "library_qualification",
"transfer_date": null,
"mean_insert": null,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -810,6 +824,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "library_qualification",
"transfer_date": null,
"mean_insert": 325.9,
"clusters_per_sample": 41082,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -865,6 +880,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "library_qualification",
"transfer_date": null,
"mean_insert": 321.6,
"clusters_per_sample": 190218,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -920,6 +936,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "full_depth_sequencing",
"transfer_date": null,
"mean_insert": 780.5,
"clusters_per_sample": 152050691,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -975,6 +992,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "full_depth_sequencing",
"transfer_date": null,
"mean_insert": 342.1,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -1030,6 +1048,7 @@
"requisitioned": false,
"requisition_id": 512,
"qcable_type": "full_depth_sequencing",
"transfer_date": null,
"mean_insert": 342.1,
"clusters_per_sample": null,
"preliminary_clusters_per_sample": null,
Expand Down Expand Up @@ -1084,6 +1103,7 @@
"ghost": false,
"requisitioned": false,
"requisition_id": 512,
"transfer_date": null,
"qcable_type": "extraction",
"mean_insert": null,
"clusters_per_sample": null,
Expand Down
1 change: 1 addition & 0 deletions changes/add_sample_transferTime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sample transferDate field for extractions
1 change: 1 addition & 0 deletions changes/add_transferSubstep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test fields for extraction TAT breakdown of days spent on preparation, QC, and transfer

0 comments on commit 9c34ee4

Please sign in to comment.