Search in sources :

Example 1 with StructuralVariantFactory

use of com.hartwig.hmftools.common.variant.structural.StructuralVariantFactory in project hmftools by hartwigmedical.

the class SvVCFAnnotator method readFromVcf.

private List<VariantContext> readFromVcf(String vcfFilename) {
    List<VariantContext> variants = Lists.newArrayList();
    final StructuralVariantFactory factory = new StructuralVariantFactory(false);
    try (final AbstractFeatureReader<VariantContext, LineIterator> reader = AbstractFeatureReader.getFeatureReader(vcfFilename, new VCFCodec(), false)) {
        while (reader.iterator().hasNext()) variants.add(reader.iterator().next());
    } catch (Exception e) {
    }
    return variants;
}
Also used : VCFCodec(htsjdk.variant.vcf.VCFCodec) VariantContext(htsjdk.variant.variantcontext.VariantContext) StructuralVariantFactory(com.hartwig.hmftools.common.variant.structural.StructuralVariantFactory) LineIterator(htsjdk.tribble.readers.LineIterator) IOException(java.io.IOException)

Example 2 with StructuralVariantFactory

use of com.hartwig.hmftools.common.variant.structural.StructuralVariantFactory in project hmftools by hartwigmedical.

the class BachelorApplication method processSV.

private static Collection<EligibilityReport> processSV(final String patient, final File vcf, final BachelorEligibility eligibility) {
    LOGGER.info("processing sv: {}", vcf.getPath());
    final StructuralVariantFactory factory = new StructuralVariantFactory(true);
    try {
        try (final AbstractFeatureReader<VariantContext, LineIterator> reader = AbstractFeatureReader.getFeatureReader(vcf.getPath(), new VCFCodec(), false)) {
            reader.iterator().forEach(factory::addVariantContext);
        }
    } catch (IOException e) {
        LOGGER.error("error with SV file {}: {}", vcf.getPath(), e.getMessage());
        return Collections.emptyList();
    }
    return eligibility.processStructuralVariants(patient, factory.results());
}
Also used : VCFCodec(htsjdk.variant.vcf.VCFCodec) VariantContext(htsjdk.variant.variantcontext.VariantContext) StructuralVariantFactory(com.hartwig.hmftools.common.variant.structural.StructuralVariantFactory) IOException(java.io.IOException) LineIterator(htsjdk.tribble.readers.LineIterator)

Aggregations

StructuralVariantFactory (com.hartwig.hmftools.common.variant.structural.StructuralVariantFactory)2 LineIterator (htsjdk.tribble.readers.LineIterator)2 VariantContext (htsjdk.variant.variantcontext.VariantContext)2 VCFCodec (htsjdk.variant.vcf.VCFCodec)2 IOException (java.io.IOException)2