com.compomics.util.experiment.identification
Class Identification

java.lang.Object
  extended by com.compomics.util.experiment.personalization.ExperimentObject
      extended by com.compomics.util.experiment.identification.Identification
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
Ms2Identification

public abstract class Identification
extends ExperimentObject

This class contains identification results.

Author:
Marc Vaudel
See Also:
Serialized Form

Field Summary
static String EXTENTION
          Deprecated. use the database methods instead
protected  ArrayList<String> longKeys
          Deprecated. use the database instead @TODO implement this for db keys
protected  int methodUsed
          The method used.
protected  ArrayList<String> peptideIdentification
          List of the keys of all imported peptides.
protected  ArrayList<String> proteinIdentification
          List of the keys of all imported proteins.
protected  HashMap<String,ArrayList<String>> proteinMap
          A map linking protein accessions to all their protein matches keys.
protected  String reference
          The reference of the identification.
protected  String serializationDirectory
          The directory where matches will be serialized/the database stored.
protected  ArrayList<String> spectrumIdentification
          Deprecated. use file specific mapping instead
protected  HashMap<String,ArrayList<String>> spectrumIdentificationMap
          List of all imported psms indexed by mgf file name.
protected  HashMap<String,HashMap<String,UrParameter>> urParameters
          Deprecated. use the database instead
 
Constructor Summary
Identification()
           
 
Method Summary
 void addMatchParameter(String key, UrParameter urParameter)
          Deprecated. use the database match specific methods instead
 void addPeptideMatchParameter(String key, UrParameter urParameter)
          Adds a peptide match parameter to the database.
 void addProteinMatchParameter(String key, UrParameter urParameter)
          Adds a protein match parameter to the database.
 void addSpectrumMatch(Set<SpectrumMatch> spectrumMatches)
          Add a set of spectrumMatches to the model.
 void addSpectrumMatch(SpectrumMatch newMatch)
          Adds a spectrum match to the identification.
 void addSpectrumMatchParameter(String key, UrParameter urParameter)
          Adds a spectrum match parameter to the database.
 void buildPeptidesAndProteins(String spectrumMatchKey)
          Creates the peptides and protein instances based on the given spectrum match.
 void buildPeptidesAndProteins(WaitingHandler waitingHandler)
          Creates the peptides and protein instances based on the spectrum matches.
 void close()
          Closes the database connection.
 void convert(WaitingHandler waitingHandler, String newDirectory, String newName, ObjectsCache objectsCache)
          Converts a serlialization based structure into a database based one.
 void establishConnection(String dbFolder, boolean deleteOldDatabase, ObjectsCache objectsCache)
          Establishes a connection to the database.
