com.compomics.util.experiment.quantification
Class QuantificationDB

java.lang.Object
  extended by com.compomics.util.experiment.quantification.QuantificationDB
All Implemented Interfaces:
Serializable

public class QuantificationDB
extends Object
implements Serializable

This class uses a database to manage quantification matches.

Author:
Marc Vaudel
See Also:
Serialized Form

Field Summary
 String dbName
          The name which will be used for the database.
 
Constructor Summary
QuantificationDB(String folder, String name, boolean deleteOldDatabase, ObjectsCache objectsCache)
          Constructor creating the database and the protein and protein parameters tables.
 
Method Summary
 void addMatch(QuantificationMatch match)
          Adds an quantification match to the database.
 void addPeptideMatch(PeptideQuantification peptideMatch)
          Adds a peptide match to the database.
 void addPeptideMatchParameter(String key, UrParameter urParameter)
          Adds a peptide match parameter to the database.
 void addProteinMatch(ProteinQuantification proteinMatch)
          Adds a protein match to the database.
 void addProteinMatchParameter(String key, UrParameter urParameter)
          Adds a protein match parameter to the database.
 void addSpectrumMatch(PsmQuantification spectrumMatch)
          Adds a spectrum match to the database.
 void addSpectrumMatchParameter(String key, UrParameter urParameter)
          Adds a spectrum match parameter to the database.
 void close()
          Closes the db connection.
 void establishConnection(String dbFolder, boolean deleteOldDatabase, ObjectsCache objectsCache)
          Establishes connection to the database.
 PeptideQuantification getPeptideMatch(String key)
          Returns the desired peptide match.
 UrParameter getPeptideMatchParameter(String key, UrParameter urParameter)
          Returns the desired peptide match parameter.
 String getPeptideParameterTable(UrParameter urParameter)
          Returns the table name associated to the given peptide parameter.
 ProteinQuantification getProteinMatch(String key)
          Returns the desired protein match.
 UrParameter getProteinMatchPArameter(String key, UrParameter urParameter)
          Returns the desired protein match parameter.
 String getProteinParameterTable(UrParameter urParameter)
          Returns the table name associated to the given protein parameter.
 PsmQuantification getSpectrumMatch(String key)
          Returns the desired spectrum match.
 UrParameter getSpectrumMatchParameter(String key, UrParameter urParameter)
          Returns the desired spectrum match parameter.
 String getSpectrumMatchTable(String spectrumKey)
          Returns the table name associated to the given spectrum key.
 String getSpectrumParameterTable(String spectrumKey, UrParameter urParameter)
          Returns the table name associated to the given spectrum parameter.
 boolean peptideMatchLoaded(String peptideKey)
          Indicates whether a peptide match is loaded.
 boolean proteinMatchLoaded(String proteinKey)
          Indicates whether a protein match is loaded.
 void removePeptideMatch(String key)
          Deletes a peptide match from the database.
 void removeProteinMatch(String key)
          Deletes a protein match from the database.
 void removeSpectrumMatch(String key)
          Deletes a spectrum match from the database.
 boolean spectrumMatchLoaded(String spectrumKey)
          Indicates whether a spectrum match is loaded.
 void updateMatch(QuantificationMatch match)
          Updates a match.
 void updatePeptideMatch(PeptideQuantification peptideMatch)
          Updates a peptide match.
 void updatePeptideParameter(String key, UrParameter urParameter)
          Updates a peptide match parameter.
 void updateProteinMatch(ProteinQuantification proteinMatch)
          Updates a protein match.
 void updateProteinParameter(String key, UrParameter urParameter)
          Updates a protein match parameter.
 void updateSpectrumMatch(PsmQuantification spectrumMatch)
          Updates a spectrum match.
 void updateSpectrumParameter(String key, UrParameter urParameter)
          Updates a spectrum match parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbName

public String dbName
The name which will be used for the database.

Constructor Detail

QuantificationDB

public QuantificationDB(String folder,
                        String name,
                        boolean deleteOldDatabase,
                        ObjectsCache objectsCache)
                 throws SQLException
