root/analyzer.hpp @ 32

Revision 32, 2.0 KB (checked in by freek.de.bruijn@…, 2 years ago)

Fixed declaration versus initialization order issue for Analyzer class (by putting field outputFactory after fields ms1profile and ms2profile).

Line 
1#include <QObject>
2#include <QThread>
3#include <QFile>
4#include <QDateTime>
5#include <QString>
6#include "lcms.hpp"
7#include "analysis.hpp"
8#include "msconfig.hpp"
9#include "xml.hpp"
10#include "progressoutput.hpp"
11#include "statusoutput.hpp"
12#include "filetools.hpp"
13#include "outputfactory.hpp"
14
15#ifndef ANALYZER_HPP
16#define ANALYZER_HPP
17
18// Thread for processing indivdual iruns.
19class IrunThread : public QThread {
20public:
21  IrunThread(lcms::analysis *a_) { analysis = a_; }
22  void addIrun(int idx) { irun_idxs.push_back(idx); }
23protected:
24  vector<int> irun_idxs; // Iruns assigned to thread.
25  lcms::analysis *analysis;
26  void run() { for(size_t i = 0; i < irun_idxs.size(); i++) analysis->process_irun(irun_idxs[i]); }
27};
28
29class AlignThread : public QThread {
30public:
31  AlignThread(lcms::analysis *a_, int refIdx_) { analysis = a_; refIdx = refIdx_; }
32  void addIrun(int idx) { irun_idxs.push_back(idx); }
33protected:
34  int refIdx;  vector<int> irun_idxs; // Iruns assigned to thread.
35  lcms::analysis *analysis;
36  void run() { for(size_t i = 0; i < irun_idxs.size(); i++) analysis->align_irun(irun_idxs[i], refIdx); }
37};
38
39class Analyzer : QObject
40{
41Q_OBJECT
42private:
43    QString dir;
44    FileTools fileTools;
45    lcms::analysis* analysis;
46    msconfig conf;
47    bool ms1profile, ms2profile;
48    OutputFactory& outputFactory;
49    vector<string> base_fasta, fasta;
50    vector<string> base_pepXML, pepXML;
51    lcms::analysis_files files;
52    void loadDBs();
53    void processIruns();
54    void alignIruns();
55    void progressDialog(QString message, QThread *thread) {
56      vector<QThread *> threads; threads.push_back(thread);
57      progressDialog(message, threads);
58    }
59    void progressDialog(QString message, vector<QThread *> threads);
60public:
61    Analyzer(QString dir, OutputFactory& factory, bool ms1profile, bool ms2profile) : dir(dir), ms1profile(ms1profile), ms2profile(ms2profile), outputFactory(factory) {}
62signals:
63
64public slots:
65    lcms::analysis * run();
66    msconfig prepare();
67};
68
69#endif // ANALYZER_HPP
Note: See TracBrowser for help on using the browser.