Package org.snpsift.annotate

# Class AnnotateVcfDb

java.lang.Object
org.snpsift.annotate.AnnotateVcfDb

Direct Known Subclasses:
  `AnnotateVcfDbMem`, `AnnotateVcfDbSorted`, `AnnotateVcfDbTabix`

public abstract class AnnotateVcfDb extends Object
Annotate using a VCF "database"

Author:
  pcingola

## Field Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`annotateEmpty`
`protected String`
`chrPrev`
`protected DbVcf`
`dbVcf`
`protected boolean`
`debug`
`protected HashMap<String,Integer>`
`errCount`
`protected String`
`existsInfoField`
`protected boolean`
`hasVcfInfoPerAlleleRef`
`protected Set<String>`
`infoFields`
`static final int`
`MAX_ERRORS`
`protected String`
`prependInfoFieldName`
`protected boolean`
`useAllInfoFields`
`protected boolean`
`useId`
`protected boolean`
`useInfoFields`
`protected boolean`
`useRefAlt`
`protected org.snpeff.fileIterator.VcfFileIterator`
`vcfDbFile`
`protected Map<String,Boolean>`
`vcfInfoPerAllele`
`protected Map<String,Boolean>`
`vcfInfoPerAlleleRef`
`protected boolean`
`verbose`

## Constructor Summary