static String getDefaultReference(String experimentReference, String sampleReference, int replicateNumber)
          Returns the default reference for an identification
 String getFileName(String key)
          Deprecated. use the database methods instead
 UrParameter getMatchParameter(String matchKey, UrParameter urParameter)
          Deprecated. use the database match specific methods instead
 IdentificationMatch.MatchType getMatchType(String matchKey)
          Returns the kind of match pointed by the given key in the identification mappings.
 int getMethodUsed()
          Getter for the identification method used.
 ArrayList<String> getPeptideIdentification()
          Returns a list of the keys of all encountered peptides.
 PeptideMatch getPeptideMatch(String peptideKey)
          Returns a peptide match.
 UrParameter getPeptideMatchParameter(String key, UrParameter urParameter)
          Returns the desired peptide match parameter.
 ArrayList<String> getProteinIdentification()
          Returns a list of the keys of all encountered proteins.
 HashMap<String,ArrayList<String>> getProteinMap()
          Returns a map of all the protein matches which can be ascribed to a protein indexed by its accession.
 ProteinMatch getProteinMatch(String proteinKey)
          Returns a protein match.
 UrParameter getProteinMatchParameter(String key, UrParameter urParameter)
          Returns the desired protein match parameter.
 String getSerializationDirectory()
          Returns the serialization directory.
 ArrayList<String> getSpectrumFiles()
          Returns the mgf files used in the spectrum identification map as a list.
 ArrayList<String> getSpectrumIdentification()
          Deprecated. use file specific names instead
 ArrayList<String> getSpectrumIdentification(String spectrumFile)
          Returns the spectrum identifications for a given spectrum file name.
 HashMap<String,ArrayList<String>> getSpectrumIdentificationMap()
          Returns the keys of all identified spectra indexed by the spectrum file.
 int getSpectrumIdentificationSize()
          Returns the number of spectrum identifications.
 SpectrumMatch getSpectrumMatch(String spectrumKey)
          Returns a spectrum match.
 UrParameter getSpectrumMatchParameter(String key, UrParameter urParameter)
          Returns the desired spectrum match parameter.
 Boolean isDB()
          Indicates whether the identification matches should be stored in a database (true, default value) or serialized files (false, deprecated default).
 void loadPeptideMatches(ArrayList<String> peptideKeys, WaitingHandler waitingHandler)
          Loads the desired peptide matches of the given type in the cache of the database.
 void loadPeptideMatches(WaitingHandler waitingHandler)
          Loads all peptide matches in the cache of the database.
 void loadPeptideMatchParameters(ArrayList<String> peptideKeys, UrParameter urParameter, WaitingHandler waitingHandler)
          Loads the desired peptide match parameters of the given type in the cache of the database.
 void loadPeptideMatchParameters(UrParameter urParameter, WaitingHandler waitingHandler)
          Loads all peptide match parameters of the given type in the cache of the database.
 void loadProteinMatches(WaitingHandler waitingHandler)
          Loads all protein matches in the cache of the database.
 void loadProteinMatchParameters(UrParameter urParameter, WaitingHandler waitingHandler)
          Loads all protein match parameters of the given type in the cache of the database.
 void loadSpectrumMatches(ArrayList<String> spectrumKeys, WaitingHandler waitingHandler)
          Loads the given spectrum matches in the cache of the database.
 void loadSpectrumMatches(String fileName, WaitingHandler waitingHandler)
          Loads all spectrum matches of the file in the cache of the database
 void loadSpectrumMatchParameters(ArrayList<String> spectrumKeys, UrParameter urParameter, WaitingHandler waitingHandler)
          Loads all desired spectrum match parameters in the cache of the database.
 void loadSpectrumMatchParameters(String fileName, UrParameter urParameter, WaitingHandler waitingHandler)
          Loads all spectrum match parameters of the given type in the cache of the database
 boolean matchExists(String matchKey)
          Indicates whether a match indexed by the given key exists.
 void removeMatch(String matchKey)
          Deprecated. it is advised to use the specific psm/peptide/protein method instead
 void removePeptideMatch(String matchKey)
          Removes a peptide match from the model.
 void removeProteinMatch(String matchKey)
          Removes a protein match from the model.
 void removeSpectrumMatch(String matchKey)
          Removes a spectrum match from the model.
 void setDirectory(String serializationDirectory, boolean deleteOldDatabase)
          Deprecated. use establishConnection(String dbFolder) instead
 void setIsDB(Boolean isDB)
          Sets whether the identification matches should be stored in a database or serialized files.
 void updatePeptideMatch(PeptideMatch peptideMatch)
          Updates a peptide match in the database.
 void updatePeptideMatchParameter(String key, UrParameter urParameter)
          Updates a peptide match parameter in the database.
 void updateProteinMatch(ProteinMatch proteinMatch)
          Updates a protein match in the database.
 void updateProteinMatchParameter(String key, UrParameter urParameter)
          Updates a protein match parameter in the database.
 void updateSpectrumMapping()
          Converts the old spectrum keys structure into the mapped version.
 void updateSpectrumMatch(SpectrumMatch spectrumMatch)
          Updates a spectrum match in the database.
 void updateSpectrumMatchParameter(String key, UrParameter urParameter)
          Updates a spectrum match parameter in the database.
 
Methods inherited from class com.compomics.util.experiment.personalization.ExperimentObject
addUrParam, getParameterKey, getUrParam
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTENTION

public static final String EXTENTION
Deprecated. use the database methods instead
Extention for a serialized hit. cuh for Compomics Utilities Hit.

See Also:
Constant Field Values

proteinIdentification

protected ArrayList<String> proteinIdentification
List of the keys of all imported proteins.


peptideIdentification

protected ArrayList<String> peptideIdentification
List of the keys of all imported peptides.


spectrumIdentificationMap

protected HashMap<String,ArrayList<String>> spectrumIdentificationMap
List of all imported psms indexed by mgf file name.


spectrumIdentification

protected ArrayList<String> spectrumIdentification
Deprecated. use file specific mapping instead
List of the keys of all imported psms.


proteinMap

protected HashMap<String,ArrayList<String>> proteinMap
A map linking protein accessions to all their protein matches keys.


