Search in sources :

Example 1 with VariantContextWindowedSortingIterator

use of au.edu.wehi.idsv.VariantContextWindowedSortingIterator in project gridss by PapenfussLab.

the class VcfTransformCommandLineProgram method getAllCalls.

public Iterator<IdsvVariantContext> getAllCalls(File file, CloseableIterator<VariantContextDirectedBreakpoint> breakpointCalls) {
    VCFFileReader vcfReader = new VCFFileReader(file, false);
    CloseableIterator<VariantContext> it = vcfReader.iterator();
    Iterator<IdsvVariantContext> idsvIt = Iterators.transform(it, variant -> IdsvVariantContext.create(getContext(), null, variant));
    Iterator<IdsvVariantContext> nonbpIt = Iterators.filter(idsvIt, variant -> !(variant instanceof VariantContextDirectedBreakpoint));
    // sort back to nominal VCF position
    Iterator<VariantContextDirectedBreakpoint> bpit = new VariantContextWindowedSortingIterator<>(getContext(), SAMEvidenceSource.maximumWindowSize(getContext(), getSamEvidenceSources(), getAssemblySource()), breakpointCalls);
    Iterator<IdsvVariantContext> mergedIt = Iterators.mergeSorted(ImmutableList.of(bpit, nonbpIt), IdsvVariantContext.ByLocationStart);
    return new AutoClosingIterator<>(mergedIt, vcfReader, it);
}
Also used : VCFFileReader(htsjdk.variant.vcf.VCFFileReader) AutoClosingIterator(au.edu.wehi.idsv.util.AutoClosingIterator) VariantContext(htsjdk.variant.variantcontext.VariantContext) IdsvVariantContext(au.edu.wehi.idsv.IdsvVariantContext) IdsvVariantContext(au.edu.wehi.idsv.IdsvVariantContext) VariantContextDirectedBreakpoint(au.edu.wehi.idsv.VariantContextDirectedBreakpoint) VariantContextWindowedSortingIterator(au.edu.wehi.idsv.VariantContextWindowedSortingIterator)

Aggregations

IdsvVariantContext (au.edu.wehi.idsv.IdsvVariantContext)1 VariantContextDirectedBreakpoint (au.edu.wehi.idsv.VariantContextDirectedBreakpoint)1 VariantContextWindowedSortingIterator (au.edu.wehi.idsv.VariantContextWindowedSortingIterator)1 AutoClosingIterator (au.edu.wehi.idsv.util.AutoClosingIterator)1 VariantContext (htsjdk.variant.variantcontext.VariantContext)1 VCFFileReader (htsjdk.variant.vcf.VCFFileReader)1