use of com.github.lindenb.jvarkit.setfile.SetFileRecord in project jvarkit by lindenb.
the class SetFileTools method combine.
private int combine(final List<String> args) throws IOException {
try (CloseableIterator<SetFileRecord> iter = openSetFileIterator(args)) {
final List<SetFileRecord> L2 = iter.stream().collect(Collectors.toList());
try (PrintWriter pw = super.openPathOrStdoutAsPrintWriter(this.outputFile)) {
for (int i = 0; i + 1 < L2.size(); i++) {
final SetFileRecord r1 = L2.get(i);
for (int j = i + 1; j < L2.size(); j++) {
final SetFileRecord r2 = L2.get(j);
final List<Locatable> L = new ArrayList<>(r1.size() + r2.size());
L.addAll(r1);
L.addAll(r2);
final String name = String.join("_", r1.getName(), r2.getName());
print(pw, SetFileRecord.create(name, sortAndMerge(L)));
}
}
pw.flush();
}
}
return 0;
}
use of com.github.lindenb.jvarkit.setfile.SetFileRecord in project jvarkit by lindenb.
the class SetFileTools method view.
private int view(final List<String> args) throws IOException {
try (CloseableIterator<SetFileRecord> iter = openSetFileIterator(args)) {
try (PrintWriter pw = super.openPathOrStdoutAsPrintWriter(this.outputFile)) {
while (iter.hasNext()) {
final SetFileRecord rec = iter.next();
print(pw, rec);
}
pw.flush();
}
}
return 0;
}
Aggregations