methodUsed

protected int methodUsed
The method used.


serializationDirectory

protected String serializationDirectory
The directory where matches will be serialized/the database stored.


urParameters

protected HashMap<String,HashMap<String,UrParameter>> urParameters
Deprecated. use the database instead
Map of the user's parameters.


longKeys

protected ArrayList<String> longKeys
Deprecated. use the database instead @TODO implement this for db keys
Map of long keys (>100 characters) which will be referenced by their index for file creation/database storage.


reference

protected String reference
The reference of the identification.

Constructor Detail

Identification

public Identification()
Method Detail

getSpectrumFiles

public ArrayList<String> getSpectrumFiles()
Returns the mgf files used in the spectrum identification map as a list.

Returns:
the mgf files used in the spectrum identification map

getSpectrumIdentificationSize

public int getSpectrumIdentificationSize()
Returns the number of spectrum identifications.

Returns:
the number of spectrum identifications

addMatchParameter

public void addMatchParameter(String key,
                              UrParameter urParameter)
                       throws SQLException,
                              IOException
Deprecated. use the database match specific methods instead

Adds a parameter with a corresponding match key which will be loaded in the memory. Use this method only for frequently used parameters, otherwise attach the parameters to the matches.

Parameters:
key - the key of the parameter
urParameter - the additional 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

getMatchParameter

public UrParameter getMatchParameter(String matchKey,
                                     UrParameter urParameter)
                              throws SQLException,
                                     IOException,
                                     ClassNotFoundException
Deprecated. use the database match specific methods instead

Returns the personalization parameter of the given match.

Parameters:
matchKey - the match key
urParameter - example of parameter to retrieve
Returns:
the personalization 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

loadSpectrumMatchParameters

public void loadSpectrumMatchParameters(String fileName,
                                        UrParameter urParameter,
                                        WaitingHandler waitingHandler)
                                 throws SQLException,
                                        IOException,
                                        ClassNotFoundException
Loads all spectrum match parameters of the given type in the cache of the database

Parameters:
fileName - the file name
urParameter - the parameter type
waitingHandler - the waiting handler
Throws:
SQLException - exception thrown whenever an error occurred while interrogating the database
IOException - exception thrown whenever an error occurred while reading the database
ClassNotFoundException - exception thrown whenever the class of the object is not found when deserializing it.

loadSpectrumMatchParameters

public void loadSpectrumMatchParameters(ArrayList<String> spectrumKeys,
                                        UrParameter urParameter,
                                        WaitingHandler waitingHandler)
                                 throws SQLException,
                                        IOException,
                                        ClassNotFoundException
Loads all desired spectrum match parameters in the cache of the database.

Parameters:
spectrumKeys - the key of the spectrum match of the parameters to be loaded
urParameter - the parameter type
waitingHandler - the waiting handler
Throws:
SQLException - exception thrown whenever an error occurred while interrogating the database
IOException - exception thrown whenever an error occurred while reading the database
ClassNotFoundException - exception thrown whenever the class of the object is not found when deserializing it.

loadPeptideMatchParameters

public void loadPeptideMatchParameters(UrParameter urParameter,
                                       WaitingHandler waitingHandler)
                                throws SQLException,
                                       IOException,
                                       ClassNotFoundException
Loads all peptide match parameters of the given type in the cache of the database.

Parameters:
urParameter - the parameter type
waitingHandler - the waiting handler
Throws:
SQLException - exception thrown whenever an error occurred while interrogating the database
IOException - exception thrown whenever an error occurred while reading the database
ClassNotFoundException - exception thrown whenever the class of the object is not found when deserializing it.

loadPeptideMatchParameters

public void loadPeptideMatchParameters(ArrayList<String> peptideKeys,
                                       UrParameter urParameter,
                                       WaitingHandler waitingHandler)
                                throws SQLException,
                                       IOException,
                                       ClassNotFoundException
Loads the desired peptide match parameters of the given type in the cache of the database.

Parameters:
peptideKeys - the list of peptide keys of the parameters to load
urParameter - the parameter type
waitingHandler - the waiting handler
Throws:
SQLException - exception thrown whenever an error occurred while interrogating the database
IOException - exception thrown whenever an error occurred while reading the database
ClassNotFoundException - exception thrown whenever the class of the object is not found when deserializing it.

loadPeptideMatches

