Class VcfMetadata

java.lang.Object
org.pharmgkb.parser.vcf.model.VcfMetadata

public class VcfMetadata extends Object
This class captures all the VCF metadata from a VCF file.
  • Method Details

    • getFileFormat

      @Nonnull public String getFileFormat()
    • setFileFormat

      public void setFileFormat(@Nonnull String fileFormat)
    • getAlts

      @Nonnull public Map<String,IdDescriptionMetadata> getAlts()
    • getAlt

      @Nullable public IdDescriptionMetadata getAlt(@Nonnull String id)
      Gets the ALT metadata for the given ID.
      Parameters:
      id - the ID to lookup, will unwrap ID's enclosed in angle brackets (e.g. <CN1> will get converted to CN1)
    • getInfo

      @Nonnull public Map<String,InfoMetadata> getInfo()
    • getFilters

      @Nonnull public Map<String,IdDescriptionMetadata> getFilters()
    • getFormats

      @Nonnull public Map<String,FormatMetadata> getFormats()
    • getContigs

      @Nonnull public Map<String,ContigMetadata> getContigs()
    • getPedigrees

      @Nonnull public List<BaseMetadata> getPedigrees()
    • getSamples

      @Nonnull public Map<String,IdDescriptionMetadata> getSamples()
    • getAssemblies

      @Nonnull public List<String> getAssemblies()
      Returns:
      The URLs from the field(s) in the assembly metadata line(s)
    • getPedigreeDatabases

      @Nonnull public List<String> getPedigreeDatabases()
      Returns:
      The URLs from the field(s) in the pedigreeDB metadata line(s), including angle brackets if any
    • addAlt

      public void addAlt(@Nonnull IdDescriptionMetadata value)
      Adds value to the map of ALT metadata, using its ID as the key.
    • addInfo

      public void addInfo(@Nonnull InfoMetadata value)
      Adds value to the map of INFO metadata, using its ID as the key.
    • addFormat

      public void addFormat(@Nonnull FormatMetadata value)
      Adds value to the map of FORMAT metadata, using its ID as the key.
    • addContig

      public void addContig(@Nonnull ContigMetadata value)
      Adds value to the map of CONTIG metadata, using its ID as the key.
    • addFilter

      public void addFilter(@Nonnull IdDescriptionMetadata value)
      Adds value to the map of FILTER metadata, using its ID as the key.
    • addAssembly

      public void addAssembly(@Nonnull String value)
      Adds value to the list of assembly metadata.
      Parameters:
      value - Should not be wrapped in angle brackets
    • addPedigreeDatabase

      public void addPedigreeDatabase(@Nonnull String value)
      Adds value to the list of pedigreeDB.
      Parameters:
      value - Must be wrapped in angle brackets
      Throws:
      VcfFormatException - If value is not wrapped in angle brackets
    • removeAlt

      public void removeAlt(@Nonnull IdDescriptionMetadata value)
    • removeInfo

      public void removeInfo(@Nonnull InfoMetadata value)
    • removeFormat

      public void removeFormat(@Nonnull FormatMetadata value)
    • removeContig

      public void removeContig(@Nonnull ContigMetadata value)
    • removeFilter

      public void removeFilter(@Nonnull IdDescriptionMetadata value)
    • removeAssembly

      public void removeAssembly(@Nonnull String value)
    • removePedigreeDb

      public void removePedigreeDb(@Nonnull String value)
      Adds value to the list of pedigreeDB.
      Parameters:
      value - Must be wrapped in angle brackets
      Throws:
      VcfFormatException - If value is not wrapped in angle brackets
    • getRawProperties

      @Nonnull public com.google.common.collect.ListMultimap<String,String> getRawProperties()
      Returns a map from every property key to each of its values. Call ListMultimap.asMap() to get a Map<String, Collection<String>>.
      Returns:
      Contains every property except those contained in: However, contains any in getAssemblies() and getPedigreeDatabases().
    • getRawValuesOfProperty

      @Nonnull public List<String> getRawValuesOfProperty(@Nonnull String propertyKey)
      Returns the value of a property, or null if the property is not set or has no value. This method will return null for a reserved property of the form XX=<ID=value,ID=value,...>; assembly and pedigreeDB are still included.
    • getRawPropertyKeys

      @Nonnull public SortedSet<String> getRawPropertyKeys()
      Returns a list of the properties defined. Reserved properties of the form XX=<ID=value,ID=value,...> are excluded, though assembly and pedigreeDB are still included.
      Returns:
      Contains every property except those contained in: However, contains any in getAssemblies() and getPedigreeDatabases().
    • getColumnIndex

      public int getColumnIndex(@Nonnull String column)
    • getSampleIndex

      public int getSampleIndex(@Nonnull String sampleId)
      Sample numbering starts at 0.
    • getNumSamples

      public int getNumSamples()
      Gets the number of samples in the VCF file.
    • getNumColumns

      public int getNumColumns()
      Gets the number of columns in the VCF file.
    • getSampleName

      @Nonnull public String getSampleName(int idx)
      Gets the sample name (column name).
      Parameters:
      idx - sample index, first sample is at index 0
      Throws:
      ArrayIndexOutOfBoundsException - If the sample doesn't exist