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: Hannes Roest $ 00032 // $Authors: Hannes Roest $ 00033 // -------------------------------------------------------------------------- 00034 00035 #ifndef OPENMS_ANALYSIS_OPENSWATH_DATAACCESS_MRMFEATUREACCESSOPENMS_H 00036 #define OPENMS_ANALYSIS_OPENSWATH_DATAACCESS_MRMFEATUREACCESSOPENMS_H 00037 00038 #include <OpenMS/ANALYSIS/OPENSWATH/OPENSWATHALGO/DATAACCESS/ITransition.h> 00039 00040 #include <OpenMS/KERNEL/Feature.h> 00041 #include <OpenMS/KERNEL/MRMFeature.h> 00042 #include <OpenMS/KERNEL/MRMTransitionGroup.h> 00043 #include <OpenMS/FILTERING/NOISEESTIMATION/SignalToNoiseEstimatorMedian.h> 00044 00045 #include <boost/shared_ptr.hpp> 00046 00047 // These classes are minimal implementations of the interfaces defined in ITransition: 00048 // - IFeature 00049 // - IMRMFeature 00050 // - ITransitionGroup 00051 // - ISignalToNoise 00052 00053 namespace OpenMS 00054 { 00059 class OPENMS_DLLAPI FeatureOpenMS : 00060 public OpenSwath::IFeature 00061 { 00062 public: 00063 00064 explicit FeatureOpenMS(Feature& feature); 00065 00066 ~FeatureOpenMS(); 00067 00068 void getRT(std::vector<double>& rt); 00069 00070 void getIntensity(std::vector<double>& intens); 00071 00072 float getIntensity(); 00073 00074 double getRT(); 00075 00076 private: 00077 Feature* feature_; 00078 }; 00079 00084 class OPENMS_DLLAPI MRMFeatureOpenMS : 00085 public OpenSwath::IMRMFeature 00086 { 00087 public: 00088 00089 explicit MRMFeatureOpenMS(MRMFeature& mrmfeature); 00090 00091 ~MRMFeatureOpenMS(); 00092 00093 boost::shared_ptr<OpenSwath::IFeature> getFeature(std::string nativeID); 00094 00095 float getIntensity(); 00096 00097 double getRT(); 00098 00099 private: 00100 const MRMFeature& mrmfeature_; 00101 std::map<std::string, boost::shared_ptr<FeatureOpenMS> > features_; 00102 }; 00103 00108 template <typename SpectrumT, typename TransitionT> 00109 class OPENMS_DLLAPI TransitionGroupOpenMS : 00110 public OpenSwath::ITransitionGroup 00111 { 00112 public: 00113 00114 TransitionGroupOpenMS(MRMTransitionGroup<SpectrumT, TransitionT>& trgroup) : 00115 trgroup_(trgroup) 00116 { 00117 } 00118 00119 ~TransitionGroupOpenMS() 00120 { 00121 } 00122 00123 std::size_t size() 00124 { 00125 return trgroup_.size(); 00126 } 00127 00128 std::vector<std::string> getNativeIDs() 00129 { 00130 std::vector<std::string> result; 00131 for (std::size_t i = 0; i < this->size(); i++) 00132 { 00133 result.push_back(trgroup_.getChromatograms()[i].getNativeID()); 00134 } 00135 return result; 00136 } 00137 00138 void getLibraryIntensities(std::vector<double>& intensities) 00139 { 00140 trgroup_.getLibraryIntensity(intensities); 00141 } 00142 00143 private: 00144 const MRMTransitionGroup<SpectrumT, TransitionT>& trgroup_; 00145 }; 00146 00151 template <typename PeakT> 00152 class OPENMS_DLLAPI SignalToNoiseOpenMS : 00153 public OpenSwath::ISignalToNoise 00154 { 00155 public: 00156 00157 SignalToNoiseOpenMS(OpenMS::MSSpectrum<PeakT>& chromat, 00158 double sn_win_len_, unsigned int sn_bin_count_) : 00159 chromatogram_(chromat), sn_() 00160 { 00161 OpenMS::Param snt_parameters = sn_.getParameters(); 00162 snt_parameters.setValue("win_len", sn_win_len_); 00163 snt_parameters.setValue("bin_count", sn_bin_count_); 00164 sn_.setParameters(snt_parameters); 00165 sn_.init(chromatogram_); 00166 } 00167 00168 double getValueAtRT(double RT) 00169 { 00170 typename OpenMS::MSSpectrum<PeakT>::const_iterator it = chromatogram_.MZBegin(RT); 00171 return sn_.getSignalToNoise(*it); 00172 } 00173 00174 private: 00175 const OpenMS::MSSpectrum<PeakT>& chromatogram_; 00176 OpenMS::SignalToNoiseEstimatorMedian<OpenMS::MSSpectrum<PeakT> > sn_; 00177 }; 00178 00179 } 00180 00181 #endif
| OpenMS / TOPP release 1.10.0 | Documentation generated on Thu Mar 7 2013 09:42:42 using doxygen 1.7.1 |