use of au.edu.wehi.idsv.sam.TemplateTagsIterator in project gridss by PapenfussLab.
the class ComputeSamTags method compute.
public static void compute(Iterator<SAMRecord> rawit, SAMFileWriter writer, ReferenceLookup reference, Set<String> tags, boolean softenHardClips, boolean fixMates, boolean recalculateSupplementary, String threadprefix) throws IOException {
ProgressLogger progress = new ProgressLogger(log);
try (CloseableIterator<SAMRecord> aysncit = new AsyncBufferedIterator<SAMRecord>(rawit, threadprefix + "raw")) {
Iterator<SAMRecord> it = aysncit;
if (tags.contains(SAMTag.NM.name()) || tags.contains(SAMTag.SA.name())) {
it = new AsyncBufferedIterator<SAMRecord>(it, threadprefix + "nm");
it = new NmTagIterator(it, reference);
}
if (!Sets.intersection(tags, SAMRecordUtil.TEMPLATE_TAGS).isEmpty() || softenHardClips) {
it = new TemplateTagsIterator(it, softenHardClips, fixMates, recalculateSupplementary, tags);
it = new AsyncBufferedIterator<SAMRecord>(it, threadprefix + "tags");
}
while (it.hasNext()) {
SAMRecord r = it.next();
writer.addAlignment(r);
progress.record(r);
}
}
}
Aggregations