peakml
Class Centroid

java.lang.Object
  extended by peakml.Annotatable
      extended by peakml.IPeak
          extended by peakml.Peak
              extended by peakml.Centroid

public class Centroid
extends Peak

Implementation of a centroid or data-point in a mass spectrometry spectrum or profile. This class keeps track of a single mass, intensity and optional scanid value, which makes up a single data-point in a measurement. It's been chosen to mis-use the centroid value for a data-point as they are essential the same thing. The actual data associated to a Centroid instance is stored in a PeakData instance.

The centroid is the smallest (indivisible) component of mass spectrometry data.


Nested Class Summary
static class Centroid.Factory
          Factory for creating a Centroid instance.
 
Nested classes/interfaces inherited from class peakml.IPeak
IPeak.AnnotationAscending, IPeak.AnnotationDescending, IPeak.MatchCompare<Type>, IPeak.RelationCompare<Type>
 
Field Summary
static PeakData.PeakFactory<Centroid> factory
          Static instance for the factory, so not everybody will need to produce one
 
Fields inherited from class peakml.IPeak
relationid, sort_intensity_ascending, sort_intensity_descending, sort_mass_ascending, sort_mass_descending, sort_patternid_ascending, sort_patternid_descending, sort_profileid_ascending, sort_profileid_descending, sort_retentiontime_ascending, sort_retentiontime_descending, sort_scanid_ascending, sort_scanid_descending
 
Constructor Summary
Centroid(PeakData<Centroid> peakdata, int index)
          Constructs a new Centroid instance linked to the given PeakData instance.
 
Method Summary
 double getIntensity()
          Retrieves the measured intensity for this peak.
 double getMass()
          Retrieves the mass of this peak.
 int getMeasurementID()
          Returns an optional measurement-id for this peak.
 int getPatternID()
          Returns an optional id for the peak.
 double getRetentionTime()
          Retrieves the retention time for this peak.
 int getScanID()
          Retrieves the scan-id for this peak.
 Signal getSignal()
          Calculates the signal for this IPeak object.
 void setIntensity(double intensity)
          Sets the intensity of this peak, for more information on mass see IPeak.getIntensity().
 void setMass(double mass)
          Sets the mass of this peak, for more information on mass see IPeak.getMass().
 void setMeasurementID(int id)
          Sets the profile-id of this peak, for more information on mass see IPeak.getMeasurementID().
 void setPatternID(int id)
          Sets the pattern-id of this peak, for more information on mass see IPeak.getPatternID().
 void setRetentionTime(double retentiontime)
          Sets the retention time for this peak, for more information on retention time see IPeak.setRetentionTime(double).
 void setScanID(int scan)
          Sets the scan-id for this peak, for more information on scan-id see IPeak.getScanID().
 
Methods inherited from class peakml.IPeak
findRelatedPeaks, getBestPeakOnMass, getBestPeakOnRT, match, match, peaksOfMeasurements, sha1, unpack
 
Methods inherited from class peakml.Annotatable
addAnnotation, addAnnotation, addAnnotation, addAnnotation, addAnnotation, addAnnotations, getAnnotation, getAnnotations, removeAllAnnotations, removeAnnotation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

public static PeakData.PeakFactory<Centroid> factory
Static instance for the factory, so not everybody will need to produce one

Constructor Detail

Centroid

public Centroid(PeakData<Centroid> peakdata,
                int index)
Constructs a new Centroid instance linked to the given PeakData instance. The given index is used to find the correct data in the collection of peaks contained in the PeakData instance.

Parameters:
peakdata - A PeakData instance containing all the data.
index - The index indicating the location of the data in the PeakData instance.
Method Detail

getMass

public double getMass()
Description copied from class: IPeak
Retrieves the mass of this peak. For a single peak implementation this would be the real mass, but for a chromatographic peak for example this would consist of the mean of a cluster of peaks.

Specified by:
getMass in class IPeak
Returns:
The mass of the peak.

setMass

