# Class FastaFileIterator

java.lang.Object
org.snpeff.fileIterator.FileIterator<String>
org.snpeff.fileIterator.FastaFileIterator

All Implemented Interfaces:
  `Iterable<String>, Iterator<String>`

public class FastaFileIterator extends FileIterator<String>
Opens a fasta file and iterates over all fasta sequences in the file

Author:
  pcingola

## Field Summary

Fields
Modifier and Type
Field
Description
`static char[]`
`TRANSCRIPT_ID_SEPARATORS`
`static String`
`TRANSCRIPT_ID_SEPARATORS_REGEX`

### Fields inherited from class FileIterator

`autoClose, countNewLineChars, debug, fileName, fileSize, line, lineNum, next, nextLine, reader, verbose`

## Constructor Summary

Constructors
Constructor
Description
`FastaFileIterator(String fastaFileName)`

## Method Summary

Modifier and Type
Method
Description
`List<String>`
`fastaHeader2Ids()`
Try to parse IDs from a fasta header
`String`
`getHeader()`
Current sequence header
`String`
`getIdFromFastaHeader()`
Get transcript name from FASTA header (ENSEMBL protein files) Format example: '>ENSP00000356130 pep:known chromosome:GRCh37:1:205111633:205180694:-1 gene:ENSG00000133059 transcript:ENST00000367162'
`String`
`getName()`
Sequence name (first 'word') It extracts the characters after the leading '>' and before the first space, then removes leading 'chr', 'chr:', etc.
`protected String`
`readNext()`
Read a sequence from the file

### Methods inherited from class FileIterator

`close, countNewLineChars, getFilePointer, getLine, getLineNum, guessNewLineChars, hasNext, hasSeek, init, isDebug, iterator, load, next, readLine, ready, remove, seek, setAutoClose, setDebug, setVerbose, toString`

### Methods inherited from class Object

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

### Methods inherited from interface Iterable

`forEach, spliterator`

### Methods inherited from interface Iterator

`forEachRemaining`

## Field Details

### TRANSCRIPT_ID_SEPARATORS_REGEX

public static String TRANSCRIPT_ID_SEPARATORS_REGEX

### TRANSCRIPT_ID_SEPARATORS

public static char[] TRANSCRIPT_ID_SEPARATORS

## Constructor Details

### FastaFileIterator

public FastaFileIterator(String fastaFileName)

## Method Details

### fastaHeader2Ids

public List<String> fastaHeader2Ids()
Try to parse IDs from a fasta header

### getHeader

public String getHeader()
Current sequence header

### getName

public String getName()
Sequence name (first 'word') It extracts the characters after the leading '>' and before the first space, then removes leading 'chr', 'chr:', etc.

### getIdFromFastaHeader

public String getIdFromFastaHeader()
Get transcript name from FASTA header (ENSEMBL protein files) Format example: '>ENSP00000356130 pep:known chromosome:GRCh37:1:205111633:205180694:-1 gene:ENSG00000133059 transcript:ENST00000367162'

### readNext

protected String readNext()
Read a sequence from the file

Specified by:
  `readNext` in class `FileIterator<String>`