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_HMMSEARCH_TASK_H_ 23 #define _U2_HMMSEARCH_TASK_H_ 24 25 #include <QMutex> 26 27 #include <U2Core/AnnotationData.h> 28 #include <U2Core/DNASequence.h> 29 #include <U2Core/SequenceWalkerTask.h> 30 #include <U2Core/Task.h> 31 #include <U2Core/U2Region.h> 32 33 #include "HMMIO.h" 34 #include "uhmmsearch.h" 35 36 struct plan7_s; 37 38 namespace U2 { 39 40 class DNATranslation; 41 42 class HMMSearchTaskResult { 43 public: HMMSearchTaskResult()44 HMMSearchTaskResult() 45 : evalue(0), score(0), onCompl(false), onAmino(false), borderResult(false), filtered(false) { 46 } 47 float evalue; 48 float score; 49 bool onCompl; 50 bool onAmino; 51 bool borderResult; 52 bool filtered; 53 U2Region r; 54 }; 55 56 class HMMSearchTask : public Task, SequenceWalkerCallback { 57 Q_OBJECT 58 public: 59 HMMSearchTask(plan7_s *hmm, const DNASequence &seq, const UHMMSearchSettings &s); 60 61 HMMSearchTask(const QString &hFile, const DNASequence &seq, const UHMMSearchSettings &s); 62 63 virtual void prepare(); 64 getResults()65 const QList<HMMSearchTaskResult> &getResults() const { 66 return results; 67 } 68 69 virtual void onRegion(SequenceWalkerSubtask *t, TaskStateInfo &stateInfo); 70 71 Task::ReportResult report(); 72 73 QList<SharedAnnotationData> getResultsAsAnnotations(U2FeatureType type, const QString &name) const; 74 75 QList<Task *> onSubTaskFinished(Task *subTask); 76 77 private: 78 bool checkAlphabets(int hmmAl, const DNAAlphabet *seqAl, DNATranslation *&complTrans, DNATranslation *&aminoTrans); 79 80 SequenceWalkerTask *getSWSubtask(); 81 82 private: 83 plan7_s *hmm; 84 DNASequence seq; 85 UHMMSearchSettings settings; 86 DNATranslation *complTrans; 87 DNATranslation *aminoTrans; 88 QList<HMMSearchTaskResult> results; 89 QList<HMMSearchTaskResult> overlaps; 90 QString fName; 91 QMutex lock; 92 HMMReadTask *readHMMTask; 93 SequenceWalkerTask *swTask; 94 }; 95 96 } // namespace U2 97 #endif 98