Skip to content

Commit

Permalink
[GLT-4066] added sequencing subgate TAT fields
Browse files Browse the repository at this point in the history
  • Loading branch information
djcooke committed Jun 4, 2024
1 parent c584c6a commit 4151a18
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 13 deletions.
12 changes: 12 additions & 0 deletions cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
public class Run {

private final Long clustersPf;
private final LocalDate startDate;
private final LocalDate completionDate;
private final String containerModel;
private final LocalDate dataReviewDate;
Expand Down Expand Up @@ -44,6 +45,7 @@ private Run(Builder builder) {
this.sequencingParameters = builder.sequencingParameters;
this.readLength = builder.readLength;
this.readLength2 = builder.readLength2;
this.startDate = builder.startDate;
this.completionDate = builder.completionDate;
this.percentOverQ30 = builder.percentOverQ30;
this.clustersPf = builder.clustersPf;
Expand Down Expand Up @@ -72,6 +74,10 @@ public Long getClustersPf() {
return clustersPf;
}

public LocalDate getStartDate() {
return startDate;
}

public LocalDate getCompletionDate() {
return completionDate;
}
Expand Down Expand Up @@ -145,6 +151,7 @@ public int hashCode() {
public static class Builder {

private Long clustersPf;
private LocalDate startDate;
private LocalDate completionDate;
private String containerModel;
private LocalDate dataReviewDate;
Expand All @@ -171,6 +178,11 @@ public Builder clustersPf(Long clustersPf) {
return this;
}

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

public Builder completionDate(LocalDate completionDate) {
this.completionDate = completionDate;
return this;
Expand Down
72 changes: 72 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 @@ -35,7 +35,13 @@ public class Test {
private final int extractionDaysSpent;
private final int libraryPreparationDaysSpent;
private final int libraryQualificationDaysSpent;
private final int libraryQualificationLoadingDaysSpent;
private final int libraryQualificationSequencingDaysSpent;
private final int libraryQualificationQcDaysSpent;
private final int fullDepthSequencingDaysSpent;
private final int fullDepthSequencingLoadingDaysSpent;
private final int fullDepthSequencingSequencingDaysSpent;
private final int fullDepthSequencingQcDaysSpent;

private Test(Builder builder) {
this.name = requireNonNull(builder.name);
Expand Down Expand Up @@ -70,7 +76,13 @@ private Test(Builder builder) {
this.extractionDaysSpent = builder.extractionDaysSpent;
this.libraryPreparationDaysSpent = builder.libraryPreparationDaysSpent;
this.libraryQualificationDaysSpent = builder.libraryQualificationDaysSpent;
this.libraryQualificationLoadingDaysSpent = builder.libraryQualificationLoadingDaysSpent;
this.libraryQualificationSequencingDaysSpent = builder.libraryQualificationSequencingDaysSpent;
this.libraryQualificationQcDaysSpent = builder.libraryQualificationQcDaysSpent;
this.fullDepthSequencingDaysSpent = builder.fullDepthSequencingDaysSpent;
this.fullDepthSequencingLoadingDaysSpent = builder.fullDepthSequencingLoadingDaysSpent;
this.fullDepthSequencingSequencingDaysSpent = builder.fullDepthSequencingSequencingDaysSpent;
this.fullDepthSequencingQcDaysSpent = builder.fullDepthSequencingQcDaysSpent;
}

public List<Sample> getExtractions() {
Expand Down Expand Up @@ -145,10 +157,34 @@ public int getLibraryQualificationDaysSpent() {
return libraryQualificationDaysSpent;
}

public int getLibraryQualificationLoadingDaysSpent() {
return libraryQualificationLoadingDaysSpent;
}

public int getLibraryQualificationSequencingDaysSpent() {
return libraryQualificationSequencingDaysSpent;
}

public int getLibraryQualificationQcDaysSpent() {
return libraryQualificationQcDaysSpent;
}

public int getFullDepthSequencingDaysSpent() {
return fullDepthSequencingDaysSpent;
}

public int getFullDepthSequencingLoadingDaysSpent() {
return fullDepthSequencingLoadingDaysSpent;
}

public int getFullDepthSequencingSequencingDaysSpent() {
return fullDepthSequencingSequencingDaysSpent;
}

public int getFullDepthSequencingQcDaysSpent() {
return fullDepthSequencingQcDaysSpent;
}

@JsonPOJOBuilder(withPrefix = "")
public static class Builder {

Expand All @@ -169,7 +205,13 @@ public static class Builder {
private int extractionDaysSpent;
private int libraryPreparationDaysSpent;
private int libraryQualificationDaysSpent;
private int libraryQualificationLoadingDaysSpent;
private int libraryQualificationSequencingDaysSpent;
private int libraryQualificationQcDaysSpent;
private int fullDepthSequencingDaysSpent;
private int fullDepthSequencingLoadingDaysSpent;
private int fullDepthSequencingSequencingDaysSpent;
private int fullDepthSequencingQcDaysSpent;
private LocalDate latestActivityDate;

public Test build() {
Expand Down Expand Up @@ -261,11 +303,41 @@ public Builder libraryQualificationDaysSpent(int days) {
return this;
}

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

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

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

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

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

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

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

public Builder latestActivityDate(LocalDate latestActivityDate) {
this.latestActivityDate = latestActivityDate;
return this;
Expand Down
19 changes: 19 additions & 0 deletions cardea-data/src/test/java/ca/on/oicr/gsi/cardea/JacksonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ private static void assertLaneEqual(Lane one, Lane two) {

private static void assertRunEqual(Run one, Run two) {
assertEquals(one.getClustersPf(), two.getClustersPf());
assertEquals(one.getStartDate(), two.getStartDate());
assertEquals(one.getCompletionDate(), two.getCompletionDate());
assertEquals(one.getContainerModel(), two.getContainerModel());
assertEquals(one.getDataReviewDate(), two.getDataReviewDate());
Expand Down Expand Up @@ -437,7 +438,18 @@ private static void assertTestEqual(Test one, Test two) {
assertEquals(one.getExtractionDaysSpent(), two.getExtractionDaysSpent());
assertEquals(one.getLibraryPreparationDaysSpent(), two.getLibraryPreparationDaysSpent());
assertEquals(one.getLibraryQualificationDaysSpent(), two.getLibraryQualificationDaysSpent());
assertEquals(one.getLibraryQualificationLoadingDaysSpent(),
two.getLibraryQualificationLoadingDaysSpent());
assertEquals(one.getLibraryQualificationSequencingDaysSpent(),
two.getLibraryQualificationSequencingDaysSpent());
assertEquals(one.getLibraryQualificationQcDaysSpent(),
two.getLibraryQualificationQcDaysSpent());
assertEquals(one.getFullDepthSequencingDaysSpent(), two.getFullDepthSequencingDaysSpent());
assertEquals(one.getFullDepthSequencingLoadingDaysSpent(),
two.getFullDepthSequencingLoadingDaysSpent());
assertEquals(one.getFullDepthSequencingSequencingDaysSpent(),
two.getFullDepthSequencingSequencingDaysSpent());
assertEquals(one.getFullDepthSequencingQcDaysSpent(), two.getFullDepthSequencingQcDaysSpent());
}

private static <T> void assertListsEqual(List<T> one, List<T> two, BiConsumer<T, T> assertEqual) {
Expand Down Expand Up @@ -630,6 +642,7 @@ private static Lane makeLane() {
private static Run makeRun() {
return new Run.Builder()
.clustersPf(12L)
.startDate(LocalDate.of(2024, 1, 5))
.completionDate(LocalDate.of(2024, 1, 6))
.containerModel("Flow cell")
.dataReviewDate(LocalDate.of(2024, 1, 10))
Expand Down Expand Up @@ -721,7 +734,13 @@ private static Test makeTest() {
.extractionDaysSpent(1)
.libraryPreparationDaysSpent(2)
.libraryQualificationDaysSpent(3)
.libraryQualificationLoadingDaysSpent(1)
.libraryQualificationSequencingDaysSpent(0)
.libraryQualificationQcDaysSpent(2)
.fullDepthSequencingDaysSpent(4)
.fullDepthSequencingLoadingDaysSpent(0)
.fullDepthSequencingSequencingDaysSpent(3)
.fullDepthSequencingQcDaysSpent(1)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ protected Map<Long, Run> loadRuns(FileReader fileReader) throws DataParseExcepti
.sequencingParameters(parseString(json, "sequencing_parameters"))
.readLength(parseInteger(json, "read_length", false))
.readLength2(parseInteger(json, "read_length_2", false))
.startDate(parseDate(json, "start_date"))
.completionDate(parseDate(json, "completion_date"))
.percentOverQ30(parseDecimal(json, "percent_over_q30", false))
.clustersPf(parseLong(json, "clusters_pf", false))
Expand Down Expand Up @@ -732,8 +733,20 @@ private List<Test> parseTests(JsonNode json, String fieldName, Map<String, Sampl
parseInteger(testNode, "library_preparation_days_spent", true))
.libraryQualificationDaysSpent(
parseInteger(testNode, "library_qualification_days_spent", true))
.libraryQualificationLoadingDaysSpent(
parseInteger(testNode, "library_qualification_loading_days_spent", true))
.libraryQualificationSequencingDaysSpent(
parseInteger(testNode, "library_qualification_sequencing_days_spent", true))
.libraryQualificationQcDaysSpent(
parseInteger(testNode, "library_qualification_qc_days_spent", true))
.fullDepthSequencingDaysSpent(
parseInteger(testNode, "full_depth_sequencing_days_spent", true))
.fullDepthSequencingLoadingDaysSpent(
parseInteger(testNode, "full_depth_sequencing_loading_days_spent", true))
.fullDepthSequencingSequencingDaysSpent(
parseInteger(testNode, "full_depth_sequencing_sequencing_days_spent", true))
.fullDepthSequencingQcDaysSpent(
parseInteger(testNode, "full_depth_sequencing_qc_days_spent", true))
.build());
}
return tests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import ca.on.oicr.gsi.cardea.data.CaseRelease;
import ca.on.oicr.gsi.cardea.data.DeliverableType;
import ca.on.oicr.gsi.cardea.data.Donor;
import ca.on.oicr.gsi.cardea.data.Lane;
import ca.on.oicr.gsi.cardea.data.Metric;
import ca.on.oicr.gsi.cardea.data.MetricCategory;
import ca.on.oicr.gsi.cardea.data.MetricSubcategory;
Expand Down Expand Up @@ -40,6 +41,7 @@ public class CaseLoaderTest {
private static final String testDonorId = "SAM413576";
private static final String testProjectName = "PROJ";
private static final String testSampleId = "SAM413577";
private static final long testRunId = 5476L;
private static File dataDirectory;
private CaseLoader sut;

Expand All @@ -51,13 +53,13 @@ public static void setupClass() {
dataDirectory = caseFile.getParentFile();
}

private void assertDonor(Donor donor) {
private static void assertDonor(Donor donor) {
assertNotNull(donor);
assertEquals(testDonorId, donor.getId());
assertEquals("PROJ_1289", donor.getName());
}

private void assertOmittedSample(OmittedSample sample) {
private static void assertOmittedSample(OmittedSample sample) {
assertNotNull(sample);
assertEquals("SAM123457", sample.getId());
assertEquals("NOCASE_0001_01", sample.getName());
Expand All @@ -69,7 +71,7 @@ private void assertOmittedSample(OmittedSample sample) {
assertEquals(LocalDate.of(2022, 12, 13), sample.getCreatedDate());
}

private void assertProject(Project project) {
private static void assertProject(Project project) {
assertNotNull(project);
assertEquals(testProjectName, project.getName());
assertEquals("Research", project.getPipeline());
Expand All @@ -82,14 +84,39 @@ private void assertProject(Project project) {
assertTrue(deliverables.contains("cBioPortal Submission"));
}

private void assertSample(Sample sample) {
private static void assertSample(Sample sample) {
assertNotNull(sample);
assertEquals(testSampleId, sample.getId());
assertEquals("PROJ_1289_Ly_R_nn_1-1", sample.getName());
assertEquals(Boolean.TRUE, sample.getQcPassed());
assertEquals(LocalDate.of(2021, 7, 19), sample.getQcDate());
}

private static void assertRun(Run run) {
assertNotNull(run);
assertEquals(testRunId, run.getId());
assertEquals("210810_A00469_0195_BH2YF2DMXY", run.getName());
assertEquals("S2", run.getContainerModel());
assertFalse(run.hasJoinedLanes());
assertEquals("2×151", run.getSequencingParameters());
assertEquals(151, run.getReadLength());
assertEquals(151, run.getReadLength2());
assertEquals(LocalDate.of(2021, 8, 11), run.getStartDate());
assertEquals(LocalDate.of(2021, 8, 12), run.getCompletionDate());
assertTrue(run.getQcPassed());
assertEquals("Technician One", run.getQcUser());
assertEquals(LocalDate.of(2021, 8, 12), run.getQcDate());
assertEquals(new BigDecimal("89.1"), run.getPercentOverQ30());
assertEquals(2, run.getLanes().size());
Lane lane1 = run.getLanes().get(0);
assertEquals(1, lane1.getLaneNumber());
assertEquals(90, lane1.getPercentOverQ30Read1());
assertEquals(88, lane1.getPercentOverQ30Read2());
assertEquals(2163613696L, lane1.getClustersPf());
assertEquals(new BigDecimal("0.66"), lane1.getPercentPfixRead1());
assertEquals(new BigDecimal("0.65"), lane1.getPercentPfixRead2());
}

@BeforeEach
public void setup() {
sut = new CaseLoader(dataDirectory, null);
Expand Down Expand Up @@ -135,15 +162,23 @@ public void testLoad() throws Exception {
assertEquals(1, test.getLibraryPreparations().size());
assertNotNull(test.getLibraryQualifications());
assertEquals(2, test.getLibraryQualifications().size());
System.out
.println(test.getLibraryQualifications().stream().map(s -> s.getRun().getName()).reduce("",
String::concat));
assertNotNull(test.getFullDepthSequencings());
assertEquals(1, test.getFullDepthSequencings().size());
Sample fullDepth = test.getFullDepthSequencings().get(0);
assertEquals("5476_1_LDI73620", fullDepth.getId());
assertEquals("PROJ_1289_Ly_R_PE_567_WG", fullDepth.getName());
assertEquals(Boolean.TRUE, fullDepth.getQcPassed());
assertEquals(1, test.getExtractionDaysSpent());
assertEquals(2, test.getLibraryPreparationDaysSpent());
assertEquals(6, test.getLibraryQualificationDaysSpent());
assertEquals(1, test.getLibraryQualificationLoadingDaysSpent());
assertEquals(2, test.getLibraryQualificationSequencingDaysSpent());
assertEquals(3, test.getLibraryQualificationQcDaysSpent());
assertEquals(9, test.getFullDepthSequencingDaysSpent());
assertEquals(2, test.getFullDepthSequencingLoadingDaysSpent());
assertEquals(3, test.getFullDepthSequencingSequencingDaysSpent());
assertEquals(4, test.getFullDepthSequencingQcDaysSpent());
assertRun(fullDepth.getRun());

assertNotNull(kase.getDeliverables());
assertEquals(1, kase.getDeliverables().size());
Expand Down Expand Up @@ -291,4 +326,13 @@ public void testLoadSamples() throws Exception {
}
}

@Test
public void testLoadRuns() throws Exception {
try (FileReader reader = sut.getRunReader()) {
Map<Long, Run> runsById = sut.loadRuns(reader);
assertEquals(6, runsById.size());
assertRun(runsById.get(testRunId));
}
}

}
Loading

0 comments on commit 4151a18

Please sign in to comment.