Class BioIndex

  • All Implemented Interfaces:
    IndexStore

    public class BioIndex
    extends java.lang.Object
    implements IndexStore
    The original object for indexing sequence files.

    This class may not be thread-safe.

    Author:
    Matthew Pocock, Thomas Down
    • Constructor Summary

      Constructors 
      Constructor Description
      BioIndex​(java.io.File indexDirectory)
      Load an existing index file.
      BioIndex​(java.io.File indexDirectory, java.lang.String namespace, int idLength)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void commit()
      Commit the stored indices to permanent storage.
      Index fetch​(java.lang.String id)
      Fetch an Index based upon an ID.
      java.util.Set getFiles()
      Retrieve the Set of files that are currently indexed.
      SequenceFormat getFormat()
      Retrieve the format of the index file.
      java.util.Set getIDs()
      Retrieve the set of all current IDs.
      java.lang.String getName()
      Retrieve the name of this store.
      SequenceBuilderFactory getSBFactory()
      Retrieve the SequenceBuilderFactory used to build Sequence instances.
      SymbolTokenization getSymbolParser()
      Retrieve the symbol parser used to turn the sequence characters into Symobl objects.
      int guessRecLen​(java.io.RandomAccessFile file)  
      void rollback()
      Discard all uncommited changes.
      void store​(Index indx)
      Add the Index to the store.
      • Methods inherited from class java.lang.Object

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

      • BioIndex

        public BioIndex​(java.io.File indexDirectory,
                        java.lang.String namespace,
                        int idLength)
                 throws java.io.IOException,
                        BioException
        Throws:
        java.io.IOException
        BioException
      • BioIndex

        public BioIndex​(java.io.File indexDirectory)
                 throws java.io.IOException,
                        BioException
        Load an existing index file. If indexDirectory does not exist, or is not a bioindex stoore, this will barf.
        Throws:
        java.io.IOException
        BioException
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from interface: IndexStore
        Retrieve the name of this store. This will be reflected as the name of the IndexedSequenceDB.
        Specified by:
        getName in interface IndexStore
        Returns:
        the String name of the index
      • guessRecLen

        public int guessRecLen​(java.io.RandomAccessFile file)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • store

        public void store​(Index indx)
        Description copied from interface: IndexStore
        Add the Index to the store.

        This method should be transactional. If the store fails, the IndexStore should be left in its original state.

        If the file of the Index is not known yet, it is the responsibility of the IndexStore to add it to the set returned by getFiles.

        Specified by:
        store in interface IndexStore
        Parameters:
        indx - the Index to add
      • getIDs

        public java.util.Set getIDs()
        Description copied from interface: IndexStore
        Retrieve the set of all current IDs.

        This set should either be immutable, or modifiable totally separately from the IndexStore.

        Specified by:
        getIDs in interface IndexStore
        Returns:
        a Set of all legal IDs
      • getFiles

        public java.util.Set getFiles()
        Description copied from interface: IndexStore
        Retrieve the Set of files that are currently indexed.
        Specified by:
        getFiles in interface IndexStore
      • getFormat

        public SequenceFormat getFormat()
        Description copied from interface: IndexStore
        Retrieve the format of the index file.

        This set should either be immutable, or modifiable totally separately from the IndexStore.

        Specified by:
        getFormat in interface IndexStore
        Returns:
        a Set of all indexed files