Class DbVcf

  • All Implemented Interfaces:
    DbMarker<org.snpeff.interval.Variant,​org.snpeff.vcf.VariantVcfEntry>
    Direct Known Subclasses:
    DbVcfMem, DbVcfSorted, DbVcfTabix

    public abstract class DbVcf
    extends java.lang.Object
    implements DbMarker<org.snpeff.interval.Variant,​org.snpeff.vcf.VariantVcfEntry>
    Use a VCF file as a database for annotations A VCF database consists of a VCF file and an index. When a query is made, the index is used to quickly get the file positions where matching VCF entries are. File is read, entries are parsed and returned as query() result. WARNING: VcfEntry may hold multiple variants (e.g. multi-allelic VcfEntries). So we index by variant and return all matching vcfEntries for a given variant. This is why we use 'VariantVcfEntry' as opposed to 'VcfEntry' Notes: If another query matches the same region of the file, then we could use some sort of caching to speed up the process. If the same file region is matched multiple times by successive queries, creating an intervalTree from the VCF entries matching the region might be effective
    Author:
    pcingola
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String dbFileName  
      protected boolean debug  
      protected org.snpeff.vcf.VcfHeader vcfHeader  
      protected boolean verbose  
    • Constructor Summary

      Constructors 
      Constructor Description
      DbVcf​(java.lang.String dbFileName)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void close()
      Close database, free resources
      org.snpeff.vcf.VcfHeader getVcfHeader()  
      abstract void open()
      Open database (load index in memory if required)
      abstract java.util.Collection<org.snpeff.vcf.VariantVcfEntry> query​(org.snpeff.interval.Variant variant)
      Find matching entries in the database
      void setDebug​(boolean debug)  
      void setVerbose​(boolean verbose)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • debug

        protected boolean debug
      • verbose

        protected boolean verbose
      • dbFileName

        protected java.lang.String dbFileName
      • vcfHeader

        protected org.snpeff.vcf.VcfHeader vcfHeader
    • Constructor Detail

      • DbVcf

        public DbVcf​(java.lang.String dbFileName)
    • Method Detail

      • close

        public abstract void close()
        Description copied from interface: DbMarker
        Close database, free resources
        Specified by:
        close in interface DbMarker<org.snpeff.interval.Variant,​org.snpeff.vcf.VariantVcfEntry>
      • getVcfHeader

        public org.snpeff.vcf.VcfHeader getVcfHeader()
      • open

        public abstract void open()
        Description copied from interface: DbMarker
        Open database (load index in memory if required)
        Specified by:
        open in interface DbMarker<org.snpeff.interval.Variant,​org.snpeff.vcf.VariantVcfEntry>
      • query

        public abstract java.util.Collection<org.snpeff.vcf.VariantVcfEntry> query​(org.snpeff.interval.Variant variant)
        Find matching entries in the database
        Specified by:
        query in interface DbMarker<org.snpeff.interval.Variant,​org.snpeff.vcf.VariantVcfEntry>
      • setDebug

        public void setDebug​(boolean debug)
        Specified by:
        setDebug in interface DbMarker<org.snpeff.interval.Variant,​org.snpeff.vcf.VariantVcfEntry>
      • setVerbose

        public void setVerbose​(boolean verbose)
        Specified by:
        setVerbose in interface DbMarker<org.snpeff.interval.Variant,​org.snpeff.vcf.VariantVcfEntry>