Constructor creating the database and the protein and protein parameters tables.

Parameters:
folder - the folder where to put the database
name - the database name
deleteOldDatabase - if true, tries to delete the old database
objectsCache - the object cache
Throws:
SQLException - an exception thrown whenever an error occurred while creating the database
Method Detail

spectrumMatchLoaded

public boolean spectrumMatchLoaded(String spectrumKey)
                            throws SQLException
Indicates whether a spectrum match is loaded.

Parameters:
spectrumKey - the spectrumMatch key
Returns:
a boolean indicating whether a spectrum match is loaded in the given table
Throws:
SQLException - exception thrown whenever an exception occurred while interrogating the database

peptideMatchLoaded

public boolean peptideMatchLoaded(String peptideKey)
                           throws SQLException
Indicates whether a peptide match is loaded.

Parameters:
peptideKey - the peptide key
Returns:
a boolean indicating whether a peptide match is loaded in the given table
Throws:
SQLException - exception thrown whenever an exception occurred while interrogating the database

proteinMatchLoaded

public boolean proteinMatchLoaded(String proteinKey)
                           throws SQLException
Indicates whether a protein match is loaded.

Parameters:
proteinKey - the protein key
Returns:
a boolean indicating whether a protein match is loaded in the given table
Throws:
SQLException - exception thrown whenever an exception occurred while interrogating the database

updateProteinMatch

public void updateProteinMatch(ProteinQuantification proteinMatch)
                        throws SQLException,
                               IOException
Updates a protein match.

Parameters:
proteinMatch - the protein match
Throws:
SQLException - exception thrown whenever an error occurred while updating a match in the table
IOException - exception thrown whenever an error occurred while writing in the database

updatePeptideMatch

public void updatePeptideMatch(PeptideQuantification peptideMatch)
                        throws SQLException,
                               IOException
Updates a peptide match.

Parameters:
peptideMatch - the peptide match
Throws:
SQLException - exception thrown whenever an error occurred while updating a match in the table
IOException - exception thrown whenever an error occurred while writing in the database

updateSpectrumMatch

public void updateSpectrumMatch(PsmQuantification spectrumMatch)
                         throws SQLException,
                                IOException
Updates a spectrum match.

Parameters:
spectrumMatch - the spectrum match
Throws:
SQLException - exception thrown whenever an error occurred while updating a match in the table
IOException - exception thrown whenever an error occurred while writing in the database

updateMatch

public void updateMatch(QuantificationMatch match)
                 throws SQLException,
                        IOException
Updates a match.

Parameters:
match - the match to update
Throws:
SQLException - exception thrown whenever an error occurred while updating a match in the table
IOException - exception thrown whenever an error occurred while writing in the database

updateProteinParameter

public void updateProteinParameter(String key,
                                   UrParameter urParameter)
                            throws SQLException,
                                   IOException
Updates a protein match parameter.

Parameters:
key - the key of the protein match
urParameter - the parameter
Throws:
SQLException - exception thrown whenever an error occurred while updating the parameter in the table
IOException - exception thrown whenever an error occurred while writing in the database

updatePeptideParameter

public void updatePeptideParameter(String key,
                                   UrParameter urParameter)
                            throws SQLException,
                                   IOException
Updates a peptide match parameter.

Parameters:
key - the key of the peptide match
urParameter - the parameter
Throws:
SQLException - exception thrown whenever an error occurred while updating the parameter in the table
IOException - exception thrown whenever an error occurred while writing in the database

updateSpectrumParameter

public void updateSpectrumParameter(String key,
                                    UrParameter urParameter)
                             throws SQLException,
                                    IOException
Updates a spectrum match parameter.

Parameters:
key - the key of the spectrum match
urParameter - the parameter
Throws:
SQLException - exception thrown whenever an error occurred while updating the parameter in the table
IOException - exception thrown whenever an error occurred while writing in the database

removeProteinMatch

public void removeProteinMatch(String key)
                        throws SQLException,
                               IOException
