public int getMaximumNumber() { int max = 0; for (Index index : indices) { if (index.getPosition() > max) { max = index.getPosition(); } } return max; }
public static void sort(final List<Index> indices) { Collections.sort(indices, (o1, o2) -> o1.getPosition() - o2.getPosition()); }
public Iterable<Index> getIndicesForPosition(int position) { List<Index> selected = new ArrayList<>(); for (Index index : indices) { if (index.getPosition() == position) { selected.add(index); } } return selected; }
private static String getCombinedIndexSequences(PoolableElementView view) { return view.getIndices().stream() .sorted((i1, i2) -> Integer.compare(i1.getPosition(), i2.getPosition())) .map(Index::getSequence) .collect(Collectors.joining()); }
@Override protected void makeColumns(Run run, Partition partition, PoolableElementView dilution, String userName, String[] output) { output[0] = dilution.getLibraryName(); output[1] = dilution.getLibraryAlias(); final Optional<Index> firstIndex = dilution.getIndices().stream().filter(i -> i.getPosition() == 1).findFirst(); output[2] = firstIndex.map(Index::getName).orElse(""); output[3] = firstIndex.map(Index::getSequence).orElse(""); final Optional<Index> secondIndex = dilution.getIndices().stream().filter(i -> i.getPosition() == 2).findFirst(); output[4] = secondIndex.map(Index::getName).orElse(""); output[5] = secondIndex.map(Index::getSequence) .map(run.getSequencer().getInstrumentModel().getDataManglingPolicy() == InstrumentDataManglingPolicy.I5_RC ? SampleSheet::reverseComplement : Function.identity()) .orElse(""); }
@Override protected void makeColumns(Run run, Partition p, PoolableElementView dilution, String userName, String[] output) { output[0] = p.getSequencerPartitionContainer().getIdentificationBarcode(); output[1] = p.getPartitionNumber().toString(); output[2] = String.format("%d_%s_%s", p.getSequencerPartitionContainer().getId(), dilution.getLibraryName(), dilution.getDilutionName()); output[3] = dilution.getSampleAlias().replaceAll("\\s", ""); output[4] = dilution.getIndices().stream()// .sorted(Comparator.comparingInt(Index::getPosition))// .map(i -> { if (run.getSequencer().getInstrumentModel().getDataManglingPolicy() == InstrumentDataManglingPolicy.I5_RC && i.getPosition() == 2) { return reverseComplement(i.getSequence()); } return i.getSequence(); })// .collect(Collectors.joining("-")); output[5] = dilution.getLibraryDescription(); output[6] = "N"; output[7] = "NA"; output[8] = userName; }
public static IndexDto asDto(@Nonnull Index from, boolean includeFamily) { IndexDto dto = new IndexDto(); dto.setId(from.getId()); dto.setLabel(from.getLabel()); dto.setName(from.getName()); dto.setPosition(from.getPosition()); dto.setSequence(from.getSequence()); if (includeFamily) { dto.setFamily(asDto(from.getFamily(), false)); } return dto; }
dto.setIndexFamilyName(from.getIndices().get(0).getFamily().getName()); for (Index index : from.getIndices()) { switch (index.getPosition()) { case 1: dto.setIndex1Id(index.getId()); break; default: throw new IllegalArgumentException("Index at position " + index.getPosition());