~ubuntu-branches/ubuntu/wily/openms/wily

« back to all changes in this revision

Viewing changes to include/OpenMS/ANALYSIS/ID/PILISNeutralLossModel.h

  • Committer: Package Import Robot
  • Author(s): Filippo Rusconi
  • Date: 2012-11-12 15:58:12 UTC
  • Revision ID: package-import@ubuntu.com-20121112155812-vr15wtg9b50cuesg
Tags: upstream-1.9.0
ImportĀ upstreamĀ versionĀ 1.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- Mode: C++; tab-width: 2; -*-
 
2
// vi: set ts=2:
 
3
//
 
4
// --------------------------------------------------------------------------
 
5
//                   OpenMS Mass Spectrometry Framework
 
6
// --------------------------------------------------------------------------
 
7
//  Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
 
8
//
 
9
//  This library is free software; you can redistribute it and/or
 
10
//  modify it under the terms of the GNU Lesser General Public
 
11
//  License as published by the Free Software Foundation; either
 
12
//  version 2.1 of the License, or (at your option) any later version.
 
13
//
 
14
//  This library is distributed in the hope that it will be useful,
 
15
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
//  Lesser General Public License for more details.
 
18
//
 
19
//  You should have received a copy of the GNU Lesser General Public
 
20
//  License along with this library; if not, write to the Free Software
 
21
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
22
//
 
23
// --------------------------------------------------------------------------
 
24
// $Maintainer: Andreas Bertsch $
 
25
// $Authors: Andreas Bertsch $
 
26
// --------------------------------------------------------------------------
 
27
 
 
28
 
 
29
#ifndef OPENMS_ANALYSIS_ID_PILISNEUTRALLOSSMODEL_H
 
30
#define OPENMS_ANALYSIS_ID_PILISNEUTRALLOSSMODEL_H
 
31
 
 
32
#include <vector>
 
33
#include <OpenMS/KERNEL/StandardTypes.h>
 
34
#include <OpenMS/DATASTRUCTURES/Map.h>
 
35
#include <OpenMS/DATASTRUCTURES/String.h>
 
36
#include <OpenMS/CONCEPT/Types.h>
 
37
#include <OpenMS/ANALYSIS/ID/HiddenMarkovModel.h>
 
38
#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
 
39
 
 
40
namespace OpenMS 
 
41
{
 
42
        class AASequence;
 
43
        
 
44
        /** 
 
45
          @brief This class implements the simulation of the spectra from PILIS
 
46
 
 
47
                PILIS uses a HMM based structure to model the population of fragment ions
 
48
                from a peptide. The spectrum generator can be accessed via the getSpectrum
 
49
                method.
 
50
                 
 
51
                @htmlinclude OpenMS_PILISNeutralLossModel.parameters
 
52
 
 
53
                @ingroup Analysis_ID
 
54
        */      
 
55
        class OPENMS_DLLAPI PILISNeutralLossModel : public DefaultParamHandler
 
56
        {
 
57
                friend class PILISNeutralLossModelGenerator;
 
58
 
 
59
                public:
 
60
                        
 
61
                        /** @name Constructors and destructors
 
62
                        */
 
63
                        //@{
 
64
                        /// default constructor
 
65
                        PILISNeutralLossModel();
 
66
 
 
67
                        /// copy constructor
 
68
                        PILISNeutralLossModel(const PILISNeutralLossModel& model);
 
69
                        
 
70
                        /// destructor
 
71
                        virtual ~PILISNeutralLossModel();
 
72
                        //@}
 
73
 
 
74
                        /// assignment operator
 
75
                        PILISNeutralLossModel& operator = (const PILISNeutralLossModel& mode);
 
76
                        
 
77
                        /** @name Accessors
 
78
                        */
 
79
                        //@{
 
80
                        /// performs a training step; needs as parameters a spectrum with annotated sequence and charge; returns the intensity sum of the matched peaks
 
81
                        DoubleReal train(const RichPeakSpectrum& spec, const AASequence& peptide, DoubleReal ion_weight, UInt charge, DoubleReal peptide_weight);
 
82
 
 
83
                        /// given a peptide (a ion) the model returns the peaks with intensities relative to initial_prob
 
84
                        void getIons(std::vector<RichPeak1D>& peaks, const AASequence& peptide, DoubleReal initial_prob);
 
85
 
 
86
                        /// sets the hidden markov model
 
87
                        void setHMM(const HiddenMarkovModel& model);
 
88
                        
 
89
                        /// writes the HMM to the given file in the GraphML format. A detailed description of the GraphML format can be found under http://graphml.graphdrawing.org/
 
90
                        const HiddenMarkovModel& getHMM() const;
 
91
                        
 
92
                        /// generates the models
 
93
                        void generateModel();
 
94
                        
 
95
                        /// this method evaluates the model after training; it should be called after all training steps with train
 
96
                        void evaluate();
 
97
                        //@}
 
98
 
 
99
                protected:
 
100
 
 
101
                        /// extracts the precursor and related intensities of a training spectrum
 
102
                        DoubleReal getIntensitiesFromSpectrum_(const RichPeakSpectrum& train_spec, Map<String, DoubleReal>& pre_ints, DoubleReal ion_weight, const AASequence& peptide, UInt charge);
 
103
 
 
104
                        /// trains precursor and related peaks
 
105
                        void trainIons_(DoubleReal initial_probability, const Map<String, DoubleReal>& intensities, const AASequence& peptide);
 
106
                        
 
107
                        /// estimates the precursor intensities 
 
108
                        void getIons_(Map<String, DoubleReal>& intensities, DoubleReal initial_probability, const AASequence& precursor);
 
109
 
 
110
                        /// enables the states needed for precursor training/simulation
 
111
                        void enableIonStates_(const AASequence& peptide);
 
112
 
 
113
                        /// precursor model used
 
114
                        HiddenMarkovModel hmm_precursor_;
 
115
 
 
116
                        /// 
 
117
                        UInt num_explicit_;
 
118
 
 
119
                        void updateMembers_();
 
120
        };
 
121
}
 
122
#endif
 
123