Deletes a protein match from the database.

Parameters:
key - the key of the match
Throws:
SQLException - exception thrown whenever an error occurred while deleting the match
IOException

removePeptideMatch

public void removePeptideMatch(String key)
                        throws SQLException,
                               IOException
Deletes a peptide match from the database.

Parameters:
key - the key of the match
Throws:
SQLException - exception thrown whenever an error occurred while deleting the match
IOException

removeSpectrumMatch

public void removeSpectrumMatch(String key)
                         throws SQLException,
                                IOException
Deletes a spectrum match from the database.

Parameters:
key - the key of the match
Throws:
SQLException - exception thrown whenever an error occurred while deleting the match
IOException

getSpectrumMatch

public PsmQuantification getSpectrumMatch(String key)
                                   throws SQLException,
                                          IOException,
                                          ClassNotFoundException
Returns the desired spectrum match.

Parameters:
key - the psm key
Returns:
the spectrum match
Throws:
SQLException - exception thrown whenever an error occurred while loading the object from the database
IOException - exception thrown whenever an error occurred while reading the object in the database
ClassNotFoundException - exception thrown whenever an error occurred while casting the database input in the desired match class

addSpectrumMatch

public void addSpectrumMatch(PsmQuantification spectrumMatch)
                      throws SQLException,
                             IOException
Adds a spectrum match to the database.

Parameters:
spectrumMatch - the spectrum match to be added
Throws:
SQLException - exception thrown whenever an error occurred while adding the object in the database
IOException - exception thrown whenever an error occurred while writing the object

getPeptideMatch

public PeptideQuantification getPeptideMatch(String key)
                                      throws SQLException,
                                             IOException,
                                             ClassNotFoundException
Returns the desired peptide match.

Parameters:
key - the peptide key
Returns:
the peptide match
Throws:
SQLException - exception thrown whenever an error occurred while loading the object from the database
IOException - exception thrown whenever an error occurred while reading the object in the database
ClassNotFoundException - exception thrown whenever an error occurred while casting the database input in the desired match class

addPeptideMatch

public void addPeptideMatch(PeptideQuantification peptideMatch)
                     throws SQLException,
                            IOException
Adds a peptide match to the database.

Parameters:
peptideMatch - the peptide match to be added
Throws:
SQLException - exception thrown whenever an error occurred while adding the object in the database
IOException - exception thrown whenever an error occurred while writing the object

getProteinMatch

public ProteinQuantification getProteinMatch(String key)
                                      throws SQLException,
                                             IOException,
                                             ClassNotFoundException
Returns the desired protein match.

Parameters:
key - the protein key
Returns:
the protein match
Throws:
SQLException - exception thrown whenever an error occurred while loading the object from the database
IOException - exception thrown whenever an error occurred while reading the object in the database
ClassNotFoundException - exception thrown whenever an error occurred while casting the database input in the desired match class

addProteinMatch

public void addProteinMatch(ProteinQuantification proteinMatch)
                     throws SQLException,
                            IOException
Adds a protein match to the database.

Parameters:
proteinMatch - the protein match to be added
Throws:
SQLException - exception thrown whenever an error occurred while adding the object in the database
IOException - exception thrown whenever an error occurred while writing the object

getSpectrumMatchParameter

public UrParameter getSpectrumMatchParameter(String key,
                                             UrParameter urParameter)
                                      throws SQLException,
                                             IOException,
                                             ClassNotFoundException
Returns the desired spectrum match parameter.

Parameters:
key - the psm key
urParameter - the match parameter
Returns:
the spectrum match parameter
Throws:
SQLException - exception thrown whenever an error occurred while loading the object from the database
IOException - exception thrown whenever an error occurred while reading the object in the database
ClassNotFoundException - exception thrown whenever an error occurred while casting the database input in the desired match class

addSpectrumMatchParameter

public void addSpectrumMatchParameter(String key,
                                      UrParameter urParameter)
                               throws SQLException,
                                      IOException
