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_RF_SARRAYWK_ALG_H_ 23 #define _U2_RF_SARRAYWK_ALG_H_ 24 25 #include <QVector> 26 27 #include <U2Algorithm/SArrayBasedFindTask.h> 28 #include <U2Algorithm/SArrayIndex.h> 29 30 #include "RFBase.h" 31 32 namespace U2 { 33 34 class SArrayIndex; 35 class RFSArrayWKSubtask; 36 class RFRollingArray; 37 38 class RFSArrayWKAlgorithm : public RFAlgorithmBase { 39 Q_OBJECT 40 friend class RFSArrayWKSubtask; 41 42 public: 43 RFSArrayWKAlgorithm(RFResultsListener *rl, const char *seqX, int sizeX, const char *seqY, int sizeY, DNAAlphabetType seqType, int w, int k); 44 ~RFSArrayWKAlgorithm()45 ~RFSArrayWKAlgorithm() { 46 cleanup(); 47 } 48 49 void prepare(); 50 QList<Task *> onSubTaskFinished(Task *subTask); 51 52 void cleanup(); 53 54 private: 55 void addResult(int a, int s, int l, int c); 56 void calculate(RFSArrayWKSubtask *t); 57 58 public: 59 QVector<int> diagOffsets; // holds start position for the last checked window 60 int ARRAY_SIZE; 61 int SEARCH_SIZE; 62 63 const char *arraySeq; 64 const char *searchSeq; 65 bool arrayIsX; 66 67 quint32 q; 68 69 CreateSArrayIndexTask *indexTask; 70 int nThreads; 71 }; 72 73 class RFSArrayWKSubtask : public Task, public SArrayIndex::SAISearchContext { 74 Q_OBJECT 75 friend class RFSArrayWKAlgorithm; 76 77 public: 78 RFSArrayWKSubtask(RFSArrayWKAlgorithm *owner, int _tid); ~RFSArrayWKSubtask()79 virtual ~RFSArrayWKSubtask() { 80 } 81 void run(); 82 83 RFSArrayWKAlgorithm *owner; 84 85 const int tid; 86 }; 87 88 } // namespace U2 89 90 #endif 91