Lims { @NotNull public String purityShallowSeq(@NotNull String sampleBarcode) { LimsJsonSampleData sampleData = dataPerSampleBarcode.get(sampleBarcode); if (sampleData != null) { boolean purityShallowExecuted = shallowSeqExecuted(sampleBarcode); LimsShallowSeqData shallowSeq = shallowSeqPerSampleBarcode.get(sampleBarcode); if (purityShallowExecuted && shallowSeq == null) { LOGGER.warn("BFX lims and lab status on shallow seq do not match for sample '{}'!", sampleBarcode); } else { if (purityShallowExecuted) { if (!shallowSeq.hasReliablePurity()) { return PURITY_NOT_RELIABLE_STRING; } else { try { return Math.round(Double.parseDouble(shallowSeq.purityShallowSeq()) * 100) + "%"; } catch (NumberFormatException e) { LOGGER.warn("Could not convert shallow seq to a percentage '{}'", shallowSeq.purityShallowSeq()); return NOT_AVAILABLE_STRING; } } } else { return NOT_PERFORMED_STRING; } } } return NOT_PERFORMED_STRING; } Lims(@NotNull final Map<String, LimsJsonSampleData> dataPerSampleBarcode,
            @NotNull final Map<String, LimsJsonSubmissionData> dataPerSubmission,
            @NotNull final Map<String, LimsShallowSeqData> shallowSeqPerSampleBarcode,
            @NotNull final Map<String, LocalDate> preLimsArrivalDatesPerSampleId, @NotNull final Set<String> samplesIdsWithoutSamplingDate,
            @NotNull final Set<String> blacklistedPatients, @NotNull final HospitalModel hospitalModel); int sampleBarcodeCount(); @NotNull Set<String> sampleBarcodes(); void validateSampleBarcodeCombination(@NotNull String refBarcode, @NotNull String refSampleId, @NotNull String tumorBarcode,
            @NotNull String tumorSampleId); @NotNull String patientId(@NotNull String sampleBarcode); @NotNull String sampleId(@NotNull String sampleBarcode); @Nullable LocalDate arrivalDate(@NotNull String sampleBarcode, @NotNull String fallbackSampleId); @Nullable LocalDate samplingDate(@NotNull String sampleBarcode); boolean confirmedToHaveNoSamplingDate(@NotNull String sampleId); boolean isBlacklisted(@NotNull String patientId); @NotNull String submissionId(@NotNull String sampleBarcode); @NotNull String projectName(@NotNull String sampleBarcode); @NotNull String requesterName(@NotNull String sampleBarcode); @NotNull String requesterEmail(@NotNull String sampleBarcode); @Nullable Integer dnaNanograms(@NotNull String sampleBarcode); @NotNull String purityShallowSeq(@NotNull String sampleBarcode); @NotNull String pathologyTumorPercentage(@NotNull String sampleBarcode); @NotNull String primaryTumor(@NotNull String sampleBarcode); @NotNull String labProcedures(@NotNull String sampleBarcode); @NotNull String cohort(@NotNull String sampleBarcode); @NotNull HospitalContactData hospitalContactData(@NotNull String sampleBarcode); @NotNull String hospitalPatientId(@NotNull String sampleBarcode); @NotNull String hospitalPathologySampleId(@NotNull String sampleBarcode); @NotNull LimsGermlineReportingLevel germlineReportingChoice(@NotNull String sampleBarcode); boolean reportGermlineVariants(@NotNull String sampleBarcode); boolean reportViralInsertions(@NotNull String sampleBarcode); static final String NOT_AVAILABLE_STRING; static final String NOT_PERFORMED_STRING; static final String PURITY_NOT_RELIABLE_STRING; }
@Test public void missingOrMalformedShallowSeqDataForSampleYieldsNA() { LimsJsonSampleData sampleData1 = createLimsSampleDataBuilder().tumorBarcode(TUMOR_SAMPLE_BARCODE).shallowSeq(true).build(); Lims lims1 = buildTestLimsWithSample(sampleData1); assertEquals(Lims.NOT_PERFORMED_STRING, lims1.purityShallowSeq(TUMOR_SAMPLE_BARCODE)); LimsJsonSampleData sampleData2 = createLimsSampleDataBuilder().tumorBarcode(TUMOR_SAMPLE_BARCODE).shallowSeq(true).build(); Lims lims2 = buildTestLimsWithSampleAndShallowSeq(sampleData2, "NotANumber", true, true); assertEquals(Lims.NOT_AVAILABLE_STRING, lims2.purityShallowSeq(TUMOR_SAMPLE_BARCODE)); }
@Test public void canRetrieveShallowSeqPurityForSample() { LimsJsonSampleData sampleData = createLimsSampleDataBuilder().tumorBarcode(TUMOR_SAMPLE_BARCODE).shallowSeq(true).build(); Lims lims = buildTestLimsWithSampleAndShallowSeq(sampleData, "0.2", false, true); assertEquals("20%", lims.purityShallowSeq(TUMOR_SAMPLE_BARCODE)); }
@Test public void canRetrieveShallowSeqBelowDetectionLimitForSample() { LimsJsonSampleData sampleData = createLimsSampleDataBuilder().tumorBarcode(TUMOR_SAMPLE_BARCODE).shallowSeq(true).build(); Lims lims = buildTestLimsWithSampleAndShallowSeq(sampleData, "0.10", true, false); assertEquals(Lims.PURITY_NOT_RELIABLE_STRING, lims.purityShallowSeq(TUMOR_SAMPLE_BARCODE)); }