# Class VariantTypeCounters

java.lang.Object
org.snpsift.annotate.mem.variantTypeCounter.VariantTypeCounters

public class VariantTypeCounters extends Object
The VariantTypeCounters class is responsible for counting the number of variants in VCF (Variant Call Format) files. It maintains counters for each chromosome and a counter for all variants combined. The class provides methods to load and save the counters from/to a file, count variants from a VCF file or iterator, and retrieve counters for specific chromosomes. Usage: - Create an instance of VariantTypeCounters with or without specifying Fields and verbosity. - Use the count method to count variants from a VCF file. - Save the counters to a file using the save method. - Load the counters from a file using the static load method. - Retrieve counters for specific chromosomes using the get method. Limitations: - The class assumes that the VCF file is properly formatted and accessible. - The class does not handle multi-threaded access; concurrent modifications may lead to inconsistent state. - The class relies on external classes such as Fields, VariantTypeCounter, VcfFileIterator, VcfEntry, and Log, which are not defined within this class. - The progress display during counting is managed by the ShowProgress class, which is also not defined within this class.

## Constructor Summary

Constructors
Constructor
Description
`VariantTypeCounters(boolean verbose)`
`VariantTypeCounters(Fields fields, boolean verbose)`

## Method Summary

Modifier and Type
Method
Description
`void`
`count(String vcfFileName)`
Count the number of variants in a VCF file
`void`
`count(org.snpeff.fileIterator.VcfFileIterator vcfFile)`
`void`
`count(org.snpeff.vcf.VcfEntry vcfEntry)`
Count the number of variants in a VCF file
`VariantTypeCounter`
`get(String chr)`
`Fields`
`getFields()`
`static VariantTypeCounters`
`load(String fileName)`
Load from file
`void`
`save(String fileName)`
`void`
`setVerbose(boolean verbose)`
`String`
`toString()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### VariantTypeCounters

public VariantTypeCounters(boolean verbose)

### VariantTypeCounters

public VariantTypeCounters(Fields fields, boolean verbose)

## Method Details

### load

public static VariantTypeCounters load(String fileName)
Load from file

### count

public void count(String vcfFileName)
Count the number of variants in a VCF file

### count

public void count(org.snpeff.fileIterator.VcfFileIterator vcfFile)

### count

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

### get

public VariantTypeCounter get(String chr)

### getFields

public Fields getFields()

### save

public void save(String fileName)

### setVerbose

public void setVerbose(boolean verbose)

### toString

public String toString()

Overrides:
  `toString` in class `Object`