use of com.milaboratory.mixcr.export.InfoWriter in project mixcr by milaboratory.
the class ActionExportClones method go0.
@Override
public void go0() throws Exception {
CloneExportParameters parameters = (CloneExportParameters) this.parameters;
try (InputStream inputStream = IOUtil.createIS(parameters.getInputFile());
InfoWriter<Clone> writer = new InfoWriter<>(parameters.getOutputFile())) {
CloneSet set = CloneSetIO.readClns(inputStream, VDJCLibraryRegistry.getDefault());
set = CloneSet.transform(set, parameters.getFilter());
writer.attachInfoProviders((List) parameters.exporters);
writer.ensureHeader();
long limit = parameters.getLimit();
for (int i = 0; i < set.size(); i++) {
if (set.get(i).getFraction() < parameters.minFraction || set.get(i).getCount() < parameters.minCount) {
limit = i;
break;
}
}
ExportClones exportClones = new ExportClones(set, writer, limit);
SmartProgressReporter.startProgressReport(exportClones, System.err);
exportClones.run();
}
}
use of com.milaboratory.mixcr.export.InfoWriter in project mixcr by milaboratory.
the class ActionExportAlignments method go0.
@Override
public void go0() throws Exception {
try (VDJCAlignmentsReader reader = new VDJCAlignmentsReader(parameters.getInputFile(), VDJCLibraryRegistry.getDefault());
InfoWriter<VDJCAlignments> writer = new InfoWriter<>(parameters.getOutputFile())) {
SmartProgressReporter.startProgressReport("Exporting alignments", reader, System.err);
writer.attachInfoProviders((List) parameters.exporters);
writer.ensureHeader();
VDJCAlignments alignments;
long count = 0;
long limit = parameters.getLimit();
OutputPort<VDJCAlignments> alignmentsPort = new FilteringPort<>(reader, parameters.getFilter());
while ((alignments = alignmentsPort.take()) != null && count < limit) {
writer.put(alignments);
++count;
}
}
}
Aggregations