Class FastaSummary
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 Summary
Fields Modifier and Type Field Description HashMap<ProteinDatabase,Integer>
databaseType
The database type occurrence in the FASTA file.File
fastaFile
The file this summary represents.long
lastModified
The last time the file was modified.int
nSequences
The number of sequences.int
nTarget
The number of target sequences.TreeMap<String,Integer>
speciesOccurrence
The species occurrence in the FASTA file. -
Constructor Summary
Constructors Constructor Description FastaSummary()
Empty default constructor.FastaSummary(String name, String description, String version, File fastaFile, TreeMap<String,Integer> speciesOccurrence, HashMap<ProteinDatabase,Integer> databaseType, int nSequences, int nTarget, long lastModified)
Constructor. -
Method Summary
Modifier and Type Method Description boolean
containsDecoys()
Returns true if the FASTA file contains decoys.String
getDescription()
Returns the description for this database.String
getName()
Returns the name of the database.static FastaSummary
getSummary(String fastaFile, FastaParameters fastaParameters, boolean alwaysCreateNew, WaitingHandler waitingHandler)
Gathers summary data on the FASTA file content.static FastaSummary
getSummary(String fastaFile, FastaParameters fastaParameters, WaitingHandler waitingHandler)
Gathers summary data on the FASTA file content.String
getTypeAsString()
Returns a string with the different database types found.String
getVersion()
Returns the database version.static void
saveSummary(String fastaFile, FastaSummary fastaSummary)
Saves the summary in the user folder.void
setDescription(String description)
Sets the description for this database.void
setName(String name)
Sets a new name for the database.void
setVersion(String version)
Sets the database version.
-
Field Details
-
fastaFile
The file this summary represents. -
speciesOccurrence
The species occurrence in the FASTA file. -
databaseType
The database type occurrence in the FASTA file. -
nSequences
public final int nSequencesThe number of sequences. -
nTarget
public final int nTargetThe number of target sequences. -
lastModified
public final long lastModifiedThe 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 namedescription
- the database descriptionversion
- the database versionfastaFile
- the FASTA filespeciesOccurrence
- the occurrence of every speciesdatabaseType
- the occurrence of every database typenSequences
- the number of sequencesnTarget
- the number of target sequenceslastModified
- the last time the file was modified
-
-
Method Details
-
getSummary
public static FastaSummary getSummary(String fastaFile, FastaParameters fastaParameters, WaitingHandler waitingHandler) throws IOExceptionGathers summary data on the FASTA file content.- Parameters:
fastaFile
- path to a FASTA filefastaParameters
- the parameters to use to parse the filewaitingHandler
- 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 IOExceptionGathers summary data on the FASTA file content.- Parameters:
fastaFile
- path to a FASTA filefastaParameters
- the parameters to use to parse the filealwaysCreateNew
- if true, a new summary file will be created even if one already existswaitingHandler
- 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
Saves the summary in the user folder.- Parameters:
fastaFile
- the FASTA filefastaSummary
- the summary- Throws:
IOException
- exception thrown if an error occurred while writing the file
-
getTypeAsString
Returns a string with the different database types found.- Returns:
- a string with the different database types found
-
getName
Returns the name of the database.- Returns:
- the name for the database
-
setName
Sets a new name for the database.- Parameters:
name
- a new name for the database
-
getVersion
Returns the database version.- Returns:
- the database version
-
setVersion
Sets the database version.- Parameters:
version
- the database version
-
getDescription
Returns the description for this database.- Returns:
- the description for this database
-
setDescription
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
-