Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
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
00243
00244
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
00253 void set_chromatogram_flag()
00254 {
00255 this->getPeakData()->setMetaValue("is_chromatogram", "true");
00256 }
00257
00258
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 }
00327
00328 #endif