1 /**
2  * UGENE - Integrated Bioinformatics Tools.
3  * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4  * http://ugene.net
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  */
21 
22 #ifndef _U2_BED_TOOLS_WORKERS_LIBRARY_
23 #define _U2_BED_TOOLS_WORKERS_LIBRARY_
24 
25 #include <U2Core/GUrl.h>
26 
27 #include <U2Lang/BaseNGSWorker.h>
28 #include <U2Lang/LocalDomain.h>
29 #include <U2Lang/WorkflowUtils.h>
30 
31 namespace U2 {
32 namespace LocalWorkflow {
33 
34 //////////////////////////////////////////////////
35 //Slopbed
36 class SlopbedPrompter;
37 typedef PrompterBase<SlopbedPrompter> SlopbedBase;
38 class SlopbedPrompter : public SlopbedBase {
39     Q_OBJECT
40 public:
41     SlopbedPrompter(Actor *p = 0)
SlopbedBase(p)42         : SlopbedBase(p) {
43     }
44 
45 protected:
46     QString composeRichDoc();
47 };    //SlopbedPrompter
48 
49 class SlopbedWorker : public BaseNGSWorker {
50     Q_OBJECT
51 public:
52     SlopbedWorker(Actor *a);
53 
54 protected:
55     QVariantMap getCustomParameters() const;
56     QString getDefaultFileName() const;
57     Task *getTask(const BaseNGSSetting &settings) const;
58 };    //SlopbedWorker
59 
60 class SlopbedWorkerFactory : public DomainFactory {
61     static const QString ACTOR_ID;
62 
63 public:
64     static void init();
SlopbedWorkerFactory()65     SlopbedWorkerFactory()
66         : DomainFactory(ACTOR_ID) {
67     }
createWorker(Actor * a)68     Worker *createWorker(Actor *a) {
69         return new SlopbedWorker(a);
70     }
71 };    //SlopbedWorkerFactory
72 
73 class SlopbedTask : public BaseNGSTask {
74     Q_OBJECT
75 public:
76     SlopbedTask(const BaseNGSSetting &settings);
77 
78 protected:
79     bool filterLines;
80     void prepareStep();
81     void finishStep();
82     QStringList getParameters(U2OpStatus &os);
83 };
84 
85 //////////////////////////////////////////////////
86 //genomecov
87 class GenomecovPrompter;
88 typedef PrompterBase<GenomecovPrompter> GenomecovBase;
89 class GenomecovPrompter : public GenomecovBase {
90     Q_OBJECT
91 public:
92     GenomecovPrompter(Actor *p = 0)
GenomecovBase(p)93         : GenomecovBase(p) {
94     }
95 
96 protected:
97     QString composeRichDoc();
98 };    //GenomecovPrompter
99 
100 class GenomecovWorker : public BaseNGSWorker {
101     Q_OBJECT
102 public:
103     GenomecovWorker(Actor *a);
104 
105 protected:
106     QVariantMap getCustomParameters() const;
107     QString getDefaultFileName() const;
108     Task *getTask(const BaseNGSSetting &settings) const;
109 };    //GenomecovWorker
110 
111 class GenomecovWorkerFactory : public DomainFactory {
112     static const QString ACTOR_ID;
113 
114 public:
115     static void init();
GenomecovWorkerFactory()116     GenomecovWorkerFactory()
117         : DomainFactory(ACTOR_ID) {
118     }
createWorker(Actor * a)119     Worker *createWorker(Actor *a) {
120         return new GenomecovWorker(a);
121     }
122 };    //GenomecovWorkerFactory
123 
124 class GenomecovTask : public BaseNGSTask {
125     Q_OBJECT
126 public:
127     GenomecovTask(const BaseNGSSetting &settings);
128 
129 protected:
130     void prepareStep();
131     QStringList getParameters(U2OpStatus &os);
132 };
133 
134 //////////////////////////////////////////////////
135 //dedtools intersect
136 class BedtoolsIntersectWorker : public BaseWorker {
137     Q_OBJECT
138 public:
139     BedtoolsIntersectWorker(Actor *a);
140     virtual void init();
141     virtual Task *tick();
cleanup()142     virtual void cleanup() {
143     }
144     virtual bool isReady() const;
145 private slots:
146     void sl_taskFinished(Task *task);
147 
148 private:
149     Task *createTask();
150     QList<U2EntityRef> getAnnotationsEntityRefFromMessages(const QList<Message> &mList, const QString &portId);
151     U2EntityRef getAnnotationsEntityRef(const Message &m, const QString &portId, U2OpStatus &os);
152     void storeMessages(IntegralBus *bus, QList<Message> &store);
153     IntegralBus *inputA;
154     IntegralBus *inputB;
155     IntegralBus *output;
156 
157     QList<Message> storeA;
158     QList<Message> storeB;
159 };    //BedtoolsIntersectWorker
160 
161 class BedtoolsIntersectWorkerFactory : public DomainFactory {
162 public:
163     static const QString ACTOR_ID;
164     static void init();
BedtoolsIntersectWorkerFactory()165     BedtoolsIntersectWorkerFactory()
166         : DomainFactory(ACTOR_ID) {
167     }
createWorker(Actor * a)168     virtual Worker *createWorker(Actor *a) {
169         return new BedtoolsIntersectWorker(a);
170     }
171 };    //BedtoolsIntersectWorkerFactory
172 
173 class BedtoolsIntersectPrompter : public PrompterBase<BedtoolsIntersectPrompter> {
174     Q_OBJECT
175 public:
176     BedtoolsIntersectPrompter(Actor *p = 0)
177         : PrompterBase<BedtoolsIntersectPrompter>(p) {
178     }
179 
180 protected:
181     QString composeRichDoc();
182 };    //BedtoolsIntersectPrompter
183 
184 }    // namespace LocalWorkflow
185 }    // namespace U2
186 
187 #endif    //_U2_BED_TOOLS_WORKERS_LIBRARY_
188