Search in sources :

Example 1 with TemplateTagsIterator

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);
        }
    }
}
Also used : TemplateTagsIterator(au.edu.wehi.idsv.sam.TemplateTagsIterator) NmTagIterator(au.edu.wehi.idsv.sam.NmTagIterator) SAMRecord(htsjdk.samtools.SAMRecord) AsyncBufferedIterator(au.edu.wehi.idsv.util.AsyncBufferedIterator) ProgressLogger(htsjdk.samtools.util.ProgressLogger)

Aggregations

NmTagIterator (au.edu.wehi.idsv.sam.NmTagIterator)1 TemplateTagsIterator (au.edu.wehi.idsv.sam.TemplateTagsIterator)1 AsyncBufferedIterator (au.edu.wehi.idsv.util.AsyncBufferedIterator)1 SAMRecord (htsjdk.samtools.SAMRecord)1 ProgressLogger (htsjdk.samtools.util.ProgressLogger)1