com.compomics.util.experiment.quantification
Class Quantification

java.lang.Object
  extended by com.compomics.util.experiment.personalization.ExperimentObject
      extended by com.compomics.util.experiment.quantification.Quantification
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
ReporterIonQuantification

public abstract class Quantification
extends ExperimentObject

This class contains quantification results. User: Marc Date: Nov 11, 2010 Time: 3:46:24 PM

See Also:
Serialized Form

Nested Class Summary
static class Quantification.QuantificationMethod
          The implemented quantification methods.
 
Field Summary
protected  boolean automatedMemoryManagement
          boolean indicating whether the memory management should be done automatically.
protected  int cacheSize
          The cache size in number of matches. 20000 by default: should be enough to contain a velos file.
static String EXTENTION
          Extention for a serialized hit. cuh for Compomics Utilities Hit.
protected  boolean inMemory
          boolean indicating whether the identification should be stored in memory or not.
protected  ArrayList<String> loadedMatches
          List of the loaded quantification matches with the most used matches in the end
protected  HashMap<String,Object> loadedMatchesMap
          Map of the loaded quantification matches
protected  ArrayList<String> longKeys
          Map of long keys which will be referenced by their index for file creation
protected  Quantification.QuantificationMethod methodUsed
          The quantification method used
protected  HashMap<String,Boolean> modifiedMatches
          Map indicating whether a quantification match is modified.
protected  ArrayList<String> peptideQuantification
          The peptide quantification
protected  ArrayList<String> proteinQuantification
          The protein quantification
protected  HashMap<String,ArrayList<String>> psmIDentificationToQuantification
          A convenience map indicating all psm quantifying an identified PSM
protected  String serializationDirectory
          the directory where matches will be serialized
protected  HashMap<String,HashMap<String,UrParameter>> urParameters
          Map of the user's parameters.
 
Constructor Summary
Quantification()
           
 
Method Summary
 void addPeptideQuantification(PeptideQuantification match)
          Add a peptide quantification match to the peptide quantification matches map if not already implemented.
 void addProteinQuantification(ProteinQuantification match)
          Add a protein quantification match to the peptide quantification matches map if not already implemented.
 void addPsmQuantification(PsmQuantification match)
          Add a spectrum quantification to the spectrum quantification matches map and overwrites if already implemented.
 void addQuantificationParameter(String key, UrParameter urParameter)
          adds a parameter with a corresponding quantification key which will be loaded in the memory.
 void buildPeptidesAndProteinQuantifications(Identification identification)
          Creates the peptides and protein quantification instances based on the identification and the psm quantification.
 void emptyCache(ProgressDialogX progressDialog)
          Empties the cache and serializes everything in the specified serialization folder
 int getCacheSize()
          Returns the cache size in number of matches
 String getFileName(String key)
          Returns the name of the file to use for serialization/deserialization
 Quantification.QuantificationMethod getMethodUsed()
          getter for the method used
 PeptideQuantification getPeptideMatch(String peptideKey)
          Returns a peptide quantification match
 ArrayList<String> getPeptideQuantification()
          This method retrieves the quantification result at the protein level
 ProteinQuantification getProteinMatch(String proteinKey)
          Returns a protein quantification match
 ArrayList<String> getProteinQuantification()
          This method retrieves the quantification result at the protein level
 HashMap<String,ArrayList<String>> getPsmIDentificationToQuantification()
          This method retrieves the quantification result at the protein level
 UrParameter getQuantificationParameter(String matchKey, UrParameter urParameter)
          Returns the personalization parameter of the given quantification
 String getSerializationDirectory()
          Returns the serialization directory
 PsmQuantification getSpectrumMatch(String spectrumKey)
          Returns a spectrum quantification match
 ArrayList<PsmQuantification> getSpectrumMatches(String identificationMatchKey)
          Returns a list of PSM quantification matches corresponding to the given psm identification key.
 boolean isAutomatedMemoryManagement()
          Returns whether the memory management is automated.
 boolean isInMemory()
          Indicates whether matches will be stored in memory
 boolean memoryCheck()
          Indicates whether the memory used by the application is lower than 99% of the heap size
 void removeQuantification(String quantificationKey)
          Removes a quantification from the model
 void save(File newFolder, ProgressDialogX progressDialog)
          Saves the identification matches in the desired folder
 void setAutomatedMemoryManagement(boolean automatedMemoryManagement)
          Sets whether the memory management should be automated
 void setCacheSize(int cacheSize)
          Sets the cache size
 void setInMemory(boolean inMemory)
          Sets whether matches shall be stored in memory
 void setMatchChanged(QuantificationMatch match)
          Indicates that a match was changed, it will thus be serialized again if needed.
 void setMethodUsed(Quantification.QuantificationMethod methodUsed)
          setter for the method used
 void setSerializationDirectory(String serializationDirectory)
          sets the serialization directory
 void updateCache()
          updates the cache according to the memory settings.
 
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

