org.fhcrc.cpl.viewer.feature
Class Feature

java.lang.Object
  extended by org.fhcrc.cpl.viewer.feature.Spectrum.Peak
      extended by org.fhcrc.cpl.viewer.feature.Feature
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
FeatureAsMap

public class Feature
extends Spectrum.Peak
implements java.lang.Cloneable

Copyright (C) 2004 Fred Hutchinson Cancer Research Center. All Rights Reserved. User: migra Date: Apr 26, 2005 Time: 2:55:28 PM


Nested Class Summary
static class Feature.IntensityDescComparator
           
static class Feature.MassAscComparator
           
static class Feature.MzAscComparator
           
static class Feature.MzDistAscComparator
           
static class Feature.MzScanAscComparator
           
static class Feature.PeaksKLComparatorDesc
          Compare features based on "quality".
static class Feature.ScanAscComparator
           
static class Feature.ScanChargeMzAscComparator
          This one is useful for associating equivalent features in multiple files with each other, through equivalent ordering
 
Field Summary
protected  java.util.Map<java.lang.String,java.lang.Object> _propertyMap
           
protected  boolean accurateMZ
           
 int charge
           
 int chargeStates
           
 Spectrum.Peak[] comprised
           
protected  java.lang.String description
           
 float dist
           
 int intensityLeadingPeaks
           
 int intensityTrailingPeaks
           
 float[] intensityWindow
           
 float kl
           
 float mass
           
protected  org.fhcrc.cpl.toolbox.proteomics.ModifiedAminoAcid[] mModifiedAminoAcids
           
static float MZ_RANGE
           
 float mzPeak0
           
 Feature next
           
 int peaks
           
 int scanCount
           
 int scanFirst
           
 int scanLast
           
 boolean skippedPeaks
           
 float time
           
 float totalIntensity
           
 
Fields inherited from class org.fhcrc.cpl.viewer.feature.Spectrum.Peak
background, excluded, intensity, median, mz, scan
 
Constructor Summary
Feature()
           
Feature(Feature feature)
           
Feature(int scan, float mz, float intensity)
           
Feature(int scan, int scanFirst, int scanLast, float mz, float intensity, int charge, float kl, float totalIntensity)
           
Feature(Spectrum.Peak p)
           
 
Method Summary
 void addFeatureToRange(Feature feature)
           
 void afterPopulate()
           
 float calculateFeatureIntensityInRange(MSRun run, int mzWindowSize, org.apache.commons.lang.math.IntRange scanRange, int resamplingFrequency)
          dhmay adding 01/05/2006 Start with an array of scans "MSScan[] scans", "_mzRange" set to a FloatRange indicating the range of mz values to consider, and a float "mz" set to the particular monoistopic mz of the feature under consideration.
 java.lang.Object clone()
           
 boolean ContainsPeak(Spectrum.Peak p)
           
 FeatureExtraInformationDef[] determineExtraInformationTypes()
          Query the properties set on this Feature to determine what extra info types it has.
 boolean equals(java.lang.Object o)
          This equals() implementation is based only on the _known_ fields of Feature.
static org.apache.commons.lang.math.IntRange findOverlappingScanRange(Feature feature1, Feature feature2)
          Helper method to find the overlap between the scan ranges of two features
 java.lang.Object get(java.lang.Object propertyName)
           
 int getCharge()
           
 int getChargeStates()
           
 java.lang.String getDescription()
           
 double getDoubleProperty(java.lang.String propertyName, double defaultValue)
           
static java.lang.String getFeatureHeader(FeatureExtraInformationDef[] extraInfoToDisplay)
           
 float getFloatProperty(java.lang.String propertyName, float defaultValue)
           
 int getIntProperty(java.lang.String propertyName, int defaultValue)
           
 float getKl()
           
 float getMass()
           
