use of cc.redberry.pipe.util.CountingOutputPort in project mixcr by milaboratory.
the class ActionSortAlignments method go.
@Override
public void go(ActionHelper helper) throws Exception {
try (VDJCAlignmentsReader reader = new VDJCAlignmentsReader(parameters.getInputFile())) {
SmartProgressReporter.startProgressReport("Reading vdjca", reader);
try (OutputPortCloseable<VDJCAlignments> sorted = Sorter.sort(reader, idComparator, 1024 * 512, new VDJCAlignmentsSerializer(reader), TempFileManager.getTempFile());
VDJCAlignmentsWriter writer = new VDJCAlignmentsWriter(parameters.getOutputFile())) {
writer.header(reader.getParameters(), reader.getUsedGenes());
final long nReads = reader.getNumberOfReads();
final CountingOutputPort<VDJCAlignments> counter = new CountingOutputPort<>(sorted);
SmartProgressReporter.startProgressReport("Writing sorted alignments", SmartProgressReporter.extractProgress(counter, nReads));
for (VDJCAlignments res : CUtils.it(counter)) writer.write(res);
writer.setNumberOfProcessedReads(nReads);
}
}
}
Aggregations