Class VariantTypeCounter

java.lang.Object
org.snpsift.annotate.mem.variantTypeCounter.VariantTypeCounter
All Implemented Interfaces:
Serializable

public class VariantTypeCounter extends Object implements Serializable
VariantTypeCounter is a class that counts the number of variants in a VCF (Variant Call Format) file. It also keeps track of the total size (in bytes) of specific fields for each variant category. The class works by iterating through VCF entries and counting the number of variants and their sizes. It categorizes variants and maintains counts and sizes for each category. Non-obvious limitations: - The class only tracks the size of fields that are of type String. - The size of the fields is calculated in bytes using UTF-8 encoding. - The class assumes that the VCF file contents are provided as a string for testing purposes. - The class does not handle non-string fields for size calculations. - The class does not handle multi-threaded access and is not thread-safe.
See Also:
  • Field Details

    • REF

      public static final String REF
      See Also:
    • ALT

      public static final String ALT
      See Also:
    • fields

      protected Fields fields
    • fieldsString

      protected String[] fieldsString
    • countByCategory

      protected int[] countByCategory
    • countVcfEntries

      protected long countVcfEntries
    • countVariants

      protected long countVariants
    • sizesByField

      protected Map<String,int[]> sizesByField
  • Constructor Details

    • VariantTypeCounter

      public VariantTypeCounter(Fields fields)
  • Method Details

    • countVariants

      public static VariantTypeCounter countVariants(String vcfLines)
      Count variants in a string of VCF lines (i.e. a VCF file contents in a string) This is used for testing
    • count

      public void count(org.snpeff.vcf.VcfEntry vcfEntry)
      Count the number of variants in a VCF file
    • getCount

      public int getCount(VariantCategory variantCategory)
    • getCountByCategory

      public int[] getCountByCategory()
    • getFields

      public Fields getFields()
    • getSize

      public int getSize(VariantCategory variantCategory, String field)
      Get total size (in bytes) of a field (only string fields)
      Returns:
      Total size (in bytes) or -1 if the field is not found
    • getSizesByField

      public Map<String,int[]> getSizesByField()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • updateSizes

      protected void updateSizes(VariantCategory variantCategory, String field, String value)
      Update sizes for a field