Class VariantContextGetters

java.lang.Object
org.broadinstitute.hellbender.utils.variant.VariantContextGetters

public class VariantContextGetters extends Object
  • Constructor Details

    • VariantContextGetters

      public VariantContextGetters()
  • Method Details

    • getAttributeAsInt

      public static int getAttributeAsInt(htsjdk.variant.variantcontext.Genotype genotype, String key, int defaultValue)
      Returns an attribute as an integer.
      Parameters:
      genotype - the source genotype.
      key - the attribute key.
      defaultValue - default value to return in case the attribute does not have a value defined.
      Returns:
      the string version of the attribute value.
      Throws:
      IllegalArgumentException - if genotype or key is null.
      NumberFormatException - if the annotation exists, and its string transformation cannot be convert into an integer.
    • getAttributeAsIntArray

      public static int[] getAttributeAsIntArray(htsjdk.variant.variantcontext.VariantContext variantContext, String key, Supplier<int[]> defaultValue, int missingValue)
      Composes the int array from an INFO annotation.
      Parameters:
      variantContext - the target variant-context.
      key - the name of the attribute containing the double array.
      defaultValue - the double array to return in case there is no such an annotation.
      missingValue - value to use to fill up positions with a missing value (e.g. '.').
      Returns:
      never null.
      Throws:
      IllegalArgumentException - if variantContext is null or key is null.
    • getAttributeAsIntArray

      public static int[] getAttributeAsIntArray(htsjdk.variant.variantcontext.Genotype genotype, String key, Supplier<int[]> defaultValue, int missingValue)
      Composes the double array from a genotype annotation.
      Parameters:
      genotype - the target variant-context.
      key - the name of the attribute containing the double array.
      defaultValue - the double array to return in case there is no such an annotation.
      missingValue - value to use to fill up positions with a missing value (e.g. '.').
      Returns:
      never null.
      Throws:
      IllegalArgumentException - if variantContext is null or key is null.
    • getAttributeAsDouble

      public static double getAttributeAsDouble(htsjdk.variant.variantcontext.Genotype genotype, String key, double defaultValue)
      Returns an attribute as a double.
      Parameters:
      genotype - the source genotype.
      key - the attribute key.
      defaultValue - default value to return in case the attribute does not have a value defined.
      Returns:
      the string version of the attribute value.
      Throws:
      IllegalArgumentException - if genotype or key is null.
      NumberFormatException - if the annotation exists, and its string transformation cannot be convert into a double.
    • getAttributeAsDoubleArray

      public static double[] getAttributeAsDoubleArray(htsjdk.variant.variantcontext.VariantContext variantContext, String key, Supplier<double[]> defaultValue, double missingValue)
      Composes the double array from a genotype annotation.
      Parameters:
      variantContext - the target variant-context.
      key - the name of the attribute containing the double array.
      defaultValue - the double array to return in case there is no such an annotation.
      missingValue - value to use to fill up positions with a missing value (e.g. '.').
      Returns:
      never null.
      Throws:
      IllegalArgumentException - if variantContext is null or key is null.
    • getAttributeAsDoubleArray

      public static double[] getAttributeAsDoubleArray(htsjdk.variant.variantcontext.VariantContext variantContext, String attribute)
      Composes the double array from a genotype annotation. Provides default and missing values.
      Parameters:
      variantContext - the target variant-context.
      attribute - the name of the attribute containing the double array.
      Returns:
      never null.
      Throws:
      IllegalArgumentException - if variantContext is null or key is null.
    • getAttributeAsDoubleArray

      public static double[] getAttributeAsDoubleArray(htsjdk.variant.variantcontext.Genotype genotype, String key, Supplier<double[]> defaultValue, double missingValue)
      Composes the double array from a genotype annotation.
      Parameters:
      genotype - the target variant-context.
      key - the name of the attribute containing the double array.
      defaultValue - the double array to return in case there is no such an annotation.
      missingValue - value to use to fill up positions with a missing value (e.g. '.').
      Returns:
      never null.
      Throws:
      IllegalArgumentException - if variantContext is null or key is null.
    • getAttributeAsLong

      public static Long getAttributeAsLong(htsjdk.variant.variantcontext.VariantContext variantContext, String attribute, Long defaultValue)
      Get Long attribute from a variant context.
      Parameters:
      variantContext - the target variant-context.
      attribute - the name of the attribute containing the Long value.
      Returns:
      never null.
      Throws:
      IllegalArgumentException - if variantContext is null or key is null.
    • getAttributeAsLongList

      public static List<Long> getAttributeAsLongList(htsjdk.variant.variantcontext.VariantContext variantContext, String attribute, Long defaultValue)
      Composes the Long List from a variant context.
      Parameters:
      variantContext - the target variant-context.
      attribute - the name of the attribute containing the Long list.
      Returns:
      never null.
      Throws:
      IllegalArgumentException - if variantContext is null or key is null.
    • getAttributeAsString

      public static String getAttributeAsString(htsjdk.variant.variantcontext.Genotype genotype, String key, String defaultValue)
      Returns an attribute as a string.
      Parameters:
      genotype - the source genotype.
      key - the attribute key.
      defaultValue - default value to return in case the attribute does not have a value defined.
      Returns:
      the string version of the attribute value.
      Throws:
      IllegalArgumentException - if genotype or key is null.
    • attributeToList

      public static List<Object> attributeToList(Object attribute)