methodUsed

protected Quantification.QuantificationMethod methodUsed
The quantification method used


EXTENTION

public static final String EXTENTION
Extention for a serialized hit. cuh for Compomics Utilities Hit.

See Also:
Constant Field Values

cacheSize

protected int cacheSize
The cache size in number of matches. 20000 by default: should be enough to contain a velos file.


serializationDirectory

protected String serializationDirectory
the directory where matches will be serialized


inMemory

protected boolean inMemory
boolean indicating whether the identification should be stored in memory or not. True by default, the serialization directory should be set otherwise!


automatedMemoryManagement

protected boolean automatedMemoryManagement
boolean indicating whether the memory management should be done automatically. If true, the cache size will be extended to reach 90% of the available heap size when inMemory is wrong. True by default.


loadedMatchesMap

protected HashMap<String,Object> loadedMatchesMap
Map of the loaded quantification matches


loadedMatches

protected ArrayList<String> loadedMatches
List of the loaded quantification matches with the most used matches in the end


modifiedMatches

protected HashMap<String,Boolean> modifiedMatches
Map indicating whether a quantification match is modified. Only modified matches will be serialized.


urParameters

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


longKeys

protected ArrayList<String> longKeys
Map of long keys which will be referenced by their index for file creation


proteinQuantification

protected ArrayList<String> proteinQuantification
The protein quantification


peptideQuantification

protected ArrayList<String> peptideQuantification
The peptide quantification


psmIDentificationToQuantification

protected HashMap<String,ArrayList<String>> psmIDentificationToQuantification
A convenience map indicating all psm quantifying an identified PSM

Constructor Detail

Quantification

public Quantification()
Method Detail

getProteinQuantification

public ArrayList<String> getProteinQuantification()
This method retrieves the quantification result at the protein level

Returns:
quantification at the protein level

getPeptideQuantification

public ArrayList<String> getPeptideQuantification()
This method retrieves the quantification result at the protein level

Returns:
quantification at the protein level

getPsmIDentificationToQuantification

public HashMap<String,ArrayList<String>> getPsmIDentificationToQuantification()
This method retrieves the quantification result at the protein level

Returns:
quantification at the protein level

getMethodUsed

public Quantification.QuantificationMethod getMethodUsed()
getter for the method used

Returns:
the method used

setMethodUsed

public void setMethodUsed(Quantification.QuantificationMethod methodUsed)
setter for the method used

Parameters:
methodUsed - the method used

addQuantificationParameter

public void addQuantificationParameter(String key,
                                       UrParameter urParameter)
adds a parameter with a corresponding quantification 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

getQuantificationParameter

public UrParameter getQuantificationParameter(String matchKey,
                                              UrParameter urParameter)
Returns the personalization parameter of the given quantification

Parameters:
matchKey - the match key
urParameter - example of parameter to retrieve
Returns:
the personalization parameter

isAutomatedMemoryManagement

public boolean isAutomatedMemoryManagement()
Returns whether the memory management is automated.

Returns:
whether the memory management is automated.

setAutomatedMemoryManagement

public void setAutomatedMemoryManagement(boolean automatedMemoryManagement)
Sets whether the memory management should be automated

Parameters:
automatedMemoryManagement - a boolean indicating whether the memory management should be automated

getCacheSize

public int getCacheSize()
Returns the cache size in number of matches

Returns:
the cache size in number of matches

setCacheSize

public void setCacheSize(int cacheSize)
Sets the cache size

Parameters:
cacheSize - number of matches to allow in the cache size

