use of com.github.lindenb.jvarkit.variant.vcf.BufferedVCFReader in project jvarkit by lindenb.
the class VcfGnomadExomeVsGenome method isVariantIn.
boolean isVariantIn(final VariantContext ctx, final BufferedVCFReader reader) {
final String ctg = this.ctgNameConverter.apply(ctx.getContig());
if (StringUtils.isBlank(ctg))
return false;
try (CloseableIterator<VariantContext> iterE = reader.query(new SimpleInterval(ctg, ctx.getStart(), ctx.getEnd()))) {
while (iterE.hasNext()) {
final VariantContext ctx2 = iterE.next();
if (ctx.getStart() != ctx2.getStart())
continue;
if (!ctx.getReference().equals(ctx2.getReference()))
continue;
final Set<Allele> alt2 = ctx2.getAlternateAlleles().stream().filter(A -> AcidNucleics.isATGC(A)).collect(Collectors.toSet());
if (ctx.getAlternateAlleles().stream().anyMatch(A -> alt2.contains(A)))
return true;
}
}
return false;
}
use of com.github.lindenb.jvarkit.variant.vcf.BufferedVCFReader in project jvarkit by lindenb.
the class BamToHaplotypes method beforeSam.
@Override
protected int beforeSam() {
this.vcfReader = VCFReaderFactory.makeDefault().open(this.vcfFile, true);
this.bufferedVCFReader = new BufferedVCFReader(this.vcfReader, this.buffSizeInBp);
this.bufferedVCFReader.setSimplifier(V -> simplify(V));
return 0;
}
Aggregations