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

LayerData.h

Go to the documentation of this file.
00001 // --------------------------------------------------------------------------
00002 //                   OpenMS -- Open-Source Mass Spectrometry
00003 // --------------------------------------------------------------------------
00004 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
00005 // ETH Zurich, and Freie Universitaet Berlin 2002-2012.
00006 //
00007 // This software is released under a three-clause BSD license:
00008 //  * Redistributions of source code must retain the above copyright
00009 //    notice, this list of conditions and the following disclaimer.
00010 //  * Redistributions in binary form must reproduce the above copyright
00011 //    notice, this list of conditions and the following disclaimer in the
00012 //    documentation and/or other materials provided with the distribution.
00013 //  * Neither the name of any author or any participating institution
00014 //    may be used to endorse or promote products derived from this software
00015 //    without specific prior written permission.
00016 // For a full list of authors, refer to the file AUTHORS.
00017 // --------------------------------------------------------------------------
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
00022 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00024 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00025 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00026 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00027 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00028 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // --------------------------------------------------------------------------
00031 // $Maintainer: Timo Sachsenberg $
00032 // $Authors: Marc Sturm $
00033 // --------------------------------------------------------------------------
00034 
00035 #ifndef OPENMS_VISUAL_LAYERDATA_H
00036 #define OPENMS_VISUAL_LAYERDATA_H
00037 
00038 #include <OpenMS/KERNEL/MSExperiment.h>
00039 #include <OpenMS/KERNEL/FeatureMap.h>
00040 #include <OpenMS/KERNEL/ConsensusMap.h>
00041 #include <OpenMS/DATASTRUCTURES/String.h>
00042 #include <OpenMS/VISUAL/MultiGradient.h>
00043 #include <OpenMS/VISUAL/ANNOTATION/Annotations1DContainer.h>
00044 #include <OpenMS/FILTERING/DATAREDUCTION/DataFilters.h>
00045 
00046 #include <boost/shared_ptr.hpp>
00047 
00048 #include <vector>
00049 #include <bitset>
00050 
00051 namespace OpenMS
00052 {
00058   class LayerData
00059   {
00060 public:
00063 
00064     enum DataType
00065     {
00066       DT_PEAK,                
00067       DT_FEATURE,         
00068       DT_CONSENSUS,       
00069       DT_CHROMATOGRAM,    
00070       DT_IDENT,           
00071       DT_UNKNOWN              
00072     };
00073 
00075     enum Flags
00076     {
00077       F_HULL,          
00078       F_HULLS,         
00079       F_UNASSIGNED,    
00080       P_PRECURSORS,    
00081       P_PROJECTIONS,   
00082       C_ELEMENTS,      
00083       I_PEPTIDEMZ,     
00084       SIZE_OF_FLAGS
00085     };
00086 
00088     std::bitset<SIZE_OF_FLAGS> flags;
00089 
00091     enum LabelType
00092     {
00093       L_NONE,                           
00094       L_INDEX,                          
00095       L_META_LABEL,                 
00096       L_ID,                                 
00097       L_ID_ALL,                         
00098       SIZE_OF_LABEL_TYPE
00099     };
00100 
00102     static const std::string NamesOfLabelType[SIZE_OF_LABEL_TYPE];
00103 
00105     typedef FeatureMap<> FeatureMapType;
00106 
00108     typedef boost::shared_ptr<FeatureMap<> > FeatureMapSharedPtrType;
00109 
00111     typedef ConsensusMap ConsensusMapType;
00112 
00114     typedef boost::shared_ptr<ConsensusMap> ConsensusMapSharedPtrType;
00115 
00117     typedef MSExperiment<> ExperimentType;
00118 
00120     typedef boost::shared_ptr<ExperimentType> ExperimentSharedPtrType;
00121 
00123 
00125     LayerData() :
00126       flags(),
00127       visible(true),
00128       flipped(false),
00129       type(DT_UNKNOWN),
00130       name(),
00131       filename(),
00132       peptides(),
00133       param(),
00134       gradient(),
00135       filters(),
00136       annotations_1d(),
00137       modifiable(false),
00138       modified(false),
00139       label(L_NONE),
00140       features(new FeatureMapType()),
00141       consensus(new ConsensusMapType()),
00142       peaks(new ExperimentType()),
00143       current_spectrum_(0)
00144     {
00145       annotations_1d.resize(1);
00146     }
00147 
00149     const ExperimentType::SpectrumType & getCurrentSpectrum() const;
00150 
00152     const FeatureMapSharedPtrType & getFeatureMap() const
00153     {
00154       return features;
00155     }
00156 
00158     FeatureMapSharedPtrType & getFeatureMap()
00159     {
00160       return features;
00161     }
00162 
00164     const ConsensusMapSharedPtrType & getConsensusMap() const
00165     {
00166       return consensus;
00167     }
00168 
00170     ConsensusMapSharedPtrType & getConsensusMap()
00171     {
00172       return consensus;
00173     }
00174 
00176     const ExperimentSharedPtrType & getPeakData() const
00177     {
00178       return peaks;
00179     }
00180 
00182     ExperimentSharedPtrType & getPeakData()
00183     {
00184       return peaks;
00185     }
00186 
00188     const ExperimentSharedPtrType & getChromatogramData() const
00189     {
00190       return chromatograms;
00191     }
00192 
00194     ExperimentSharedPtrType & getChromatogramData()
00195     {
00196       return chromatograms;
00197     }
00198 
00200     const Annotations1DContainer & getCurrentAnnotations() const
00201     {
00202       return annotations_1d[current_spectrum_];
00203     }
00204 
00206     Annotations1DContainer & getCurrentAnnotations()
00207     {
00208       return annotations_1d[current_spectrum_];
00209     }
00210 
00212     const Annotations1DContainer & getAnnotations(Size spectrum_index) const
00213     {
00214       return annotations_1d[spectrum_index];
00215     }
00216 
00218     Annotations1DContainer & getAnnotations(Size spectrum_index)
00219     {
00220       return annotations_1d[spectrum_index];
00221     }
00222 
00224     ExperimentType::SpectrumType & getCurrentSpectrum()
00225     {
00226       return (*peaks)[current_spectrum_];
00227     }
00228 
00230     Size getCurrentSpectrumIndex() const
00231     {
00232       return current_spectrum_;
00233     }
00234 
00236     void setCurrentSpectrumIndex(Size index)
00237     {
00238       current_spectrum_ = index;
00239     }
00240 
00242     // we need this specifically because this->type will *not* distinguish
00243     // chromatogram and spectra data since we need to store chromatograms for
00244     // the 1D case in a layer that looks like PEAK data to all tools.
00245     bool chromatogram_flag_set() const
00246     {
00247       return this->getPeakData()->size() > 0 &&
00248              this->getPeakData()->metaValueExists("is_chromatogram") &&
00249              this->getPeakData()->getMetaValue("is_chromatogram").toBool();
00250     }
00251 
00252     // set the chromatogram flag
00253     void set_chromatogram_flag()
00254     {
00255       this->getPeakData()->setMetaValue("is_chromatogram", "true");
00256     }
00257 
00258     // remove the chromatogram flag
00259     void remove_chromatogram_flag()
00260     {
00261       if (this->chromatogram_flag_set())
00262       {
00263         this->getPeakData()->removeMetaValue("is_chromatogram");
00264       }
00265     }
00266 
00268     bool visible;
00269 
00271     bool flipped;
00272 
00274     DataType type;
00275 
00277     String name;
00278 
00280     String filename;
00281 
00283     std::vector<PeptideIdentification> peptides;
00284 
00286     Param param;
00287 
00289     MultiGradient gradient;
00290 
00292     DataFilters filters;
00293 
00295     std::vector<Annotations1DContainer> annotations_1d;
00296 
00298     bool modifiable;
00299 
00301     bool modified;
00302 
00304     LabelType label;
00305 
00306 private:
00308     FeatureMapSharedPtrType features;
00309 
00311     ConsensusMapSharedPtrType consensus;
00312 
00314     ExperimentSharedPtrType peaks;
00315 
00317     ExperimentSharedPtrType chromatograms;
00318 
00320     Size current_spectrum_;
00321   };
00322 
00324   OPENMS_GUI_DLLAPI std::ostream & operator<<(std::ostream & os, const LayerData & rhs);
00325 
00326 } //namespace
00327 
00328 #endif

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:40 using doxygen 1.7.1