protected static org.fhcrc.cpl.toolbox.FloatRange getMZRange(float mz, int mzWindow)
          A helper method to get a FloatRange of a certain size around a point
 int getPeaks()
           
 java.lang.Object getProperty(java.lang.String propertyName)
          Get a property of this feature.
 java.lang.Object getProperty(java.lang.String propertyName, java.lang.Object defaultValue)
          Get a property of this feature.
 java.util.Map<java.lang.String,java.lang.Object> getPropertyMap()
           
 int getScanCount()
           
 int getScanFirst()
           
 int getScanLast()
           
 java.lang.String getStringProperty(java.lang.String propertyName, java.lang.String defaultValue)
           
 float getSumSquaresDist()
           
 float getTime()
           
 float getTotalIntensity()
           
 int hashCode()
          Needs to be defined when redefining equals.
 boolean hasProperty(java.lang.String propertyName)
          Check to see if a given property is on the allowed list This is no longer used -- allowing any property to be set
 boolean isAccurateMZ()
           
 boolean isFeatureInRange(Feature feature)
           
 boolean isFeatureInRange(Feature feature, int maxScanGap, float mzGap)
           
 boolean isPropertySet(java.lang.String propertyName)
          Indicates whether a given property is set for this feature
 void setAccurateMZ(boolean accurateMZ)
           
 void setCharge(int charge)
           
 void setChargeStates(int chargeStates)
           
 void setDescription(java.lang.String description)
           
 void setKl(float kl)
           
 void setMass(float mass)
           
 void setMz(float mz)
           
 void setPeaks(int peaks)
           
 void setProperty(java.lang.String propertyName, java.lang.Object propertyValue)
          Set a property of this feature, initializing the property map if necessary.
 void setScanCount(int scanCount)
           
 void setScanFirst(int scanFirst)
           
 void setScanLast(int scanLast)
           
 void setSumSquaresDist(float dist)
           
 void setTime(float time)
           
 void setTotalIntensity(float totalIntensity)
           
 java.lang.String toString()
          no-arg toString() doesn't display any extra data
 java.lang.String toString(FeatureExtraInformationDef[] extraInfoToDisplay)
          In addition to basic fields, displays the extra info it's told to
 java.lang.Object unsetProperty(java.lang.String propertyName)
          Unset a property and return the old value if there was one
 void updateMass()
          Make the mass agree with the m/z.
 void updateMz()
          Make the m/z agree with the mass.
 
Methods inherited from class org.fhcrc.cpl.viewer.feature.Spectrum.Peak
getBackground, getIntensity, getMedian, getMz, getScan, setBackground, setIntensity, setMedian, setScan
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

time

public float time

mass

public float mass

charge

public int charge

accurateMZ

protected boolean accurateMZ

kl

public float kl

dist

public float dist

peaks

public int peaks

skippedPeaks

public boolean skippedPeaks

chargeStates

public int chargeStates

description

protected java.lang.String description

scanFirst

public int scanFirst

scanLast

public int scanLast

totalIntensity

public float totalIntensity

scanCount

public int scanCount

MZ_RANGE

public static float MZ_RANGE

mzPeak0

public float mzPeak0

comprised

public Spectrum.Peak[] comprised

next

public Feature next

intensityLeadingPeaks

public int intensityLeadingPeaks

intensityTrailingPeaks

public int intensityTrailingPeaks

intensityWindow

public float[] intensityWindow

_propertyMap

protected java.util.Map<java.lang.String,java.lang.Object> _propertyMap

mModifiedAminoAcids

protected org.fhcrc.cpl.toolbox.proteomics.ModifiedAminoAcid[] mModifiedAminoAcids
Constructor Detail

Feature

public Feature()

Feature

public Feature(Spectrum.Peak p)

Feature

public Feature(Feature feature)

Feature

public Feature(int scan,
               float mz,
               float intensity)

Feature

public Feature(int scan,
               int scanFirst,
               int scanLast,
               float mz,
               float intensity,
               int charge,
               float kl,
               float totalIntensity)
Method Detail

determineExtraInformationTypes

public FeatureExtraInformationDef[] determineExtraInformationTypes()
Query the properties set on this Feature to determine what extra info types it has. This isn't just a getter, it takes a small amount of time

Returns:

afterPopulate

public void afterPopulate()

updateMass

public void updateMass()
Make the mass agree with the m/z. Note: this method USED to subtract out the mass of the light label, for isotopically labeled peptides. That no longer is the case. dhmay updating 7/29/2008 to handle negatively charged ions


updateMz

public void updateMz()
Make the m/z agree with the mass. Note: this method USED to subtract out the mass of the light label, for isotopically labeled peptides. That no longer is the case. dhmay updating 7/29/2008 to handle negatively charged ions


isFeatureInRange

public boolean isFeatureInRange(Feature feature)

isFeatureInRange

public boolean isFeatureInRange(Feature feature,
                                int maxScanGap,
                                float mzGap)

addFeatureToRange

public void addFeatureToRange(Feature feature)

getFeatureHeader

public static java.lang.String getFeatureHeader(FeatureExtraInformationDef[] extraInfoToDisplay)

toString

public java.lang.String toString()
no-arg toString() doesn't display any extra data

Overrides:
toString in class Spectrum.Peak
Returns:

toString

public java.lang.String toString(FeatureExtraInformationDef[] extraInfoToDisplay)
In addition to basic fields, displays the extra info it's told to

Parameters:
extraInfoToDisplay -
Returns:

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

getScanCount

public int getScanCount()

setScanCount

public void setScanCount(int scanCount)

getScanFirst

public int getScanFirst()

setScanFirst

public void setScanFirst(int scanFirst)

getScanLast