public void loadPeptideMatches(ArrayList<String> peptideKeys,
                               WaitingHandler waitingHandler)
                        throws SQLException,
                               IOException,
                               ClassNotFoundException
Loads the desired peptide matches of the given type in the cache of the database.

Parameters:
peptideKeys - the list of peptide keys to load
waitingHandler - the waiting handler
Throws:
SQLException - exception thrown whenever an error occurred while interrogating the database
IOException - exception thrown whenever an error occurred while reading the database
ClassNotFoundException - exception thrown whenever the class of the object is not found when deserializing it.

loadProteinMatchParameters

public void loadProteinMatchParameters(UrParameter urParameter,
                                       WaitingHandler waitingHandler)
                                throws SQLException,
                                       IOException,
                                       ClassNotFoundException
Loads all protein match parameters of the given type in the cache of the database.

Parameters:
urParameter - the parameter type
waitingHandler - the waiting handler
Throws:
SQLException - exception thrown whenever an error occurred while interrogating the database
IOException - exception thrown whenever an error occurred while reading the database
ClassNotFoundException - exception thrown whenever the class of the object is not found when deserializing it.

loadProteinMatches

public void loadProteinMatches(WaitingHandler waitingHandler)
                        throws SQLException,
                               IOException,
                               ClassNotFoundException
Loads all protein matches in the cache of the database.

Parameters:
waitingHandler - the waiting handler
Throws:
SQLException - exception thrown whenever an error occurred while interrogating the database
IOException - exception thrown whenever an error occurred while reading the database
ClassNotFoundException - exception thrown whenever the class of the object is not found when deserializing it.

loadPeptideMatches

public void loadPeptideMatches(WaitingHandler waitingHandler)
                        throws SQLException,
                               IOException,
                               ClassNotFoundException
Loads all peptide matches in the cache of the database.

Parameters:
waitingHandler - the waiting handler
Throws:
SQLException - exception thrown whenever an error occurred while interrogating the database
IOException - exception thrown whenever an error occurred while reading the database
ClassNotFoundException - exception thrown whenever the class of the object is not found when deserializing it.

loadSpectrumMatches

public void loadSpectrumMatches(String fileName,
                                WaitingHandler waitingHandler)
                         throws SQLException,
                                IOException,
                                ClassNotFoundException
Loads all spectrum matches of the file in the cache of the database

Parameters:
fileName - the file name
waitingHandler - the waiting handler
Throws:
SQLException - exception thrown whenever an error occurred while interrogating the database
IOException - exception thrown whenever an error occurred while reading the database
ClassNotFoundException - exception thrown whenever the class of the object is not found when deserializing it.

loadSpectrumMatches

public void loadSpectrumMatches(ArrayList<String> spectrumKeys,
                                WaitingHandler waitingHandler)
                         throws SQLException,
                                IOException,
                                ClassNotFoundException
Loads the given spectrum matches in the cache of the database.

Parameters:
spectrumKeys - the spectrum keys
waitingHandler - the waiting handler
Throws:
SQLException - exception thrown whenever an error occurred while interrogating the database
IOException - exception thrown whenever an error occurred while reading the database
ClassNotFoundException - exception thrown whenever the class of the object is not found when deserializing it.

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

updateProteinMatchParameter

public void updateProteinMatchParameter(String key,
                                        UrParameter urParameter)
                                 throws SQLException,
                                        IOException
Updates a protein match parameter in 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

updatePeptideMatchParameter

public void updatePeptideMatchParameter(String key,
                                        UrParameter urParameter)
                                 throws SQLException,
                                        IOException
Updates a peptide match parameter in 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

updateSpectrumMatchParameter

public void updateSpectrumMatchParameter(String key,
                                         UrParameter urParameter)
                                  throws SQLException,
                                         IOException
Updates a spectrum match parameter in the database.

Parameters:
key - the spectrum 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

updateSpectrumMatch

public void updateSpectrumMatch(SpectrumMatch spectrumMatch)
                         throws SQLException,
                                IOException
Updates a spectrum match in the database.

Parameters:
spectrumMatch - the match
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

updatePeptideMatch

public void updatePeptideMatch(PeptideMatch peptideMatch)
                        throws SQLException,
                               IOException
Updates a peptide match in the database.

Parameters:
peptideMatch - the match
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

updateProteinMatch

public void updateProteinMatch(ProteinMatch proteinMatch)
                        throws SQLException,
                               IOException
Updates a protein match in the database.

Parameters:
proteinMatch - the match
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

