Package org.snpsift.annotate.mem
Class Fields
java.lang.Object
org.snpsift.annotate.mem.Fields
- All Implemented Interfaces:
Serializable,Iterable<org.snpeff.vcf.VcfHeaderInfo>
The Fields class represents a collection of VCF (Variant Call Format) header information fields.
These Fields are stored in VariantDatabase / VariantDataFrame objects, that are used to annotate VCF files.
It provides methods to manipulate and retrieve field values from VCF entries.
This class implements the Iterable interface to allow iteration over VcfHeaderInfo objects.
It also implements Serializable to allow instances to be serialized and deserialized.
Fields are stored in a Map with their names as keys and VcfHeaderInfo objects as values.
The class provides methods to add fields, retrieve field values, and save/load the Fields object to/from a file.
Limitations:
- The class cannot use REF/ALT fields directly because they are used to separate variant types in the database.
- INFO and FORMAT fields are not appropriate to be stuffed into an INFO field.
- The class assumes that certain VCF columns (e.g., CHROM, POS, ID, QUAL, FILTER) are implicitly present and handles them separately.
- The getFieldValue method handles different VCF info types (Flag, Integer, Float, Character, String) and converts values accordingly.
- The class does not handle all possible VCF info types and throws a RuntimeException for unimplemented types.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(org.snpeff.vcf.VcfHeaderInfo field) org.snpeff.vcf.VcfHeaderInfostatic ObjectgetFieldValue(org.snpeff.vcf.VcfHeaderInfo vcfHeaderInfo, org.snpeff.vcf.VariantVcfEntry varVcfEntry) Get a field value from a VCF entrystatic StringgetFieldValueString(String fieldName, org.snpeff.vcf.VcfEntry vcfEntry) Get a field value (string) from a VCF entryString[]getNames()Iterator<org.snpeff.vcf.VcfHeaderInfo> iterator()static FieldsvoidSave to fileCollection<org.snpeff.vcf.VcfHeaderEntry> vcfHeaders(String prefix) Get VCF headersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
VCF_COLUMN_FIELD_NAMES
-
-
Constructor Details
-
Fields
public Fields()
-
-
Method Details
-
getFieldValue
public static Object getFieldValue(org.snpeff.vcf.VcfHeaderInfo vcfHeaderInfo, org.snpeff.vcf.VariantVcfEntry varVcfEntry) Get a field value from a VCF entry -
getFieldValueString
Get a field value (string) from a VCF entry -
load
-
add
public void add(org.snpeff.vcf.VcfHeaderInfo field) -
get
-
getNames
-
iterator
-
save
Save to file -
vcfHeaders
Get VCF headers
-