public int getScanLast()

setScanLast

public void setScanLast(int scanLast)

getTotalIntensity

public float getTotalIntensity()

setTotalIntensity

public void setTotalIntensity(float totalIntensity)

hashCode

public int hashCode()
Needs to be defined when redefining equals. Seems likely to be unique... There are definitely pieces of code that depend on this method NOT hashing features with the same scan, mz and intensity but different charge/KL to the same value (FeatureStrategyPeakClusters). There may or may not be code out there that depends on this method hashing things that agree on all these values, but have other values that are different, hashing to the same value. TODO: make this agree with equals()

Overrides:
hashCode in class Spectrum.Peak

equals

public boolean equals(java.lang.Object o)
This equals() implementation is based only on the _known_ fields of Feature. So if two fields agree in all those fields but disagree in their extra info, they will be considered equal.

Overrides:
equals in class Spectrum.Peak
Parameters:
o -
Returns:

setMz

public void setMz(float mz)
Overrides:
setMz in class Spectrum.Peak

getMass

public float getMass()

setMass

public void setMass(float mass)

getCharge

public int getCharge()

setCharge

public void setCharge(int charge)

getKl

public float getKl()

setKl

public void setKl(float kl)

getPeaks

public int getPeaks()

setPeaks

public void setPeaks(int peaks)

getDescription

public java.lang.String getDescription()

setDescription

public void setDescription(java.lang.String description)

getChargeStates

public int getChargeStates()

setChargeStates

public void setChargeStates(int chargeStates)

getTime

public float getTime()

setTime

public void setTime(float time)

getSumSquaresDist

public float getSumSquaresDist()

setSumSquaresDist

public void setSumSquaresDist(float dist)

ContainsPeak

public boolean ContainsPeak(Spectrum.Peak p)

isAccurateMZ

public boolean isAccurateMZ()

setAccurateMZ

public void setAccurateMZ(boolean accurateMZ)

getMZRange

protected static org.fhcrc.cpl.toolbox.FloatRange getMZRange(float mz,
                                                             int mzWindow)
A helper method to get a FloatRange of a certain size around a point

Parameters:
mz -
mzWindow -
Returns:
a range of size mzWindow*2 around mz

calculateFeatureIntensityInRange

public float calculateFeatureIntensityInRange(MSRun run,
                                              int mzWindowSize,
                                              org.apache.commons.lang.math.IntRange scanRange,
                                              int resamplingFrequency)
dhmay adding 01/05/2006 Start with an array of scans "MSScan[] scans", "_mzRange" set to a FloatRange indicating the range of mz values to consider, and a float "mz" set to the particular monoistopic mz of the feature under consideration.

Parameters:
run -
mzWindowSize -
scanRange -
resamplingFrequency -
Returns:
calculated intensity

findOverlappingScanRange

public static org.apache.commons.lang.math.IntRange findOverlappingScanRange(Feature feature1,
                                                                             Feature feature2)
Helper method to find the overlap between the scan ranges of two features

Parameters:
feature1 -
feature2 -
Returns:
the overlap between the scan ranges of the two features. If no overlap, returns null

hasProperty

public boolean hasProperty(java.lang.String propertyName)
Check to see if a given property is on the allowed list This is no longer used -- allowing any property to be set

Parameters:
propertyName -
Returns:

getPropertyMap

public java.util.Map<java.lang.String,java.lang.Object> getPropertyMap()

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.Object propertyValue)
Set a property of this feature, initializing the property map if necessary. If the value is of type String,

Parameters:
propertyName -
propertyValue -

unsetProperty

public java.lang.Object unsetProperty(java.lang.String propertyName)
Unset a property and return the old value if there was one

Parameters:
propertyName -

isPropertySet

public boolean isPropertySet(java.lang.String propertyName)
Indicates whether a given property is set for this feature

Parameters:
propertyName -
Returns:

getProperty

public java.lang.Object getProperty(java.lang.String propertyName)
Get a property of this feature. If not set, return null

Parameters:
propertyName -
Returns:

get

public java.lang.Object get(java.lang.Object propertyName)

getProperty

public java.lang.Object getProperty(java.lang.String propertyName,
                                    java.lang.Object defaultValue)
Get a property of this feature. If not set, return defaultValue

Parameters:
propertyName -
Returns:

getIntProperty

public int getIntProperty(java.lang.String propertyName,
                          int defaultValue)

getDoubleProperty

public double getDoubleProperty(java.lang.String propertyName,
                                double defaultValue)

getFloatProperty

public float getFloatProperty(java.lang.String propertyName,
                              float defaultValue)

getStringProperty

public java.lang.String getStringProperty(java.lang.String propertyName,
                                          java.lang.String defaultValue)


Fred Hutchinson Cancer Research Center