Constructors
Constructor
Description
`AnnotateVcfDb()`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`annotate(org.snpeff.vcf.VcfEntry vcfEntry)`
Annotate a VCF entry
`protected boolean`
`annotateExists(org.snpeff.vcf.VcfEntry vcfEntry)`
Add 'exists' flag to INFO fields
`protected boolean`
`annotateIds(org.snpeff.vcf.VcfEntry vcfEntry, Set<String> idSet)`
Add ID information.
`protected boolean`
`annotateInfo(org.snpeff.vcf.VcfEntry vcfEntry, Map<String,String> info)`
Add INFO fields.
`void`
`close()`
`protected void`
`discoverInfoFields()`
`protected void`
`discoverInfoFields(org.snpeff.vcf.VcfEntry dbVcfEntry)`
If 'ALL' info fields are being used, we can try to discover new fields that have not already been added to the annotation list (e.g.
`List<org.snpeff.vcf.VcfEntry>`
`find(org.snpeff.interval.Variant var)`
`List<org.snpeff.vcf.VcfEntry>`
`find(org.snpeff.vcf.VcfEntry vcfEntry)`
Find matching entries in the database
`protected boolean`
`findDbExists(QueryResult qr)`
Should we annotate using 'exists' field?
`protected void`
`findDbId(Set<String> idSet, QueryResult qr)`
Find an ID for this variant and add them to idSet
`protected String`
`findDbInfo(String infoFieldName, QueryResult qr)`
Find all non-empty INFO fields 'infoFieldName' in results
`protected void`
`findDbInfo(Map<String,String> info, QueryResult qr)`
Find INFO fields for this VCF entry
`protected String`
`findDbInfoAlt(String infoFieldName, QueryResult qr)`
Find the first non-empty INFO field 'infoFieldName' in results Note: ALT must match
`protected void`
`findDbInfoRef(Map<String,String> info, Set<org.snpeff.vcf.VcfEntry> uniqueVcfEntries)`
Fill values for INFO fields requiring 'REF' value
`protected boolean`
`match(org.snpeff.interval.Variant var, org.snpeff.vcf.VariantVcfEntry dbEntry)`
Does database entry 'dbVcfEntry' match 'variant'?
`void`
`open()`
`protected String`
`prependInfoName(String infoStr)`
Prepend 'prependInfoFieldName' to all info fields
`protected Collection<org.snpeff.vcf.VariantVcfEntry>`
`query(org.snpeff.interval.Variant variant)`
Query database and find results matching 'variant'
`void`
`setAnnotateEmpty(boolean annotateEmpty)`
`void`
`setDebug(boolean debug)`
`void`
`setExistsInfoField(String existsInfoField)`
`void`
`setInfoFields(boolean useInfoFields, Collection<String> infoFields)`
`void`
`setPrependInfoFieldName(String prependInfoFieldName)`
`void`
`setUseId(boolean useId)`
`void`
`setUseRefAlt(boolean useRefAlt)`
`void`
`setVerbose(boolean verbose)`
`String`
`toString()`
`protected String`
`uniqueIds(Set<String> idSetDb, String idStrVcf)`
IDs from database not present in VCF
`protected void`
`warn(String warn)`
Show a warning message (up to MAX_ERRORS times)

### Methods inherited from class java.lang.Object

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

## Field Details

### MAX_ERRORS

public static final int MAX_ERRORS

See Also:
  - Constant Field Values

### verbose

protected boolean verbose

### debug

protected boolean debug

### annotateEmpty

protected boolean annotateEmpty

### hasVcfInfoPerAlleleRef

protected boolean hasVcfInfoPerAlleleRef

### useId

protected boolean useId

### useInfoFields

protected boolean useInfoFields

### useAllInfoFields

protected boolean useAllInfoFields

### useRefAlt

protected boolean useRefAlt

### chrPrev

protected String chrPrev

### existsInfoField

protected String existsInfoField

### prependInfoFieldName

protected String prependInfoFieldName

### dbVcf

protected DbVcf dbVcf

### vcfDbFile

protected org.snpeff.fileIterator.VcfFileIterator vcfDbFile

### errCount

protected HashMap<String,Integer> errCount

### infoFields

protected Set<String> infoFields

### vcfInfoPerAllele

protected Map<String,Boolean> vcfInfoPerAllele

### vcfInfoPerAlleleRef

protected Map<String,Boolean> vcfInfoPerAlleleRef

## Constructor Details

### AnnotateVcfDb

public AnnotateVcfDb()

## Method Details

### annotate

public boolean annotate(org.snpeff.vcf.VcfEntry vcfEntry) throws IOException
Annotate a VCF entry

Throws:
  `IOException`

### annotateExists

protected boolean annotateExists(org.snpeff.vcf.VcfEntry vcfEntry)
Add 'exists' flag to INFO fields

### annotateIds

protected boolean annotateIds(org.snpeff.vcf.VcfEntry vcfEntry, Set<String> idSet)
Add ID information. Make sure we are no repeating IDs

### annotateInfo

protected boolean annotateInfo(org.snpeff.vcf.VcfEntry vcfEntry, Map<String,String> info)
Add INFO fields.

### close

public void close()

### discoverInfoFields

protected void discoverInfoFields()

### discoverInfoFields

protected void discoverInfoFields(org.snpeff.vcf.VcfEntry dbVcfEntry)
If 'ALL' info fields are being used, we can try to discover new fields that have not already been added to the annotation list (e.g. implicit fields not mentioned in the VCF header)

### find

public List<org.snpeff.vcf.VcfEntry> find(org.snpeff.interval.Variant var)

### find

public List<org.snpeff.vcf.VcfEntry> find(org.snpeff.vcf.VcfEntry vcfEntry)
Find matching entries in the database

### findDbExists

protected boolean findDbExists(QueryResult qr)
Should we annotate using 'exists' field?

### findDbId

protected void findDbId(Set<String> idSet, QueryResult qr)
Find an ID for this variant and add them to idSet

### findDbInfo

protected void findDbInfo(Map<String,String> info, QueryResult qr)
Find INFO fields for this VCF entry

### findDbInfo

protected String findDbInfo(String infoFieldName, QueryResult qr)
Find all non-empty INFO fields 'infoFieldName' in results

### findDbInfoAlt

protected String findDbInfoAlt(String infoFieldName, QueryResult qr)
Find the first non-empty INFO field 'infoFieldName' in results Note: ALT must match

### findDbInfoRef

protected void findDbInfoRef(Map<String,String> info, Set<org.snpeff.vcf.VcfEntry> uniqueVcfEntries)
Fill values for INFO fields requiring 'REF' value

### match

protected boolean match(org.snpeff.interval.Variant var, org.snpeff.vcf.VariantVcfEntry dbEntry)
Does database entry 'dbVcfEntry' match 'variant'?

### open

public void open()

### prependInfoName

protected String prependInfoName(String infoStr)
Prepend 'prependInfoFieldName' to all info fields

### query

protected Collection<org.snpeff.vcf.VariantVcfEntry> query(org.snpeff.interval.Variant variant)
Query database and find results matching 'variant'

### setAnnotateEmpty

public void setAnnotateEmpty(boolean annotateEmpty)

### setDebug

public void setDebug(boolean debug)

### setExistsInfoField

public void setExistsInfoField(String existsInfoField)

### setInfoFields

public void setInfoFields(boolean useInfoFields, Collection<String> infoFields)

### setPrependInfoFieldName

public void setPrependInfoFieldName(String prependInfoFieldName)

### setUseId

public void setUseId(boolean useId)

### setUseRefAlt

public void setUseRefAlt(boolean useRefAlt)

### setVerbose

public void setVerbose(boolean verbose)

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### uniqueIds

protected String uniqueIds(Set<String> idSetDb, String idStrVcf)
IDs from database not present in VCF

### warn

protected void warn(String warn)
Show a warning message (up to MAX_ERRORS times)