Package vcf

Class MarkerUtils

java.lang.Object
vcf.MarkerUtils

public final class MarkerUtils extends Object

Class MarkerUtils contains static helper methods for the Marker class.

  • Method Details

    • nGenotypes

      public static int nGenotypes(int nAlleles)
      Returns the number of distinct genotypes, which equals nAlleles*(1 + nAlleles())/2.
      Parameters:
      nAlleles - the number of distinct alleles
      Returns:
      the number of distinct genotypes
    • coordinate

      public static String coordinate(Marker marker)
      Returns (marker.chrom() + ':' + marker.pos()).
      Parameters:
      marker - a marker
      Returns:
      (marker.chrom() + ':' + marker.pos())
      Throws:
      NullPointerException - if marker == null
    • coordinateAndAlleles

      public static String coordinateAndAlleles(Marker marker)
      Returns (marker.chrom() + ':' + marker.pos() + ':' + marker.alleles().replace(Const.tab, Const.colon)).
      Parameters:
      marker - a marker
      Returns:
      {(marker.chrom() + ':' + marker.pos() + ':' + marker.alleles().replace(Const.tab, Const.colon))
      Throws:
      NullPointerException - if marker == null
    • ids

      public static String[] ids(Marker marker)
      Returns the list of identifiers in the VCF ID field. An array of length 0 is returned if (marker.hasIdData() == false).
      Parameters:
      marker - a marker
      Returns:
      the list of identifiers in the VCF ID field
      Throws:
      NullPointerException - if marker == null
    • alleles

      public static String[] alleles(Marker marker)
      Returns the list of marker alleles in the VCF REF and ALT fields in order of their appearance in the VCF record.
      Parameters:
      marker - a marker
      Returns:
      the list of marker alleles
      Throws:
      NullPointerException - if marker == null
    • printFirst7Fields

      public static void printFirst7Fields(Marker marker, PrintWriter out)
      Prints the first seven tab-delimited VCF fields for the specified marker to the specified PrintWriter. The delimiter preceding the 8-th VCF field (the INFO field) is not appended.
      Parameters:
      marker - a marker
      out - the PrintWriter that will receive output
      Throws:
      NullPointerException - if (marker == null) || (out == null)
    • appendFirst7Fields

      public static void appendFirst7Fields(Marker marker, StringBuilder sb)
      Appends the first seven tab-delimited VCF fields for the specified marker to the specified StringBuilder. The delimiter preceding the 8-th field (the INFO field) is not appended.
      Parameters:
      marker - a marker
      sb - the StringBuilder that will be appended
      Throws:
      NullPointerException - if (marker == null) || (sb == null)