Class HeterozygosityFilter

  • All Implemented Interfaces:
    VariantContextFilter, Predicate<VariantContext>

    public class HeterozygosityFilter
    extends Object
    implements VariantContextFilter
    A Predicate on VariantContexts that either returns true at heterozygous sites (invertible to false). if optional "sample" argument to constructor is given, the genotype of that sample will be examined, otherwise first genotype will be used. Missing sample, or no genotype will result in an exception being thrown.
    • Constructor Detail

      • HeterozygosityFilter

        public HeterozygosityFilter​(boolean keepHets,
                                    String sample)
        Constructor for a filter that will keep (or remove, if keepHets is false) VC for which the genotype of sample is heterozygous. If sample is null, the first genotype in the variant context will be used.
        Parameters:
        keepHets - determine whether to keep the het sites (true) or filter them out (false)
        sample - the name of the sample in the variant context whose genotype should be examined.
      • HeterozygosityFilter

        public HeterozygosityFilter​(boolean keepHets)
        Constructor as above that doesn't take a sample, instead it will look at the first genotype of the variant context.
        Parameters:
        keepHets - if true, the heterozygous variant contexts will pass the filter, otherwise they will fail.
    • Method Detail

      • test

        public boolean test​(VariantContext variantContext)
        Specified by:
        test in interface Predicate<VariantContext>
        Parameters:
        variantContext - the record to examine for heterozygosity
        Returns:
        true if variantContext is to be kept, otherwise false Assumes that this.sample is a sample in the variantContext, if not null, otherwise looks for the first genotype (and assumes it exists).