Class VariantTypeCounter
java.lang.Object
org.snpsift.annotate.mem.variantTypeCounter.VariantTypeCounter
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcount(org.snpeff.vcf.VcfEntry vcfEntry) Count the number of variants in a VCF filestatic VariantTypeCountercountVariants(String vcfLines) Count variants in a string of VCF lines (i.e.intgetCount(VariantCategory variantCategory) int[]intgetSize(VariantCategory variantCategory, String field) Get total size (in bytes) of a field (only string fields)toString()protected voidupdateSizes(VariantCategory variantCategory, String field, String value) Update sizes for a field
-
Field Details
-
REF
- See Also:
-
ALT
- See Also:
-
fields
-
fieldsString
-
countByCategory
protected int[] countByCategory -
countVcfEntries
protected long countVcfEntries -
countVariants
protected long countVariants -
sizesByField
-
-
Constructor Details
-
VariantTypeCounter
-
-
Method Details
-
countVariants
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
-
getCountByCategory
public int[] getCountByCategory() -
getFields
-
getSize
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
-
toString
-
updateSizes
Update sizes for a field
-