Package org.snpsift.annotate
Class AnnotateVcfDb
- java.lang.Object
-
- org.snpsift.annotate.AnnotateVcfDb
-
- Direct Known Subclasses:
AnnotateVcfDbMem,AnnotateVcfDbSorted,AnnotateVcfDbTabix
public abstract class AnnotateVcfDb extends java.lang.ObjectAnnotate using a VCF "database"- Author:
- pcingola
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanannotateEmptyprotected java.lang.StringchrPrevprotected DbVcfdbVcfprotected booleandebugprotected java.util.HashMap<java.lang.String,java.lang.Integer>errCountprotected java.lang.StringexistsInfoFieldprotected booleanhasVcfInfoPerAlleleRefprotected java.util.Set<java.lang.String>infoFieldsstatic intMAX_ERRORSprotected java.lang.StringprependInfoFieldNameprotected booleanuseAllInfoFieldsprotected booleanuseIdprotected booleanuseInfoFieldsprotected booleanuseRefAltprotected org.snpeff.fileIterator.VcfFileIteratorvcfDbFileprotected java.util.Map<java.lang.String,java.lang.Boolean>vcfInfoPerAlleleprotected java.util.Map<java.lang.String,java.lang.Boolean>vcfInfoPerAlleleRefprotected booleanverbose
-
Constructor Summary
Constructors Constructor Description AnnotateVcfDb()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanannotate(org.snpeff.vcf.VcfEntry vcfEntry)Annotate a VCF entryprotected booleanannotateExists(org.snpeff.vcf.VcfEntry vcfEntry)Add 'exists' flag to INFO fieldsprotected booleanannotateIds(org.snpeff.vcf.VcfEntry vcfEntry, java.util.Set<java.lang.String> idSet)Add ID information.protected booleanannotateInfo(org.snpeff.vcf.VcfEntry vcfEntry, java.util.Map<java.lang.String,java.lang.String> info)Add INFO fields.voidclose()protected voiddiscoverInfoFields()protected voiddiscoverInfoFields(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.java.util.List<org.snpeff.vcf.VcfEntry>find(org.snpeff.interval.Variant var)java.util.List<org.snpeff.vcf.VcfEntry>find(org.snpeff.vcf.VcfEntry vcfEntry)Find matching entries in the databaseprotected booleanfindDbExists(QueryResult qr)Should we annotate using 'exists' field?protected voidfindDbId(java.util.Set<java.lang.String> idSet, QueryResult qr)Find an ID for this variant and add them to idSetprotected java.lang.StringfindDbInfo(java.lang.String infoFieldName, QueryResult qr)Find all non-empty INFO fields 'infoFieldName' in resultsprotected voidfindDbInfo(java.util.Map<java.lang.String,java.lang.String> info, QueryResult qr)Find INFO fields for this VCF entryprotected java.lang.StringfindDbInfoAlt(java.lang.String infoFieldName, QueryResult qr)Find the first non-empty INFO field 'infoFieldName' in results Note: ALT must matchprotected voidfindDbInfoRef(java.util.Map<java.lang.String,java.lang.String> info, java.util.Set<org.snpeff.vcf.VcfEntry> uniqueVcfEntries)Fill values for INFO fields requiring 'REF' valueprotected booleanmatch(org.snpeff.interval.Variant var, org.snpeff.vcf.VariantVcfEntry dbEntry)Does database entry 'dbVcfEntry' match 'variant'?voidopen()protected java.lang.StringprependInfoName(java.lang.String infoStr)Prepend 'prependInfoFieldName' to all info fieldsprotected java.util.Collection<org.snpeff.vcf.VariantVcfEntry>query(org.snpeff.interval.Variant variant)Query database and find results matching 'variant'voidsetAnnotateEmpty(boolean annotateEmpty)voidsetDebug(boolean debug)voidsetExistsInfoField(java.lang.String existsInfoField)voidsetInfoFields(boolean useInfoFields, java.util.Collection<java.lang.String> infoFields)voidsetPrependInfoFieldName(java.lang.String prependInfoFieldName)voidsetUseId(boolean useId)voidsetUseRefAlt(boolean useRefAlt)voidsetVerbose(boolean verbose)java.lang.StringtoString()protected java.lang.StringuniqueIds(java.util.Set<java.lang.String> idSetDb, java.lang.String idStrVcf)IDs from database not present in VCFprotected voidwarn(java.lang.String warn)Show a warning message (up to MAX_ERRORS times)
-
-
-
Field Detail
-
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 java.lang.String chrPrev
-
existsInfoField
protected java.lang.String existsInfoField
-
prependInfoFieldName
protected java.lang.String prependInfoFieldName
-
dbVcf
protected DbVcf dbVcf
-
vcfDbFile
protected org.snpeff.fileIterator.VcfFileIterator vcfDbFile
-
errCount
protected java.util.HashMap<java.lang.String,java.lang.Integer> errCount
-
infoFields
protected java.util.Set<java.lang.String> infoFields
-
vcfInfoPerAllele
protected java.util.Map<java.lang.String,java.lang.Boolean> vcfInfoPerAllele
-
vcfInfoPerAlleleRef
protected java.util.Map<java.lang.String,java.lang.Boolean> vcfInfoPerAlleleRef
-
-
Method Detail
-
annotate
public boolean annotate(org.snpeff.vcf.VcfEntry vcfEntry) throws java.io.IOExceptionAnnotate a VCF entry- Throws:
java.io.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, java.util.Set<java.lang.String> idSet)Add ID information. Make sure we are no repeating IDs
-
annotateInfo
protected boolean annotateInfo(org.snpeff.vcf.VcfEntry vcfEntry, java.util.Map<java.lang.String,java.lang.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 java.util.List<org.snpeff.vcf.VcfEntry> find(org.snpeff.interval.Variant var)
-
find
public java.util.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(java.util.Set<java.lang.String> idSet, QueryResult qr)Find an ID for this variant and add them to idSet
-
findDbInfo
protected void findDbInfo(java.util.Map<java.lang.String,java.lang.String> info, QueryResult qr)Find INFO fields for this VCF entry
-
findDbInfo
protected java.lang.String findDbInfo(java.lang.String infoFieldName, QueryResult qr)Find all non-empty INFO fields 'infoFieldName' in results
-
findDbInfoAlt
protected java.lang.String findDbInfoAlt(java.lang.String infoFieldName, QueryResult qr)Find the first non-empty INFO field 'infoFieldName' in results Note: ALT must match
-
findDbInfoRef
protected void findDbInfoRef(java.util.Map<java.lang.String,java.lang.String> info, java.util.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 java.lang.String prependInfoName(java.lang.String infoStr)
Prepend 'prependInfoFieldName' to all info fields
-
query
protected java.util.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(java.lang.String existsInfoField)
-
setInfoFields
public void setInfoFields(boolean useInfoFields, java.util.Collection<java.lang.String> infoFields)
-
setPrependInfoFieldName
public void setPrependInfoFieldName(java.lang.String prependInfoFieldName)
-
setUseId
public void setUseId(boolean useId)
-
setUseRefAlt
public void setUseRefAlt(boolean useRefAlt)
-
setVerbose
public void setVerbose(boolean verbose)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
uniqueIds
protected java.lang.String uniqueIds(java.util.Set<java.lang.String> idSetDb, java.lang.String idStrVcf)IDs from database not present in VCF
-
warn
protected void warn(java.lang.String warn)
Show a warning message (up to MAX_ERRORS times)
-
-