24 #ifndef _MSDATAANALYZER_HPP_ 25 #define _MSDATAANALYZER_HPP_ 38 using namespace msdata;
114 template <
typename analyzer_type>
118 static const char*
id() {
return "analyzer_traits not specialized";}
121 static const char*
description() {
return typeid(analyzer_type).name();}
127 static std::vector<std::string>
argsUsage() {
return std::vector<std::string>();}
135 public std::vector<MSDataAnalyzerPtr>
141 virtual void open(
const DataInfo& dataInfo);
143 virtual UpdateRequest updateRequested(
const DataInfo& dataInfo,
146 virtual void update(
const DataInfo& dataInfo,
149 virtual void close(
const DataInfo& dataInfo);
192 template <
typename value_type>
193 bool parseRange(
const std::string &desiredArg,
const std::string& text, std::pair<value_type,value_type>& result,
const std::string& callerName)
195 if (!text.compare(0,desiredArg.size()+1,desiredArg+
"="))
197 std::string val = text.substr(desiredArg.size()+1);
198 std::string::size_type indexPairSeperator = val.find(
',');
199 if (std::string::npos == indexPairSeperator)
201 indexPairSeperator = val.find(
'-');
202 if (0==indexPairSeperator)
204 indexPairSeperator = string::npos;
207 int bracket = (val[0] ==
'[')?1:0;
209 ((bracket!=0) && val[val.size()-1] !=
']'))
211 std::cerr <<
"[" << callerName <<
"] Unable to parse range: " << text << endl;
217 if (std::string::npos == indexPairSeperator)
219 std::string first = val.substr(bracket,val.size()-(2*bracket));
220 result.first = result.second =
lexical_cast<value_type>(first);
224 std::string first = val.substr(bracket, indexPairSeperator-bracket);
225 std::string second = val.substr(indexPairSeperator+1, val.size()-indexPairSeperator-(1+bracket));
228 result.second = lexical_cast<value_type>(second);
230 result.second = numeric_limits<value_type>::max();
234 catch (boost::bad_lexical_cast&)
236 std::cerr <<
"[" << callerName <<
"] Unable to parse range: " << text << endl;
242 template <
typename value_type>
243 bool parseValue(
const std::string &desiredArg,
const std::string& text, value_type& result,
const std::string& callerName)
245 if (!text.compare(0,desiredArg.size()+1,desiredArg+
"="))
247 std::string val = text.substr(desiredArg.size()+1);
250 std::cerr <<
"[" << callerName <<
"] Unable to parse value: " << text << endl;
259 catch (boost::bad_lexical_cast&)
261 std::cerr <<
"[" << callerName <<
"] Unable to parse value: " << text << endl;
272 #endif // _MSDATAANALYZER_HPP_
virtual size_t iterationsPerCallback() const
virtual ~MSDataAnalyzer()
bool parseValue(const std::string &desiredArg, const std::string &text, value_type &result, const std::string &callerName)
boost::shared_ptr< MSDataAnalyzer > MSDataAnalyzerPtr
virtual Status progress(size_t index, size_t size)
static std::vector< std::string > argsUsage()
description of args string options
virtual UpdateRequest updateRequested(const DataInfo &dataInfo, const SpectrumIdentity &spectrumIdentity) const
ask analyzer if it wants an update
float lexical_cast(const std::string &str)
std::string outputDirectory
container of MSDataAnalyzer (composite pattern)
virtual ~ProgressCallback()
static const char * description()
description of the analyzer
virtual void update(const DataInfo &dataInfo, const Spectrum &spectrum)
analyze a single spectrum
event generator for MSDataAnalyzer
This auxilliary class should be specialized for MSDataAnalyzers whose instantiation is controlled by ...
DataInfo(const MSData &_msd)
virtual void open(const DataInfo &dataInfo)
start analysis of the data
Identifying information for a spectrum.
std::string sourceFilename
static const char * argsFormat()
format of args string
MSDataAnalyzer & analyzer_
information about the data to be analyzed
bool parseRange(const std::string &desiredArg, const std::string &text, std::pair< value_type, value_type > &result, const std::string &callerName)
progress callback interface
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
virtual void close(const DataInfo &dataInfo)
end analysis of the data
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Interface for MSData analyzers.
static const char * id()
string identifier for the analyzer