Class Identification
java.lang.Object
com.compomics.util.experiment.personalization.ExperimentObject
com.compomics.util.experiment.identification.Identification
- All Implemented Interfaces:
Serializable
This class interacts with the back-end database to manage identification
objects.
Interacting with the back-end database might cause InterruptedException.
These exceptions are passed as runtime exceptions for methods returning
identification objects.
- Author:
- Marc Vaudel, Dominik Kopczynski
- See Also:
-
Field Summary
Fields inherited from class com.compomics.util.experiment.personalization.ExperimentObject
NO_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFraction(String fraction) Adds a fraction, fractions correspond to the PSM files names.voidAdds an object into the database.voidaddObjects(HashMap<Long, Object> objects, WaitingHandler waitingHandler, boolean displayProgress) Adds a list of objects into the database.voidaddPeptideMatch(long key, PeptideMatch peptideMatch) Adds a peptide match.voidaddPeptideMatches(HashMap<Long, Object> peptideMatches) Adds a peptide match.voidaddProteinMatch(long key, ProteinMatch proteinMatch) Adds a protein match.voidaddProteinMatches(HashMap<Long, Object> proteinMatches) Adds a protein match.voidaddSpectrumMatches(HashMap<Long, Object> spectrumMatches, WaitingHandler waitingHandler, boolean displayProgress) Adds a spectrum matches into the database.voidclose(boolean saveCache) Closes the database connection.booleancontains(long key) Checks if database contains a certain object.getClassObjects(Class className) Returns the keys of the objects of the given class,getClassObjects(Class className, String filters) Returns the keys of the objects of the given class,Returns the database directory.Returns the fractions.Returns the identification keys.intReturns the number of objects of a given classReturns the objects database used in this class.Returns a list of the keys of all encountered peptides.getPeptideMatch(long key) Returns the peptide match with the given key.getPeptideMatchesIterator(long[] peptideKeys, WaitingHandler waitingHandler) Returns a peptide matches iterator for a given key list.getPeptideMatchesIterator(WaitingHandler waitingHandler) Returns a peptide matches iterator for all PeptideMatches.Returns a list of the keys of all encountered proteins.Returns a map of all the protein matches which can be ascribed to a protein indexed by its accession.getProteinMatch(long key) Returns the protein match with the given key.getProteinMatches(long peptideKey) Returns the keys of the protein matches where a peptide can be found.getProteinMatchesIterator(long[] proteinKeys, WaitingHandler waitingHandler) Returns a protein matches iterator for a given key list.getProteinMatchesIterator(WaitingHandler waitingHandler) Returns a protein matches iterator for all PeptideMatches.Returns a map of the spectrum matches keys indexed by spectrum file name.Returns the keys of all the spectrum matches in the db.intReturns the number of spectrum identifications.getSpectrumMatch(long key) Returns the spectrum match with the given key.getSpectrumMatchesIterator(long[] spectrumMatches, WaitingHandler waitingHandler) Returns a spectrum matches iterator for a given key list.getSpectrumMatchesIterator(WaitingHandler waitingHandler) Returns a spectrum matches iterator for all SpectrumMatches.getSpectrumMatchesIterator(WaitingHandler waitingHandler, String filters) Returns a psm iterator for all SpectrumMatches.booleanIndicates whether the connection to the DB is active.voidloadObjects(Class className, WaitingHandler waitingHandler, boolean displayProgress) Loads all objects of the class in cache.voidloadObjects(ArrayList<Long> keyList, WaitingHandler waitingHandler, boolean displayProgress) Loads all objects of given keys in cache.voidremoveObject(long key) Removes an object from the database.voidremoveObjects(ArrayList<Long> keys, WaitingHandler waitingHandler, boolean displayProgress) Remove a list of objects from the database.retrieveObject(long longKey) Returns an array of all objects of a given list of keysretrieveObjects(Class className, WaitingHandler waitingHandler, boolean displayProgress) Returns an array of all objects of a given classretrieveObjects(Collection<Long> keyList, WaitingHandler waitingHandler, boolean displayProgress) Returns an array of all objects of a given list of keysvoidsetFractions(ArrayList<String> fractions) Sets the fractions.voidsetIdentificationKeys(IdentificationKeys identificationKeys) Sets the identification keys.voidupdateObject(long key, Object object) Updates an object in the database.Methods inherited from class com.compomics.util.experiment.personalization.ExperimentObject
addUrParam, asLong, clearParametersMap, getId, getUrParam, getUrParams, removeUrParam, setId, setUrParams
-
Constructor Details
-
Identification
public Identification()Empty default constructor -
Identification
Constructor.- Parameters:
objectsDB- The object database used to store the objects.
-
-
Method Details
-
getObjectsDB
Returns the objects database used in this class.- Returns:
- the objects database used in this class
-
getIdentificationKeys
Returns the identification keys.- Returns:
- the identification keys
-
setIdentificationKeys
Sets the identification keys.- Parameters:
identificationKeys- the identification keys
-
getSpectrumIdentification
Returns a map of the spectrum matches keys indexed by spectrum file name.- Returns:
- a map of the spectrum matches keys indexed by spectrum file name
-
getSpectrumIdentificationKeys
Returns the keys of all the spectrum matches in the db.- Returns:
- the keys of all the spectrum matches in the db
-
getSpectrumIdentificationSize
public int getSpectrumIdentificationSize()Returns the number of spectrum identifications.- Returns:
- the number of spectrum identifications
-
getNumber
Returns the number of objects of a given class- Parameters:
className- the class name of a given class- Returns:
- the number of objects
-
getClassObjects
Returns the keys of the objects of the given class,- Parameters:
className- the class- Returns:
- the keys of the objects
-
getClassObjects
Returns the keys of the objects of the given class,- Parameters:
className- the classfilters- the filters- Returns:
- the keys of the objects
-
loadObjects
public void loadObjects(Class className, WaitingHandler waitingHandler, boolean displayProgress) throws InterruptedException Loads all objects of the class in cache.- Parameters:
className- the class namewaitingHandler- the waiting handler allowing displaying progress and canceling the processdisplayProgress- boolean indicating whether the progress of this method should be displayed on the waiting handler- Throws:
InterruptedException- exception thrown if a threading error occurs while interacting with the database
-
loadObjects
public void loadObjects(ArrayList<Long> keyList, WaitingHandler waitingHandler, boolean displayProgress) throws InterruptedException Loads all objects of given keys in cache.- Parameters:
keyList- the list of keys of given objectswaitingHandler- the waiting handler allowing displaying progress and canceling the processdisplayProgress- boolean indicating whether the progress of this method should be displayed on the waiting handler- Throws:
InterruptedException- exception thrown if a threading error occurs while interacting with the database
-
retrieveObject
Returns an array of all objects of a given list of keys- Parameters:
longKey- the hash key- Returns:
- the objects
-
getSpectrumMatch
Returns the spectrum match with the given key.- Parameters:
key- the key of the match- Returns:
- the spectrum match with the given key
-
getPeptideMatch
Returns the peptide match with the given key.- Parameters:
key- the key of the match- Returns:
- the peptide match with the given key
-
getProteinMatch
Returns the protein match with the given key.- Parameters:
key- the key of the match- Returns:
- the protein match with the given key
-
retrieveObjects
public ArrayList<Object> retrieveObjects(Collection<Long> keyList, WaitingHandler waitingHandler, boolean displayProgress) Returns an array of all objects of a given list of keys- Parameters:
keyList- the key listwaitingHandler- the waiting handler allowing displaying progress and canceling the processdisplayProgress- boolean indicating whether the progress of this method should be displayed on the waiting handler- Returns:
- list of objects
-
retrieveObjects
public ArrayList<Object> retrieveObjects(Class className, WaitingHandler waitingHandler, boolean displayProgress) Returns an array of all objects of a given class- Parameters:
className- the class namewaitingHandler- the waiting handler allowing displaying progress and canceling the processdisplayProgress- boolean indicating whether the progress of this method should be displayed on the waiting handler- Returns:
- list of objects
-
addObject
Adds an object into the database.- Parameters:
key- the key of the objectobject- the object
-
addObjects
public void addObjects(HashMap<Long, Object> objects, WaitingHandler waitingHandler, boolean displayProgress) Adds a list of objects into the database.- Parameters:
objects- the objectwaitingHandler- the waiting handler allowing displaying progress and canceling the processdisplayProgress- boolean indicating whether the progress of this method should be displayed on the waiting handler
-
updateObject
Updates an object in the database.- Parameters:
key- the key of the objectobject- the object
-
removeObject
public void removeObject(long key) Removes an object from the database.- Parameters:
key- the key of the object
-
contains
public boolean contains(long key) Checks if database contains a certain object.- Parameters:
key- the key of the object- Returns:
- true if database contains a certain object otherwise false
-
removeObjects
public void removeObjects(ArrayList<Long> keys, WaitingHandler waitingHandler, boolean displayProgress) Remove a list of objects from the database.- Parameters:
keys- the list of object keyswaitingHandler- the waiting handler allowing displaying progress and canceling the processdisplayProgress- boolean indicating whether the progress of this method should be displayed on the waiting handler
-
getDatabaseDirectory
Returns the database directory.- Returns:
- the database directory
-
getProteinIdentification
Returns a list of the keys of all encountered proteins.- Returns:
- the corresponding identification results
-
getPeptideIdentification
Returns a list of the keys of all encountered peptides.- Returns:
- the corresponding identification results
-
addPeptideMatch
Adds a peptide match. If an exception occurs when saving to the db it is thrown as runtime exception.- Parameters:
key- the peptide match keypeptideMatch- the peptide match
-
addPeptideMatches
Adds a peptide match. If an exception occurs when saving to the db it is thrown as runtime exception.- Parameters:
peptideMatches- the peptide matches in a map
-
addSpectrumMatches
public void addSpectrumMatches(HashMap<Long, Object> spectrumMatches, WaitingHandler waitingHandler, boolean displayProgress) Adds a spectrum matches into the database.- Parameters:
spectrumMatches- the spectrum matcheswaitingHandler- the waiting handler allowing displaying progress and canceling the processdisplayProgress- boolean indicating whether the progress of this method should be displayed on the waiting handler
-
addProteinMatch
Adds a protein match. If an exception occurs when saving to the db it is thrown as runtime exception.- Parameters:
key- The match key.proteinMatch- The protein match.
-
addProteinMatches
Adds a protein match. If an exception occurs when saving to the db it is thrown as runtime exception.- Parameters:
proteinMatches- Map of the protein matches indexed by key.
-
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.
-
close
public void close(boolean saveCache) Closes the database connection.- Parameters:
saveCache- save the cache
-
isConnectionActive
public boolean isConnectionActive()Indicates whether the connection to the DB is active.- Returns:
- true if the connection to the DB is active
-
getProteinMatches
Returns the keys of the protein matches where a peptide can be found.- Parameters:
peptideKey- the peptide key- Returns:
- the keys of the protein matches
-
getSpectrumMatchesIterator
public SpectrumMatchesIterator getSpectrumMatchesIterator(long[] spectrumMatches, WaitingHandler waitingHandler) Returns a spectrum matches iterator for a given key list.- Parameters:
spectrumMatches- the keys of the spectra to iteratewaitingHandler- the waiting handler- Returns:
- a spectrum matches iterator
-
getSpectrumMatchesIterator
Returns a spectrum matches iterator for all SpectrumMatches.- Parameters:
waitingHandler- the waiting handler- Returns:
- a spectrum matches iterator
-
getSpectrumMatchesIterator
public SpectrumMatchesIterator getSpectrumMatchesIterator(WaitingHandler waitingHandler, String filters) Returns a psm iterator for all SpectrumMatches.- Parameters:
waitingHandler- the waiting handlerfilters- filters for the class- Returns:
- a peptide matches iterator
-
getPeptideMatchesIterator
public PeptideMatchesIterator getPeptideMatchesIterator(long[] peptideKeys, WaitingHandler waitingHandler) Returns a peptide matches iterator for a given key list.- Parameters:
peptideKeys- the keys of the peptides to iteratewaitingHandler- the waiting handler- Returns:
- a peptide matches iterator
-
getPeptideMatchesIterator
Returns a peptide matches iterator for all PeptideMatches.- Parameters:
waitingHandler- the waiting handler- Returns:
- a peptide matches iterator
-
getProteinMatchesIterator
public ProteinMatchesIterator getProteinMatchesIterator(long[] proteinKeys, WaitingHandler waitingHandler) Returns a protein matches iterator for a given key list.- Parameters:
proteinKeys- the keys of the peptides to iteratewaitingHandler- the waiting handler- Returns:
- a peptide matches iterator
-
getProteinMatchesIterator
Returns a protein matches iterator for all PeptideMatches.- Parameters:
waitingHandler- the waiting handler- Returns:
- a peptide matches iterator
-
addFraction
Adds a fraction, fractions correspond to the PSM files names. Fractions are ordered alphabetically upon adding of a new fraction.- Parameters:
fraction- the fraction name
-
getFractions
Returns the fractions.- Returns:
- the fractions
-
setFractions
Sets the fractions.- Parameters:
fractions- the fractions
-