java.lang.Object
com.compomics.util.experiment.io.biology.protein.iterators.FastaIterator
All Implemented Interfaces:
ProteinIterator

public class FastaIterator extends Object implements ProteinIterator
Iterator for a FASTA file.
Author:
Marc Vaudel, Harald Barsnes
  • Field Details

    • FORBIDDEN_CHARACTER

      public static final char FORBIDDEN_CHARACTER
      Character forbidden in protein sequences, will be removed.
      See Also:
  • Constructor Details

    • FastaIterator

      public FastaIterator(File fastaFile) throws FileNotFoundException
      Constructor without sanity check.
      Parameters:
      fastaFile - the FASTA file
      Throws:
      FileNotFoundException - exception thrown if the file could not be found
    • FastaIterator

      public FastaIterator(File fastaFile, boolean sanityCheck) throws FileNotFoundException
      Constructor.
      Parameters:
      fastaFile - the FASTA file
      sanityCheck - boolean indicating whether sanity check should be conducted
      Throws:
      FileNotFoundException - exception thrown if the file could not be found
  • Method Details

    • getProgressInPercent

      public double getProgressInPercent()
      Returns the progress reading the file in percent.
      Returns:
      The progress reading the file in percent.
    • getNextProtein

      public Protein getNextProtein()
      Description copied from interface: ProteinIterator
      Returns the next protein. Null if end was reached. If an error is encountered while iterating, the exception is thrown as runtime exception.
      Specified by:
      getNextProtein in interface ProteinIterator
      Returns:
      the next protein
    • getLastHeader

      public Header getLastHeader()
      Returns the header corresponding to the last protein.
      Returns:
      the header corresponding to the last protein
    • close

      public void close()
      Closes the iterator.