LimsFactory { @NotNull @VisibleForTesting static Map<String, LimsShallowSeqData> readLimsShallowSeqTsv(@NotNull String shallowSeqTsv) throws IOException { Map<String, LimsShallowSeqData> shallowSeqPerSampleBarcode = Maps.newHashMap(); List<String> lines = Files.lines(Paths.get(shallowSeqTsv)).collect(Collectors.toList()); for (String line : lines.subList(1, lines.size())) { String[] parts = line.split(FIELD_SEPARATOR, 5); if (parts.length == 5) { shallowSeqPerSampleBarcode.put(parts[0], ImmutableLimsShallowSeqData.of(parts[0], parts[1], parts[2], Boolean.parseBoolean(parts[3]), Boolean.parseBoolean(parts[4]))); } else if (parts.length > 0) { LOGGER.warn("Could not properly parse line in shallow seq csv: {}", line); } } return shallowSeqPerSampleBarcode; } private  LimsFactory(); @NotNull static Lims fromLimsDirectory(@NotNull String limsDirectory); @NotNull static Lims empty();  }
@Test public void readCorrectlyFromShallowSeqPurityFile() throws IOException { Map<String, LimsShallowSeqData> shallowSeqPuritySample = LimsFactory.readLimsShallowSeqTsv(LIMS_DIRECTORY + File.separator + "shallow_seq_purity.tsv"); assertEquals(3, shallowSeqPuritySample.size()); String barcode = "FR1"; LimsShallowSeqData limsShallowSeqData = shallowSeqPuritySample.get(barcode); assertEquals(barcode, limsShallowSeqData.sampleBarcode()); assertEquals("SAMP01011234T", limsShallowSeqData.sampleId()); assertEquals("0.19", limsShallowSeqData.purityShallowSeq()); assertTrue(limsShallowSeqData.hasReliablePurity()); assertTrue(limsShallowSeqData.hasReliableQuality()); }