ProteoWizard
Pseudo2DGel.hpp
Go to the documentation of this file.
1 //
2 // $Id: Pseudo2DGel.hpp 4072 2012-11-02 21:00:39Z pcbrefugee $
3 //
4 //
5 // Original author: Darren Kessner <darren@proteowizard.org>
6 //
7 // Copyright 2008 Spielberg Family Center for Applied Proteomics
8 // Cedars-Sinai Medical Center, Los Angeles, California 90048
9 //
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 //
14 // http://www.apache.org/licenses/LICENSE-2.0
15 //
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 // See the License for the specific language governing permissions and
20 // limitations under the License.
21 //
22 
23 
24 #ifndef _PSEUDO2DGEL_HPP_
25 #define _PSEUDO2DGEL_HPP_
26 
27 
29 #include <boost/shared_ptr.hpp>
30 
31 #include "MSDataAnalyzer.hpp"
32 #include "MSDataCache.hpp"
33 #include "RegionAnalyzer.hpp"
35 
36 
37 namespace pwiz {
38 namespace analysis {
39 
40 
41 /// Creates pseudo-2D-gel images from survey scan data.
42 ///
43 /// The Pseudo2DGel class is a data analyzer that constructs an image
44 /// from data in to the update method by a MSDataAnalyzerDriver
45 /// object. FT and IT scans are separated and, if present, used to
46 /// construct two separate images. Output is controlled by the
47 /// Pseudo2DGel::Config object passed to the constructor.
49 {
50  public:
51 
53  {
54  circle = 0,
55  square = 1
56  };
57 
58  /// Holds the configuration for an instance of Pseudo2DGel.
59  ///
60  /// Controls both the image generation as well as markups on the
61  /// image from ms2 scans or peptide locations.
63  {
64  /// The filename label.
65  std::string label;
66 
67  /// lower m/z cutoff.
68  float mzLow;
69 
70  /// upper m/z cutoff.
71  float mzHigh;
72 
73  /// scale of the time axis.
74  float timeScale;
75 
76  /// histogram bin count.
77  int binCount;
78 
79  /// intensity z-score function radius.
80  float zRadius;
81 
82  /// flag for blue-red-yellow coloration.
83  bool bry;
84 
85  /// flag for grey scale coloration.
86  bool grey;
87 
88  /// flag to sum intensity in bins. This flag causes bins to be
89  /// the sum of the underlying values. If it's false, then the
90  /// maximum value for the region will be used.
91  bool binSum;
92 
93  /// flag to set marks for ms2 locations.
94  bool ms2;
95 
96  /// flag to only draw ms2 locations that exist in the
97  /// peptide_id object and have a score >= 0.
99 
100  /// flag to render linearly with scan. This flag will switch
101  /// between having a y-axis that's linear with scan or linear
102  /// with time.
103  bool binScan;
104 
105  /// PeptideID object to retrieve peptide id's from. If the
106  /// object exists, it will be queried for peptide
107  /// locations.
108  boost::shared_ptr<pwiz::peptideid::PeptideID> peptide_id;
109 
110  /// The shape used for pseudo2d gel markups.
112 
113  /// Optional user-specified bitmap width and height.
114  /// Normally width and height are automatically calculated.
117 
118  Config();
119  Config(const std::string& args);
120  Config(const std::string& args,
121  boost::shared_ptr<pwiz::peptideid::PeptideID> peptide_id);
122 
123  /// parses a keyword/value string to set instance variables.
124  void process(const std::string& args);
125  };
126 
127  Pseudo2DGel(const MSDataCache& cache, const Config& config);
128 
129  /// \name MSDataAnalyzer interface
130  //@{
131  virtual void open(const DataInfo& dataInfo);
132 
133  virtual UpdateRequest updateRequested(const DataInfo& dataInfo,
134  const SpectrumIdentity& spectrumIdentity) const;
135 
136  virtual void update(const DataInfo& dataInfo,
137  const Spectrum& spectrum);
138 
139  virtual void close(const DataInfo& dataInfo);
140  //@}
141 
142  private:
143  class Impl;
144  boost::shared_ptr<Impl> impl_;
146  Pseudo2DGel& operator=(Pseudo2DGel&);
147 
148  friend struct prob_comp;
149 };
150 
151 
152 template<>
154 {
155  static const char* id() {return "image";}
156  static const char* description() {return "create pseudo-2D-gel image";}
157  static const char* argsFormat() {return "[args]";}
158  static std::vector<std::string> argsUsage()
159  {
160  std::vector<std::string> result;
161  result.push_back("label=xxxx (set filename label to xxxx)");
162  result.push_back("mzLow=N (set low m/z cutoff)");
163  result.push_back("mzHigh=N (set high m/z cutoff)");
164  result.push_back("timeScale=N (set scaling factor for time axis)");
165  result.push_back("binCount=N (set histogram bin count)");
166  result.push_back("zRadius=N (set intensity function z-score radius [=2])");
167  result.push_back("scan (render y-axis linear with scans)");
168  result.push_back("time (render y-axis linear with time)");
169  result.push_back("bry (use blue-red-yellow gradient)");
170  result.push_back("grey (use grey-scale gradient)");
171  result.push_back("binSum (sum intensity in bins [default = max intensity])");
172  result.push_back("ms2locs (indicate masses selected for ms2)");
173  result.push_back("pepxml=xxx (set ms2 id's from pepxml file xxx)");
174  result.push_back("msi=xxx (set ms2 id's from msinspect output file xxx)");
175  result.push_back("flat=xxx (set ms2 id's from tab delim file xxx)");
176  result.push_back("width=xxx (set image width to xxx pixels [default is calculated])");
177  result.push_back("height=yyy (set image height to yyy pixels [default is calculated])");
178  return result;
179  }
180 };
181 
182 
183 } // namespace analysis
184 } // namespace pwiz
185 
186 
187 #endif // _PSEUDO2DGEL_HPP_
188