List<PeekableIterator<SAMRecord>> iterators() { final List<PeekableIterator<SAMRecord>> iterators = new ArrayList<>(); if (outputByReadGroup) { for (final SortingCollection<SAMRecord> sorter : sorterMap.values()) { final PeekableIterator<SAMRecord> iterator = new PeekableIterator<>(sorter.iterator()); iterators.add(iterator); } } else { final PeekableIterator<SAMRecord> iterator = new PeekableIterator<>(singleSorter.iterator()); iterators.add(iterator); } return iterators; } }
List<PeekableIterator<SAMRecord>> iterators() { final List<PeekableIterator<SAMRecord>> iterators = new ArrayList<>(); if (outputByReadGroup) { for (final SortingCollection<SAMRecord> sorter : sorterMap.values()) { final PeekableIterator<SAMRecord> iterator = new PeekableIterator<>(sorter.iterator()); iterators.add(iterator); } } else { final PeekableIterator<SAMRecord> iterator = new PeekableIterator<>(singleSorter.iterator()); iterators.add(iterator); } return iterators; } }
@Test public void spillToDiskTest() { final SortingCollection<String> sortingCollection = makeSortingCollection(10); final String[] strings = new String[] { "1", "2", "3" }; for (String str : strings) { sortingCollection.add(str); } Assert.assertEquals(tmpDir().list().length, 0); sortingCollection.spillToDisk(); Assert.assertEquals(tmpDir().list().length, 1); assertIteratorEqualsList(strings, sortingCollection.iterator()); sortingCollection.cleanup(); Assert.assertEquals(tmpDir().list().length, 0); }
iterator = new SamPairUtil.SetMateInfoIterator(new PeekableIterator<SAMRecord>(sorter.iterator()) { @Override public void close() {
iterator = new SamPairUtil.SetMateInfoIterator(new PeekableIterator<SAMRecord>(sorter.iterator()) { @Override public void close() {
return new DelegatingIterator<SAMRecord>(alignmentSorter.iterator()) { @Override public void close() {
return new DelegatingIterator<SAMRecord>(alignmentSorter.iterator()) { @Override public void close() {
/** * Generate some strings, put into SortingCollection, confirm that the right number of * Strings come out, and in the right order. * @param numStringsToGenerate * @param maxRecordsInRam */ @Test(dataProvider = "test1") public void testPositive(final String testName, final int numStringsToGenerate, final int maxRecordsInRam) { final String[] strings = new String[numStringsToGenerate]; int numStringsGenerated = 0; final SortingCollection<String> sortingCollection = makeSortingCollection(maxRecordsInRam); for (final String s : new RandomStringGenerator(numStringsToGenerate)) { sortingCollection.add(s); strings[numStringsGenerated++] = s; } Arrays.sort(strings, new StringComparator()); Assert.assertEquals(tmpDirIsEmpty(), numStringsToGenerate <= maxRecordsInRam); sortingCollection.setDestructiveIteration(false); assertIteratorEqualsList(strings, sortingCollection.iterator()); assertIteratorEqualsList(strings, sortingCollection.iterator()); sortingCollection.cleanup(); Assert.assertEquals(tmpDir().list().length, 0); }
final CloseableIterator<String> iterator = sequenceNames.iterator();
final CloseableIterator<String> iterator = sequenceNames.iterator();
this.wrappedIterator = alignmentSorter.iterator(); if (log != null) log.info("Duplicate set iterator initialized.");
this.wrappedIterator = alignmentSorter.iterator(); if (log != null) log.info("Duplicate set iterator initialized.");
final PeekableIterator<PairedReadSequence> iterator = new PeekableIterator<PairedReadSequence>(sorter.iterator());
final PeekableIterator<PairedReadSequence> iterator = new PeekableIterator<PairedReadSequence>(sorter.iterator());
try (SAMFileWriter writer = writerFactory.makeSAMOrBAMWriter(header, true, tmpFile)) { writer.setProgressLogger(new ProgressLogger(log, 10000000)); try (CloseableIterator<SAMRecord> wit = collection.iterator()) { @SuppressWarnings("resource") // bad eclipse warning Iterator<SAMRecord> it = wit;
try (CloseableIterator<VariantContext> wit = collection.iterator()) { while (wit.hasNext()) { writer.add(wit.next());
int nextRepresentativeIndex = -1; if (TAG_DUPLICATE_SET_MEMBERS) { representativeReadIterator = this.representativeReadIndicesForDuplicates.iterator(); if (representativeReadIterator.hasNext()) { rri = representativeReadIterator.next();
int nextRepresentativeIndex = -1; if (TAG_DUPLICATE_SET_MEMBERS) { representativeReadIterator = this.representativeReadIndicesForDuplicates.iterator(); if (representativeReadIterator.hasNext()) { rri = representativeReadIterator.next();
final SamPairUtil.SetMateInfoIterator sorterIterator = new SamPairUtil.SetMateInfoIterator(sorter.iterator(), true); final ProgressLogger sorterProgress = new ProgressLogger(log, 1000000, " mate cigars added"); while (sorterIterator.hasNext()) {
final SamPairUtil.SetMateInfoIterator sorterIterator = new SamPairUtil.SetMateInfoIterator(sorter.iterator(), true); final ProgressLogger sorterProgress = new ProgressLogger(log, 1000000, " mate cigars added"); while (sorterIterator.hasNext()) {