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

« back to all changes in this revision

Viewing changes to include/OpenMS/ANALYSIS/QUANTITATION/ItraqQuantifier.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: Chris Bielow $
 
25
// $Authors: Chris Bielow $
 
26
// --------------------------------------------------------------------------
 
27
 
 
28
#ifndef OPENMS_ANALYSIS_QUANTITATION_ITRAQQUANTIFIER_H
 
29
#define OPENMS_ANALYSIS_QUANTITATION_ITRAQQUANTIFIER_H
 
30
 
 
31
#include <vector>
 
32
 
 
33
#include <OpenMS/ANALYSIS/QUANTITATION/ItraqConstants.h>
 
34
#include <OpenMS/KERNEL/ConsensusMap.h>
 
35
#include <OpenMS/METADATA/ProteinIdentification.h>
 
36
#include <OpenMS/METADATA/PeptideIdentification.h>
 
37
 
 
38
 
 
39
namespace OpenMS
 
40
{
 
41
 
 
42
        /**
 
43
                @brief Does post-processing on raw iTRAQ channel quantitation
 
44
                
 
45
                Using the raw consensus map from ItraqChannelExtractor, a non-negative isotope correction, normalization (using median) 
 
46
                and [optionally] protein inference is computed.
 
47
                
 
48
                @htmlinclude OpenMS_ItraqQuantifier.parameters
 
49
 
 
50
        */
 
51
        class OPENMS_DLLAPI ItraqQuantifier
 
52
                : public DefaultParamHandler,
 
53
                        public ItraqConstants
 
54
        {
 
55
 
 
56
        public:
 
57
 
 
58
                typedef ItraqConstants::ChannelInfo ChannelInfo;
 
59
                typedef ItraqConstants::ChannelMapType ChannelMapType;
 
60
                typedef ItraqConstants::IsotopeMatrices IsotopeMatrices;
 
61
                
 
62
                /// Constructor (assuming 4-plex experiment)
 
63
                ItraqQuantifier();
 
64
                
 
65
                /// Constructor with iTRAQ-type (either ItraqConstants::FOURPLEX or ItraqConstants::EIGHTPLEX)
 
66
                ItraqQuantifier(Int itraq_type);
 
67
 
 
68
                /// Constructor with iTRAQ-type (either ItraqConstants::FOURPLEX or ItraqConstants::EIGHTPLEX) and Param
 
69
                ItraqQuantifier(Int itraq_type, const Param& param);
 
70
 
 
71
                /// copy constructor
 
72
    ItraqQuantifier(const ItraqQuantifier& cp);
 
73
 
 
74
    /// assignment operator
 
75
    ItraqQuantifier& operator = (const ItraqQuantifier& rhs);
 
76
 
 
77
                /**
 
78
                 *      @brief using the raw iTRAQ intensities we apply isotope correction, normalization (using median)
 
79
                 *      
 
80
                 *      @param consensus_map_in Raw iTRAQ intensities from previous step
 
81
                 *      @param consensus_map_out Post-processed iTRAQ ratios for peptides
 
82
                 *
 
83
                 *      @throws Exception::FailedAPICall is least-squares fit fails
 
84
                 *      @throws Exception::InvalidParameter if parameter is invalid (e.g. reference_channel)
 
85
                 */
 
86
                void run(const ConsensusMap& consensus_map_in, 
 
87
                                                 ConsensusMap& consensus_map_out
 
88
                                                 );
 
89
                
 
90
    /**
 
91
      @brief Statistics for quantitation performance and comparison of NNLS vs. naive method (aka matrix inversion)
 
92
 
 
93
    */
 
94
    struct ItraqQuantifierStats
 
95
    {
 
96
      ItraqQuantifierStats()
 
97
        : 
 
98
        channel_count(0),
 
99
        iso_number_ms2_negative(0),
 
100
        iso_number_reporter_negative(0),
 
101
        iso_number_reporter_different(0),
 
102
        iso_solution_different_intensity(0),
 
103
        iso_total_intensity_negative(0),
 
104
        number_ms2_total(0),
 
105
        number_ms2_empty(0),
 
106
        empty_channels()
 
107
      {
 
108
      }
 
109
 
 
110
      Size channel_count;  //< 4plex or 8 plex?!
 
111
      Size iso_number_ms2_negative; //< number of MS2 spectra where one or more channels had negative solution
 
112
      Size iso_number_reporter_negative;  //< number of channels where naive solution was negative
 
113
      Size iso_number_reporter_different; //< number of channels >0 where naive solution was different; happens when naive solution is negative in other channels
 
114
      DoubleReal iso_solution_different_intensity; //< absolute intensity difference between both solutions (for channels > 0)
 
115
      DoubleReal iso_total_intensity_negative; //< only for spectra where naive solution is negative
 
116
      Size number_ms2_total; //< total number of MS2 spectra
 
117
      Size number_ms2_empty; //< number of empty MS2 (no reporters at all)
 
118
      std::map<Size,Size> empty_channels; //< Channel_ID -> Missing; indicating the number of empty channels from all MS2 scans, i.e., numbers are between number_ms2_empty and number_ms2_total
 
119
    };
 
120
    
 
121
    ItraqQuantifierStats getStats() const;
 
122
    
 
123
        protected:
 
124
 
 
125
                void setDefaultParams_();
 
126
                
 
127
                void updateMembers_();
 
128
                
 
129
        private:
 
130
                
 
131
                /// initialize
 
132
                void initIsotopeCorrections_();
 
133
                
 
134
                void reconstructChannelInfo_(const ConsensusMap& consensus_map);
 
135
                        
 
136
                /// either ItraqConstants::FOURPLEX or ItraqConstants::EIGHTPLEX
 
137
                Int itraq_type_;
 
138
                
 
139
                /// map the channel-name (e.g., 114) onto its channel_info
 
140
                /// the channel-description is also the id-string in the mapList section of the ConsensusMap
 
141
                ChannelMapType channel_map_;    
 
142
 
 
143
                /// Matrices with isotope correction values (one for each plex-type)
 
144
                IsotopeMatrices isotope_corrections_;
 
145
 
 
146
    /// stats for isotope correction
 
147
    ItraqQuantifierStats stats_;
 
148
                
 
149
        }; // !class
 
150
 
 
151
  OPENMS_DLLAPI std::ostream& operator << (std::ostream& os, const ItraqQuantifier::ItraqQuantifierStats& stats);
 
152
 
 
153
} // !namespace
 
154
 
 
155
#endif // OPENMS_ANALYSIS_QUANTITATION_ITRAQQUANTIFIER_H