Exemple #1
0
 /**
  * Record any index information for a given BAM record. If this alignment starts a new reference,
  * write out the old reference. Requires a non-null value for rec.getFileSource().
  *
  * @param rec The BAM record
  */
 public void processAlignment(final SAMRecord rec) {
   try {
     final int reference = rec.getReferenceIndex();
     if (reference != SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && reference != currentReference) {
       // process any completed references
       advanceToReference(reference);
     }
     indexBuilder.processAlignment(rec);
   } catch (final Exception e) {
     throw new SAMException("Exception creating BAM index for record " + rec, e);
   }
 }
Exemple #2
0
 /**
  * After all the alignment records have been processed, finish is called. Writes any final
  * information and closes the output file.
  */
 public void finish() {
   // process any remaining references
   advanceToReference(numReferences);
   outputWriter.writeNoCoordinateRecordCount(indexBuilder.getNoCoordinateRecordCount());
   outputWriter.close();
 }