Example #1
0
 @Override
 public void processElement(ProcessContext c) throws Exception {
   String dest = c.element();
   logger.info("Saving to " + dest);
   Iterable<GATKRead> reads = c.sideInput(iterableView);
   OutputStream outputStream = BucketUtils.createFile(dest, c.getPipelineOptions());
   try (SAMFileWriter writer =
       new SAMFileWriterFactory().makeBAMWriter(header, false, outputStream)) {
     for (GATKRead r : reads) {
       final SAMRecord sr = r.convertToSAMRecord(header);
       writer.addAlignment(sr);
     }
   }
 }
 @Override
 public <T> T sideInput(PCollectionView<T> view) {
   return context.sideInput(view);
 }