Package htsjdk.samtools.reference

# Class FastaSequenceIndexCreator

java.lang.Object
htsjdk.samtools.reference.FastaSequenceIndexCreator

public final class FastaSequenceIndexCreator extends Object
Static methods to create an `FastaSequenceIndex`.

## Method Summary

Modifier and Type
Method
Description
`static FastaSequenceIndex`
`buildFromFasta(Path fastaFile)`
Builds a FastaSequenceIndex on the fly from a FASTA file.
`static void`
`create(Path fastaFile, boolean overwrite)`
Creates a FASTA .fai index for the provided FASTA.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### create

public static void create(Path fastaFile, boolean overwrite) throws IOException
Creates a FASTA .fai index for the provided FASTA.

Parameters:
  `fastaFile` - the file to build the index from.
  `overwrite` - if the .fai index already exists override it if `true`; otherwise, throws a `SAMException`.
Throws:
  `SAMException` - if the fai file already exists or the file is malformed.
  `IOException` - if an IO error occurs.

### buildFromFasta

public static FastaSequenceIndex buildFromFasta(Path fastaFile) throws IOException, SAMException
Builds a FastaSequenceIndex on the fly from a FASTA file.

Note: this also allows to create an index for a compressed file, but does not generate the .gzi index required for use it with samtools. To generate that index, use `GZIIndex.buildIndex(Path)`.

Parameters:
  `fastaFile` - the FASTA file.
Returns:
  a fai index.
Throws:
  `SAMException` - for formatting errors.
  `IOException` - if an IO error occurs.