getSerializationDirectory

public String getSerializationDirectory()
Returns the serialization directory.

Returns:
the serialization directory

setDirectory

public void setDirectory(String serializationDirectory,
                         boolean deleteOldDatabase)
                  throws SQLException
Deprecated. use establishConnection(String dbFolder) instead

Sets the directory where matches will be stored in order to save memory. Matches can be stored in a database (default) or serialized files. If the database option is chosen (see setIsDB(Boolean isDB)) and no database created, the database will be created in the folder.

Parameters:
serializationDirectory - the path of the directory
deleteOldDatabase - if true, tries to delete the old database
Throws:
SQLException

removeMatch

public void removeMatch(String matchKey)
                 throws IllegalArgumentException,
                        SQLException,
                        IOException
Deprecated. it is advised to use the specific psm/peptide/protein method instead

Removes a match from the model.

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

removeSpectrumMatch

public void removeSpectrumMatch(String matchKey)
                         throws IllegalArgumentException,
                                SQLException,
                                IOException
Removes a spectrum match from the model.

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

removePeptideMatch

public void removePeptideMatch(String matchKey)
                        throws IllegalArgumentException,
                               SQLException,
                               IOException
Removes a peptide match from the model.

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

removeProteinMatch

public void removeProteinMatch(String matchKey)
                        throws IllegalArgumentException,
                               SQLException,
                               IOException
Removes a protein match from the model.

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

matchExists

public boolean matchExists(String matchKey)
Indicates whether a match indexed by the given key exists.

Parameters:
matchKey - the key of the match looked for
Returns:
a boolean indicating whether a match indexed by the given key exists

getSpectrumMatch

public SpectrumMatch getSpectrumMatch(String spectrumKey)
                               throws IllegalArgumentException,
                                      SQLException,
                                      IOException,
                                      ClassNotFoundException
Returns a spectrum match.

Parameters:
spectrumKey - the key of the match
Returns:
the desired match
Throws:
IllegalArgumentException - exception thrown whenever an error occurred while retrieving the match
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

getPeptideMatch

public PeptideMatch getPeptideMatch(String peptideKey)
                             throws IllegalArgumentException,
                                    SQLException,
                                    IOException,
                                    ClassNotFoundException
Returns a peptide match.

Parameters:
peptideKey - the key of the match
Returns:
the desired match
Throws:
IllegalArgumentException - exception thrown whenever an error occurred while retrieving the match
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

getProteinMatch

public ProteinMatch getProteinMatch(String proteinKey)
                             throws IllegalArgumentException,
                                    SQLException,
                                    IOException,
                                    ClassNotFoundException
Returns a protein match.

Parameters:
proteinKey - the key of the match
Returns:
the desired match
Throws:
IllegalArgumentException - exception thrown whenever an error occurred while retrieving the match
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

getProteinIdentification

public ArrayList<String> getProteinIdentification()
Returns a list of the keys of all encountered proteins.

Returns:
the corresponding identification results

getPeptideIdentification

public ArrayList<String> getPeptideIdentification()
Returns a list of the keys of all encountered peptides.

Returns:
the corresponding identification results

getSpectrumIdentification

public ArrayList<String> getSpectrumIdentification()
Deprecated. use file specific names instead

Returns a list of the keys of all encountered psms.

Returns:
the corresponding identification results

getSpectrumIdentification

public ArrayList<String> getSpectrumIdentification(String spectrumFile)
Returns the spectrum identifications for a given spectrum file name.

Parameters:
spectrumFile - the name of the spectrum file
Returns:
the corresponding list of identifications

getSpectrumIdentificationMap

public HashMap<String,ArrayList<String>> getSpectrumIdentificationMap()
Returns the keys of all identified spectra indexed by the spectrum file.

Returns:
the keys of all identified spectra indexed by the spectrum file

addSpectrumMatch

public void addSpectrumMatch(SpectrumMatch newMatch)
                      throws FileNotFoundException,
                             IOException,
                             IllegalArgumentException,
                             SQLException,
                             ClassNotFoundException
Adds a spectrum match to the identification.

Parameters:
newMatch - the new match
Throws:
FileNotFoundException - exception thrown whenever an error occurred while saving the file
IOException - exception thrown whenever an error occurred while saving the file
IllegalArgumentException - exception thrown whenever an error occurred while saving the file
SQLException - exception thrown whenever an error occurred while saving the file
ClassNotFoundException - exception thrown whenever an error occurred while saving the file

