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);
}
Aggregations