java.lang.Object
com.compomics.util.experiment.io.biology.protein.FastaSummary

public class FastaSummary extends Object
This class parses a FASTA file and gathers summary statistics.
Author:
Marc Vaudel, Harald Barsnes
  • Field Details

    • fastaFile

      public final File fastaFile
      The file this summary represents.
    • speciesOccurrence

      public final TreeMap<String,Integer> speciesOccurrence
      The species occurrence in the FASTA file.
    • databaseType

      public final HashMap<ProteinDatabase,Integer> databaseType
      The database type occurrence in the FASTA file.
    • nSequences

      public final int nSequences
      The number of sequences.
    • nTarget

      public final int nTarget
      The number of target sequences.
    • lastModified

      public final long lastModified
      The last time the file was modified.
  • Constructor Details

    • FastaSummary

      public FastaSummary()
      Empty default constructor.
    • FastaSummary

      public FastaSummary(String name, String description, String version, File fastaFile, TreeMap<String,Integer> speciesOccurrence, HashMap<ProteinDatabase,Integer> databaseType, int nSequences, int nTarget, long lastModified)
      Constructor.
      Parameters:
      name - the database name
      description - the database description
      version - the database version
      fastaFile - the FASTA file
      speciesOccurrence - the occurrence of every species
      databaseType - the occurrence of every database type
      nSequences - the number of sequences
      nTarget - the number of target sequences
      lastModified - the last time the file was modified
  • Method Details

    • getSummary

      public static FastaSummary getSummary(String fastaFile, FastaParameters fastaParameters, WaitingHandler waitingHandler) throws IOException
      Gathers summary data on the FASTA file content.
      Parameters:
      fastaFile - path to a FASTA file
      fastaParameters - the parameters to use to parse the file
      waitingHandler - a handler to allow canceling the import and displaying progress
      Returns:
      returns FASTA parameters inferred from the file
      Throws:
      IOException - exception thrown if an error occurred while iterating the file
    • getSummary

      public static FastaSummary getSummary(String fastaFile, FastaParameters fastaParameters, boolean alwaysCreateNew, WaitingHandler waitingHandler) throws IOException
      Gathers summary data on the FASTA file content.
      Parameters:
      fastaFile - path to a FASTA file
      fastaParameters - the parameters to use to parse the file
      alwaysCreateNew - if true, a new summary file will be created even if one already exists
      waitingHandler - a handler to allow canceling the import and displaying progress
      Returns:
      returns FASTA parameters inferred from the file
      Throws:
      IOException - exception thrown if an error occurred while iterating the file
    • saveSummary

      public static void saveSummary(String fastaFile, FastaSummary fastaSummary) throws IOException
      Saves the summary in the user folder.
      Parameters:
      fastaFile - the FASTA file
      fastaSummary - the summary
      Throws:
      IOException - exception thrown if an error occurred while writing the file
    • getTypeAsString

      public String getTypeAsString()
      Returns a string with the different database types found.
      Returns:
      a string with the different database types found
    • getName

      public String getName()
      Returns the name of the database.
      Returns:
      the name for the database
    • setName

      public void setName(String name)
      Sets a new name for the database.
      Parameters:
      name - a new name for the database
    • getVersion

      public String getVersion()
      Returns the database version.
      Returns:
      the database version
    • setVersion

      public void setVersion(String version)
      Sets the database version.
      Parameters:
      version - the database version
    • getDescription

      public String getDescription()
      Returns the description for this database.
      Returns:
      the description for this database
    • setDescription

      public void setDescription(String description)
      Sets the description for this database.
      Parameters:
      description - the description for this database
    • containsDecoys

      public boolean containsDecoys()
      Returns true if the FASTA file contains decoys.
      Returns:
      true if the FASTA file contains decoys