Search in sources :

Example 1 with CountingOutputPort

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);
        }
    }
}
Also used : VDJCAlignmentsReader(com.milaboratory.mixcr.basictypes.VDJCAlignmentsReader) CountingOutputPort(cc.redberry.pipe.util.CountingOutputPort) VDJCAlignmentsWriter(com.milaboratory.mixcr.basictypes.VDJCAlignmentsWriter) VDJCAlignments(com.milaboratory.mixcr.basictypes.VDJCAlignments)

Aggregations

CountingOutputPort (cc.redberry.pipe.util.CountingOutputPort)1 VDJCAlignments (com.milaboratory.mixcr.basictypes.VDJCAlignments)1 VDJCAlignmentsReader (com.milaboratory.mixcr.basictypes.VDJCAlignmentsReader)1 VDJCAlignmentsWriter (com.milaboratory.mixcr.basictypes.VDJCAlignmentsWriter)1