isInMemory

public boolean isInMemory()
Indicates whether matches will be stored in memory

Returns:
a boolean indicating whether matches will be stored in memory

setInMemory

public void setInMemory(boolean inMemory)
Sets whether matches shall be stored in memory

Parameters:
inMemory - a boolean indicating whether matches shall be stored in memory

getSerializationDirectory

public String getSerializationDirectory()
Returns the serialization directory

Returns:
the serialization directory

setSerializationDirectory

public void setSerializationDirectory(String serializationDirectory)
sets the serialization directory

Parameters:
serializationDirectory - the path of the serialization directory

removeQuantification

public void removeQuantification(String quantificationKey)
Removes a quantification from the model

Parameters:
quantificationKey - the key of the match to remove

getSpectrumMatches

public ArrayList<PsmQuantification> getSpectrumMatches(String identificationMatchKey)
                                                throws Exception
Returns a list of PSM quantification matches corresponding to the given psm identification key.

Parameters:
identificationMatchKey - the key of the identification match
Returns:
the desired matches
Throws:
Exception - exception thrown whenever an error occurred while retrieving the match

getSpectrumMatch

public PsmQuantification getSpectrumMatch(String spectrumKey)
                                   throws Exception
Returns a spectrum quantification match

Parameters:
spectrumKey - the key of the spectrum match
Returns:
the desired match
Throws:
Exception - exception thrown whenever an error occurred while retrieving the match

getPeptideMatch

public PeptideQuantification getPeptideMatch(String peptideKey)
                                      throws Exception
Returns a peptide quantification match

Parameters:
peptideKey - the key of the match
Returns:
the desired match
Throws:
Exception - exception thrown whenever an error occurred while retrieving the match

getProteinMatch

public ProteinQuantification getProteinMatch(String proteinKey)
                                      throws Exception
Returns a protein quantification match

Parameters:
proteinKey - the key of the match
Returns:
the desired match
Throws:
Exception - exception thrown whenever an error occurred while retrieving the match

addPsmQuantification

public void addPsmQuantification(PsmQuantification match)
                          throws Exception
Add a spectrum quantification to the spectrum quantification matches map and overwrites if already implemented.

Parameters:
match - the new spectrum match
Throws:
Exception

addPeptideQuantification

public void addPeptideQuantification(PeptideQuantification match)
                              throws Exception
Add a peptide quantification match to the peptide quantification matches map if not already implemented.

Parameters:
match - the new spectrum match
Throws:
Exception

addProteinQuantification

public void addProteinQuantification(ProteinQuantification match)
                              throws Exception
Add a protein quantification match to the peptide quantification matches map if not already implemented.

Parameters:
match - the new spectrum match
Throws:
Exception

updateCache

public void updateCache()
                 throws Exception
updates the cache according to the memory settings.

Throws:
Exception - exception thrown whenever an error occurred while serializing a match

memoryCheck

public boolean memoryCheck()
Indicates whether the memory used by the application is lower than 99% of the heap size

Returns:
a boolean indicating whether the memory used by the application is lower than 99% of the heap

buildPeptidesAndProteinQuantifications

public void buildPeptidesAndProteinQuantifications(Identification identification)
                                            throws Exception
Creates the peptides and protein quantification instances based on the identification and the psm quantification. This operation will be extremely slow if the cache is already full.

Parameters:
identification -
Throws:
Exception

emptyCache

public void emptyCache(ProgressDialogX progressDialog)
                throws Exception
Empties the cache and serializes everything in the specified serialization folder

Parameters:
progressDialog -
Throws:
Exception - exception thrown whenever an error occurred while serializing a match

setMatchChanged

public void setMatchChanged(QuantificationMatch match)
                     throws Exception
Indicates that a match was changed, it will thus be serialized again if needed.

Parameters:
match -
Throws:
Exception

save

public void save(File newFolder,
                 ProgressDialogX progressDialog)
          throws Exception
Saves the identification matches in the desired folder

Parameters:
newFolder - the new folder
progressDialog - a progress dialog to display the progress (can be null)
Throws:
Exception - Exception thrown whenever a problem occurred during the serialization process

getFileName

public String getFileName(String key)
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


Copyright © 2012. All Rights Reserved.