public void setMass(double mass)
Description copied from class: IPeak
Sets the mass of this peak, for more information on mass see IPeak.getMass(). It is possible that the class implementing this interface does not support this method.

Specified by:
setMass in class IPeak
Parameters:
mass - The new mass for this peak.

getIntensity

public double getIntensity()
Description copied from class: IPeak
Retrieves the measured intensity for this peak. For a single peak implementation this would be the real measured intensity, but for a chromatographic peak for example this would consist of the mean measured intensity for a cluster of peaks.

Specified by:
getIntensity in class IPeak
Returns:
The measured intensity of the peak.

setIntensity

public void setIntensity(double intensity)
Description copied from class: IPeak
Sets the intensity of this peak, for more information on mass see IPeak.getIntensity(). It is possible that the class implementing this interface does not support this method.

Specified by:
setIntensity in class IPeak
Parameters:
intensity - The new intensity for this peak.

getScanID

public int getScanID()
Description copied from class: IPeak
Retrieves the scan-id for this peak. For a single peak implementation this would be the scan at which it was measured, but for a chromatographic peak for example this would be the scan with the most intense peak.

Specified by:
getScanID in class IPeak
Returns:
The scan at which the peak was measured.

setScanID

public void setScanID(int scan)
Description copied from class: IPeak
Sets the scan-id for this peak, for more information on scan-id see IPeak.getScanID(). It is possible that the class implementing this interface does not support this method.

Specified by:
setScanID in class IPeak
Parameters:
scan - The new scan for this peak.

getRetentionTime

public double getRetentionTime()
Description copied from class: IPeak
Retrieves the retention time for this peak. The retention time is closely linked to the scan-id, which is the index or order at which a particular measurement was made. The time is expressed in seconds (all parsers make sure the time-value stored in a file is converted to this convention) and can easily be converted into minutes and seconds with:
 double rt = peak.getRetentionTime();
 int minutes = (int) (rt / 60);
 int seconds = (int) (rt % 60);
 

Specified by:
getRetentionTime in class IPeak
Returns:
The retention time at which the peak was measured.

setRetentionTime

public void setRetentionTime(double retentiontime)
Description copied from class: IPeak
Sets the retention time for this peak, for more information on retention time see IPeak.setRetentionTime(double). It is possible that the class implementing this interface does not support this method.

Specified by:
setRetentionTime in class IPeak
Parameters:
retentiontime - The new retention time for this peak.

getMeasurementID

public int getMeasurementID()
Description copied from class: IPeak
Returns an optional measurement-id for this peak. This is a convenience mechanism for locating the measurement-information for this peak in the Header.

Specified by:
getMeasurementID in class IPeak
Returns:
The profile-id of this peak.

setMeasurementID

public void setMeasurementID(int id)
Description copied from class: IPeak
Sets the profile-id of this peak, for more information on mass see IPeak.getMeasurementID(). It is possible that the class implementing this interface does not support this method.

Specified by:
setMeasurementID in class IPeak
Parameters:
id - The new profile-id for this peak.

getPatternID

public int getPatternID()
Description copied from class: IPeak
Returns an optional id for the peak. This id can for example be used for peak sequence identification. Beware that this mechanism is highly volatile and can only be used in a single-threaded environment within a strictly controlled environment like a single function or a completely controlled application.

Specified by:
getPatternID in class IPeak
Returns:
The id of this peak.

setPatternID

public void setPatternID(int id)
Description copied from class: IPeak
Sets the pattern-id of this peak, for more information on mass see IPeak.getPatternID(). It is possible that the class implementing this interface does not support this method.

Specified by:
setPatternID in class IPeak
Parameters:
id - The new id for this peaks

getSignal

public Signal getSignal()
Description copied from class: IPeak
Calculates the signal for this IPeak object. For a single data-point this will be a signal of one element. For a collection of IPeaks it will be a compounded version.

Specified by:
getSignal in class IPeak
Returns:
The calculated signal.