com.compomics.util.experiment.identification
Class SequenceDataBase

java.lang.Object
  extended by com.compomics.util.experiment.personalization.ExperimentObject
      extended by com.compomics.util.experiment.identification.SequenceDataBase
All Implemented Interfaces:
Serializable, Cloneable

public class SequenceDataBase
extends ExperimentObject

This class models a protein database used for peptide/protein identification (like uniprot)

Author:
Marc Vaudel, Harald Barsnes
See Also:
Serialized Form

Field Summary
static String decoyFlag
          Flag for a decoy protein
 
Constructor Summary
SequenceDataBase()
          Constructor for a sequence database.
SequenceDataBase(String name, String version)
          Constructor for a sequence database.
 
Method Summary
 void addProtein(Protein protein)
          Adds a protein to the map.
 void appendDecoySequences()
          Appends reversed sequences to the database.
 void appendDecoySequences(ProgressDialogX progressDialog)
          Appends reversed sequences to the database.
 void exportAsFasta(File fastaFile)
          Exports the sequence database as a fasta file.
 void exportAsFasta(File fastaFile, ProgressDialogX progressDialog)
          Exports the sequence database as a fasta file.
 String getName()
          Returns the database name.
 int getNumberOfTargetSequences()
          Returns the number of target hits loaded.
 Protein getProtein(String proteinKey)
          Returns a protein indexed by its key.
 Header getProteinHeader(String proteinKey)
          Returns the protein header of the desired protein.
 Set<String> getProteinList()
          Returns the list of all protein imported.
 String getVersion()
          Returns the database version.
 void importDataBase(File fastaFile)
          Imports a sequence database from a fasta file.
 
Methods inherited from class com.compomics.util.experiment.personalization.ExperimentObject
addUrParam, getUrParam
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

decoyFlag

public static final String decoyFlag
Flag for a decoy protein

See Also:
Constant Field Values
Constructor Detail

SequenceDataBase

public SequenceDataBase()
Constructor for a sequence database.


SequenceDataBase

public SequenceDataBase(String name,
                        String version)
Constructor for a sequence database.

Parameters:
name - Name of the database
version - Version of the database
Method Detail

getProtein

public Protein getProtein(String proteinKey)
Returns a protein indexed by its key.

Parameters:
proteinKey - protein key
Returns:
the corresponding protein

getProteinHeader

public Header getProteinHeader(String proteinKey)
Returns the protein header of the desired protein.

Parameters:
proteinKey - protein key
Returns:
the corresponding header

addProtein

public void addProtein(Protein protein)
Adds a protein to the map.

Parameters:
protein - the new protein

getNumberOfTargetSequences

public int getNumberOfTargetSequences()
Returns the number of target hits loaded.

Returns:
the number of target hits loaded

getProteinList

public Set<String> getProteinList()
Returns the list of all protein imported.

Returns:
list of all protein imported

importDataBase

public void importDataBase(File fastaFile)
                    throws FileNotFoundException,
                           IOException
Imports a sequence database from a fasta file.

Parameters:
fastaFile - The fasta file to import
Throws:
FileNotFoundException - Exception thrown when the fasta file is not found
IOException - Exception thrown whenever an error is encountered while parsing the file
IllegalArgumentException - Exception thrown whenever the fasta header is not of correct format

appendDecoySequences

public void appendDecoySequences()
Appends reversed sequences to the database.

Throws:
IllegalArgumentException - Exception thrown if the database already contains decoy sequences

appendDecoySequences

public void appendDecoySequences(ProgressDialogX progressDialog)
Appends reversed sequences to the database.

Parameters:
progressDialog - The progress dialog, can be null
Throws:
IllegalArgumentException - Exception thrown if the database already contains decoy sequences

exportAsFasta

public void exportAsFasta(File fastaFile)
                   throws IOException
Exports the sequence database as a fasta file. Target sequences first then decoy sequences. Proteins are sorted by accession alphabetic order.

Parameters:
fastaFile - The fasta file where sequences should be output
Throws:
IOException - Exception thrown whenever a problem occurred while writing the file.

exportAsFasta

public void exportAsFasta(File fastaFile,
                          ProgressDialogX progressDialog)
                   throws IOException
Exports the sequence database as a fasta file. Target sequences first then decoy sequences. Proteins are sorted by accession alphabetic order.

Parameters:
fastaFile - The fasta file where sequences should be output
progressDialog - The progress dialog, can be null
Throws:
IOException - Exception thrown whenever a problem occurred while writing the file.

getName

public String getName()
Returns the database name.

Returns:
the database name

getVersion

public String getVersion()
Returns the database version.

Returns:
the database version


Copyright © 2011. All Rights Reserved.