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_SQLITE_ASSEMBLY_PACK_ALGORITHM_DBI_H_ 23 #define _U2_SQLITE_ASSEMBLY_PACK_ALGORITHM_DBI_H_ 24 25 #include <U2Core/U2SqlHelpers.h> 26 27 namespace U2 { 28 29 class U2AssemblyPackStat; 30 class U2Region; 31 32 class PackAlgorithmData { 33 public: PackAlgorithmData()34 PackAlgorithmData() 35 : leftmostPos(0), effectiveLen(0) { 36 } 37 38 U2DataId readId; 39 qint64 leftmostPos; 40 qint64 effectiveLen; 41 }; 42 43 class PackAlgorithmAdapter { 44 public: 45 virtual U2DbiIterator<PackAlgorithmData> *selectAllReads(U2OpStatus &os) = 0; 46 virtual void assignProw(const U2DataId &readId, qint64 prow, U2OpStatus &os) = 0; ~PackAlgorithmAdapter()47 virtual ~PackAlgorithmAdapter() { 48 } 49 }; 50 51 #define PACK_TAIL_SIZE 50000 52 53 class PackAlgorithmContext { 54 public: 55 PackAlgorithmContext(); 56 57 int maxProw; 58 qint64 nReads; 59 60 // used to assign prow for reads when TAIL_SIZE is not enough 61 qint64 peakEnd; 62 qint64 peakRow; 63 QVector<qint64> tails; 64 }; 65 66 class AssemblyPackAlgorithm { 67 public: 68 static void pack(PackAlgorithmAdapter &adapter, U2AssemblyPackStat &stat, U2OpStatus &os); 69 static int packRead(const U2Region ®, PackAlgorithmContext &ctx, U2OpStatus &os); 70 }; 71 72 } // namespace U2 73 74 #endif 75