buildPeptidesAndProteins

public void buildPeptidesAndProteins(WaitingHandler waitingHandler)
                              throws IllegalArgumentException,
                                     SQLException,
                                     IOException,
                                     ClassNotFoundException
Creates the peptides and protein instances based on the spectrum matches. Note that the attribute bestAssumption should be set for every spectrum match at this point. This operation will be very slow if the cache is already full.

Parameters:
waitingHandler - the waiting handler displaying the progress. Can be null. The progress will be displayed as secondary.
Throws:
IllegalArgumentException
SQLException
IOException
ClassNotFoundException

buildPeptidesAndProteins

public void buildPeptidesAndProteins(String spectrumMatchKey)
                              throws IllegalArgumentException,
                                     SQLException,
                                     IOException,
                                     ClassNotFoundException
Creates the peptides and protein instances based on the given spectrum match. Note that the attribute bestAssumption should be set for every spectrum match at this point. This operation will be very slow if the cache is already full.

Parameters:
spectrumMatchKey - The key of the spectrum match to add
Throws:
IllegalArgumentException
SQLException
ClassNotFoundException
IOException

addSpectrumMatch

public void addSpectrumMatch(Set<SpectrumMatch> spectrumMatches)
                      throws FileNotFoundException,
                             IOException,
                             IllegalArgumentException,
                             SQLException,
                             ClassNotFoundException
Add a set of spectrumMatches to the model.

Parameters:
spectrumMatches - The spectrum matches
Throws:
FileNotFoundException - exception thrown whenever an error occurred while saving the file
IOException - exception thrown whenever an error occurred while saving the file
IllegalArgumentException - exception thrown whenever an error occurred while saving the file
SQLException - exception thrown whenever an error occurred while saving the file
ClassNotFoundException - exception thrown whenever an error occurred while saving the file

getMethodUsed

public int getMethodUsed()
Getter for the identification method used.

Returns:
the identification method used

getProteinMap

public HashMap<String,ArrayList<String>> getProteinMap()
Returns a map of all the protein matches which can be ascribed to a protein indexed by its accession.

Returns:
a map of all the protein matches which can be ascribed to a protein indexed by its accession.

getFileName

public String getFileName(String key)
Deprecated. use the database methods instead

Returns the name of the file to use for serialization/deserialization.

Parameters:
key - the key of the match
Returns:
the name of the corresponding file

isDB

public Boolean isDB()
Indicates whether the identification matches should be stored in a database (true, default value) or serialized files (false, deprecated default).

Returns:
a boolean indicating whether the identification matches should be stored in a database or serialized files

setIsDB

public void setIsDB(Boolean isDB)
Sets whether the identification matches should be stored in a database or serialized files.

Parameters:
isDB - a boolean indicating whether the identification matches should be stored in a database or serialized files

close

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

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

getMatchType

public IdentificationMatch.MatchType getMatchType(String matchKey)
Returns the kind of match pointed by the given key in the identification mappings. Null if missing from the mapping.

Parameters:
matchKey - the match key
Returns:
the kind of match

establishConnection

public void establishConnection(String dbFolder,
                                boolean deleteOldDatabase,
                                ObjectsCache objectsCache)
                         throws SQLException
Establishes a 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

convert

public void convert(WaitingHandler waitingHandler,
                    String newDirectory,
                    String newName,
                    ObjectsCache objectsCache)
             throws FileNotFoundException,
                    IOException,
                    ClassNotFoundException,
                    SQLException
Converts a serlialization based structure into a database based one. Replaces the space separation by the standard separator.

Parameters:
waitingHandler - the waiting handler
newDirectory - the new directory where to store the data
newName -
objectsCache -
Throws:
FileNotFoundException - exception thrown whenever a file is not found
IOException - exception thrown whenever an error occurred while reading/writing a file
ClassNotFoundException - exception thrown whenever an error occurred while deserializing a match
SQLException - exception thrown whenever an error occurred while interacting with the database

updateSpectrumMapping

public void updateSpectrumMapping()
Converts the old spectrum keys structure into the mapped version.


getDefaultReference

public static String getDefaultReference(String experimentReference,
                                         String sampleReference,
                                         int replicateNumber)
Returns the default reference for an identification

Parameters:
experimentReference - the experiment reference
sampleReference - the sample reference
replicateNumber - the replicate number
Returns:
the default reference


Copyright © 2012. All Rights Reserved.