Class FastaSummary
java.lang.Object
com.compomics.util.experiment.io.biology.protein.FastaSummary
This class parses a FASTA file and gathers summary statistics.
- Author:
- Marc Vaudel, Harald Barsnes
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal HashMap<ProteinDatabase, Integer> The database type occurrence in the FASTA file.final FileThe file this summary represents.final longThe last time the file was modified.final intThe number of sequences.final intThe number of target sequences.The species occurrence in the FASTA file. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the FASTA file contains decoys.Returns the description for this database.getName()Returns the name of the database.static FastaSummarygetSummary(String fastaFile, FastaParameters fastaParameters, boolean alwaysCreateNew, WaitingHandler waitingHandler) Gathers summary data on the FASTA file content.static FastaSummarygetSummary(String fastaFile, FastaParameters fastaParameters, WaitingHandler waitingHandler) Gathers summary data on the FASTA file content.Returns a string with the different database types found.Returns the database version.static voidsaveSummary(String fastaFile, FastaSummary fastaSummary) Saves the summary in the user folder.voidsetDescription(String description) Sets the description for this database.voidSets a new name for the database.voidsetVersion(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 IOException Gathers 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 IOException Gathers 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
-