/** * Adds a samRecordWithOrdinal to the output buffer. This does not mean that it is ready to be emitted, since it may need to be * duplicate marked. * * @param samRecordWithOrdinal the index of the record of which to track. * @throws PicardException if the records are added out of order */ private void addRecordToTheOutputBuffer(final SamRecordWithOrdinal samRecordWithOrdinal) throws PicardException { final int recordReferenceIndex = samRecordWithOrdinal.getRecord().getReferenceIndex(); if (recordReferenceIndex < referenceIndex) { throw new PicardException("Records out of order: " + recordReferenceIndex + " < " + referenceIndex); } else if (referenceIndex < recordReferenceIndex) { // new reference, so we need to mark duplicates on the current ones // NB: we will not miss inter-chromosomal alignments since presumably one end will have been mapped to this chromosome and processed, and we do not need the other end to do so. tryPollingTheToMarkQueue(true, null); // update genomic coordinate to the next reference index referenceIndex = recordReferenceIndex; } // add the samRecordWithOrdinal to the output buffer so that it can be tracked outputBuffer.add(samRecordWithOrdinal); }
/** * Adds a samRecordWithOrdinal to the output buffer. This does not mean that it is ready to be emitted, since it may need to be * duplicate marked. * * @param samRecordWithOrdinal the index of the record of which to track. * @throws PicardException if the records are added out of order */ private void addRecordToTheOutputBuffer(final SamRecordWithOrdinal samRecordWithOrdinal) throws PicardException { final int recordReferenceIndex = samRecordWithOrdinal.getRecord().getReferenceIndex(); if (recordReferenceIndex < referenceIndex) { throw new PicardException("Records out of order: " + recordReferenceIndex + " < " + referenceIndex); } else if (referenceIndex < recordReferenceIndex) { // new reference, so we need to mark duplicates on the current ones // NB: we will not miss inter-chromosomal alignments since presumably one end will have been mapped to this chromosome and processed, and we do not need the other end to do so. tryPollingTheToMarkQueue(true, null); // update genomic coordinate to the next reference index referenceIndex = recordReferenceIndex; } // add the samRecordWithOrdinal to the output buffer so that it can be tracked outputBuffer.add(samRecordWithOrdinal); }