Class FastaSequenceIndex

    • Constructor Detail

      • FastaSequenceIndex

        public FastaSequenceIndex​(File indexFile)
        Build a sequence index from the specified file.
        Parameters:
        indexFile - File to open.
        Throws:
        FileNotFoundException - if the index file cannot be found.
      • FastaSequenceIndex

        public FastaSequenceIndex​(Path indexFile)
        Build a sequence index from the specified file.
        Parameters:
        indexFile - File to open.
        Throws:
        FileNotFoundException - if the index file cannot be found.
      • FastaSequenceIndex

        public FastaSequenceIndex​(InputStream in)
        Build a sequence index from the specified input stream.
        Parameters:
        in - InputStream to read from.
      • FastaSequenceIndex

        protected FastaSequenceIndex()
        Empty, protected constructor for unit testing.
    • Method Detail

      • add

        protected void add​(FastaSequenceIndexEntry indexEntry)
        Add a new index entry to the list. Protected for unit testing.
        Parameters:
        indexEntry - New index entry to add.
      • rename

        protected void rename​(FastaSequenceIndexEntry entry,
                              String newName)
        Renames the existing index entry to the new index entry with the specified name.
        Parameters:
        entry - entry to update.
        newName - New name for the index entry.
      • equals

        public boolean equals​(Object other)
        Compare two FastaSequenceIndex objects for equality.
        Overrides:
        equals in class Object
        Parameters:
        other - Another FastaSequenceIndex to compare
        Returns:
        True if index has the same entries as other instance, in the same order
      • write

        public void write​(Path indexFile)
                   throws IOException
        Writes this index to the specified path.
        Parameters:
        indexFile - index file to output the index in the .fai format
        Throws:
        IOException - if an IO error occurs.
      • hasIndexEntry

        public boolean hasIndexEntry​(String contigName)
        Does the given contig name have a corresponding entry?
        Parameters:
        contigName - The contig name for which to search.
        Returns:
        True if contig name is present; false otherwise.
      • getIndexEntry

        public FastaSequenceIndexEntry getIndexEntry​(String contigName)
        Retrieve the index entry associated with the given contig.
        Parameters:
        contigName - Name of the contig for which to search.
        Returns:
        Index entry associated with the given contig.
        Throws:
        SAMException - if the associated index entry can't be found.
      • size

        public int size()
        Returns the number of elements in the index.
        Returns:
        Number of elements in the index.