Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

Feature.h (Maintainer: Clemens Groepl)

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // --------------------------------------------------------------------------
00005 //                   OpenMS Mass Spectrometry Framework
00006 // --------------------------------------------------------------------------
00007 //  Copyright (C) 2003-2008 -- Oliver Kohlbacher, Knut Reinert
00008 //
00009 //  This library is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU Lesser General Public
00011 //  License as published by the Free Software Foundation; either
00012 //  version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //  This library is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //  Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with this library; if not, write to the Free Software
00021 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 // --------------------------------------------------------------------------
00024 // $Maintainer: Clemens Groepl $
00025 // --------------------------------------------------------------------------
00026 
00027 #ifndef OPENMS_KERNEL_FEATURE_H
00028 #define OPENMS_KERNEL_FEATURE_H
00029 
00030 #include <OpenMS/KERNEL/Peak2D.h>
00031 #include <OpenMS/DATASTRUCTURES/ConvexHull2D.h>
00032 #include <OpenMS/METADATA/PeptideIdentification.h>
00033 
00034 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/ModelDescription.h>
00035 
00036 namespace OpenMS
00037 {
00038 
00066   class Feature
00067     : public Peak2D
00068   {
00069     public:
00071 
00072 
00073       enum { DIMENSION = 2 };
00075       typedef  DoubleReal QualityType;
00077       typedef Int ChargeType;
00079 
00083 
00084       inline Feature()
00085           : Peak2D(),
00086           overall_quality_(),
00087           convex_hulls_(),
00088           convex_hulls_modified_(true),
00089           convex_hull_(),
00090           charge_( 0 )
00091       {
00092         std::fill( qualities_, qualities_ + 2, 0 );
00093       }
00094 
00096       inline Feature( const Feature& feature )
00097           : Peak2D( feature ),
00098           overall_quality_( feature.overall_quality_ ),
00099           model_desc_( feature.model_desc_ ),
00100           convex_hulls_( feature.convex_hulls_ ),
00101           convex_hulls_modified_(feature.convex_hulls_modified_),
00102           convex_hull_( feature.convex_hull_ ),
00103           charge_( feature.charge_ ),
00104           identifications_( feature.identifications_ )
00105       {
00106         std::copy( feature.qualities_, feature.qualities_ + 2, qualities_ );
00107       }
00108 
00110       ~Feature()
00111       {
00112       }
00114 
00116 
00117 
00118       inline QualityType getOverallQuality() const
00119       {
00120         return overall_quality_;
00121       }
00123       inline void setOverallQuality( QualityType q )
00124       {
00125         overall_quality_ = q;
00126       }
00127 
00129       inline QualityType getQuality( UInt index ) const
00130       {
00131         OPENMS_PRECONDITION( index < 2, "Feature<2>:getQuality(UInt): index overflow!" );
00132         return qualities_[ index ];
00133       }
00135       inline void setQuality( UInt index, QualityType q )
00136       {
00137         OPENMS_PRECONDITION( index < 2, "Feature<2>:setQuality(UInt): index overflow!" );
00138         qualities_[ index ] = q;
00139       }
00140       
00142       inline const ModelDescription<2>& getModelDescription() const
00143       {
00144         return model_desc_;
00145       }
00147       inline ModelDescription<2>& getModelDescription()
00148       {
00149         return model_desc_;
00150       }
00152       inline void setModelDescription( const ModelDescription<2>& q )
00153       {
00154         model_desc_ = q;
00155       }
00157       
00159       inline const ChargeType& getCharge() const
00160       {
00161         return charge_;
00162       }
00164       inline void setCharge( const ChargeType& ch )
00165       {
00166         charge_ = ch;
00167       }
00168       
00170 
00171 
00172       inline const std::vector<ConvexHull2D>& getConvexHulls() const
00173       {
00174         return convex_hulls_;
00175       }
00177       inline std::vector<ConvexHull2D>& getConvexHulls()
00178       {
00179         convex_hulls_modified_ = true;
00180         return convex_hulls_;
00181       }
00183       inline void setConvexHulls( const std::vector<ConvexHull2D>& hulls )
00184       {
00185         convex_hulls_modified_ = true;
00186         convex_hulls_ = hulls;
00187       }
00193       ConvexHull2D& getConvexHull() const;
00194       
00196       bool encloses(DoubleReal rt, DoubleReal mz) const;
00198 
00200       Feature& operator = ( const Feature& rhs );
00201 
00203       bool operator == ( const Feature& rhs ) const;
00204 
00206       struct OverallQualityLess
00207             : std::binary_function < Feature, Feature, bool >
00208       {
00209         inline bool operator () ( Feature const & left, Feature const & right ) const
00210         {
00211           return ( left.getOverallQuality() < right.getOverallQuality() );
00212         }
00213         inline bool operator () ( Feature const & left, QualityType right ) const
00214         {
00215           return ( left.getOverallQuality() < right );
00216         }
00217         inline bool operator () ( QualityType left, Feature const & right ) const
00218         {
00219           return ( left < right.getOverallQuality() );
00220         }
00221         inline bool operator () ( QualityType left, QualityType right ) const
00222         {
00223           return ( left < right );
00224         }
00225       };
00226 
00228       inline const std::vector<PeptideIdentification>& getPeptideIdentifications() const
00229       {
00230         return identifications_;
00231       };
00232 
00234       inline std::vector<PeptideIdentification>& getPeptideIdentifications()
00235       {
00236         return identifications_;
00237       };
00238 
00240       inline void setPeptideIdentifications( const std::vector<PeptideIdentification>& identifications )
00241       {
00242         identifications_ = identifications;
00243       };
00244 
00245     protected:
00247       QualityType overall_quality_;
00249       QualityType qualities_[ 2 ];
00251       ModelDescription<2> model_desc_;
00253       std::vector<ConvexHull2D> convex_hulls_;
00255       mutable bool convex_hulls_modified_;
00257       mutable ConvexHull2D convex_hull_;
00259       ChargeType charge_;
00261       std::vector<PeptideIdentification> identifications_;
00262   };
00263 
00264 } // namespace OpenMS
00265 
00266 #endif // OPENMS_KERNEL_DFEATURE_H

Generated Tue Apr 1 15:36:34 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1