Adds a spectrum match parameter to the database.

Parameters:
key - the psm key
urParameter - the match parameter
Throws:
SQLException - exception thrown whenever an error occurred while adding the object in the database
IOException - exception thrown whenever an error occurred while writing the object

getPeptideMatchParameter

public UrParameter getPeptideMatchParameter(String key,
                                            UrParameter urParameter)
                                     throws SQLException,
                                            IOException,
                                            ClassNotFoundException
Returns the desired peptide match parameter.

Parameters:
key - the peptide key
urParameter - the match parameter
Returns:
the peptide match parameter
Throws:
SQLException - exception thrown whenever an error occurred while loading the object from the database
IOException - exception thrown whenever an error occurred while reading the object in the database
ClassNotFoundException - exception thrown whenever an error occurred while casting the database input in the desired match class

addPeptideMatchParameter

public void addPeptideMatchParameter(String key,
                                     UrParameter urParameter)
                              throws SQLException,
                                     IOException
Adds a peptide match parameter to the database.

Parameters:
key - the peptide key
urParameter - the match parameter
Throws:
SQLException - exception thrown whenever an error occurred while adding the object in the database
IOException - exception thrown whenever an error occurred while writing the object

getProteinMatchPArameter

public UrParameter getProteinMatchPArameter(String key,
                                            UrParameter urParameter)
                                     throws SQLException,
                                            IOException,
                                            ClassNotFoundException
Returns the desired protein match parameter.

Parameters:
key - the protein key
urParameter - the match parameter
Returns:
the protein match parameter
Throws:
SQLException - exception thrown whenever an error occurred while loading the object from the database
IOException - exception thrown whenever an error occurred while reading the object in the database
ClassNotFoundException - exception thrown whenever an error occurred while casting the database input in the desired match class

addProteinMatchParameter

public void addProteinMatchParameter(String key,
                                     UrParameter urParameter)
                              throws SQLException,
                                     IOException
Adds a protein match parameter to the database.

Parameters:
key - the protein key
urParameter - the match parameter
Throws:
SQLException - exception thrown whenever an error occurred while adding the object in the database
IOException - exception thrown whenever an error occurred while writing the object

getSpectrumMatchTable

public String getSpectrumMatchTable(String spectrumKey)
Returns the table name associated to the given spectrum key.

Parameters:
spectrumKey - the given spectrum key
Returns:
the table name of the given spectrum

getSpectrumParameterTable

public String getSpectrumParameterTable(String spectrumKey,
                                        UrParameter urParameter)
Returns the table name associated to the given spectrum parameter.

Parameters:
spectrumKey - the given spectrum key
urParameter - the parameter
Returns:
the table name of the given spectrum parameter

getPeptideParameterTable

public String getPeptideParameterTable(UrParameter urParameter)
Returns the table name associated to the given peptide parameter.

Parameters:
urParameter - the parameter
Returns:
the table name of the given peptide parameter

getProteinParameterTable

public String getProteinParameterTable(UrParameter urParameter)
Returns the table name associated to the given protein parameter.

Parameters:
urParameter - the parameter
Returns:
the table name of the given protein parameter

close

public void close()
           throws SQLException
Closes the db connection.

Throws:
SQLException - exception thrown whenever an error occurred while closing the database connection

establishConnection

public void establishConnection(String dbFolder,
                                boolean deleteOldDatabase,
                                ObjectsCache objectsCache)
                         throws SQLException
Establishes connection to the database.

Parameters:
dbFolder - the absolute path to the folder where the database is located
deleteOldDatabase - if true, tries to delete the old database
objectsCache -
Throws:
SQLException - exception thrown whenever an error occurred while establishing the connection

addMatch

public void addMatch(QuantificationMatch match)
              throws SQLException,
                     IOException
Adds an quantification match to the database.

Parameters:
match - the match to be added
Throws:
SQLException - exception thrown whenever an error occurred while adding the object in the database
IOException - exception thrown whenever an error occurred while writing the object


Copyright © 2013. All Rights Reserved.