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_DISTANCE_MATRIX_MSA_PROFILE_DIALOG_H_ 23 #define _U2_DISTANCE_MATRIX_MSA_PROFILE_DIALOG_H_ 24 25 #include <QHash> 26 #include <QSet> 27 28 #include <U2Core/MultipleSequenceAlignment.h> 29 #include <U2Core/Task.h> 30 #include <U2Core/global.h> 31 32 #include "ui_DistanceMatrixMSAProfileDialog.h" 33 34 class QFile; 35 36 namespace U2 { 37 38 class MSAEditor; 39 class MSADistanceAlgorithm; 40 class SaveDocumentController; 41 42 class DistanceMatrixMSAProfileDialog : public QDialog, public Ui_DistanceMatrixMSAProfileDialog { 43 Q_OBJECT 44 45 public: 46 DistanceMatrixMSAProfileDialog(QWidget *p, MSAEditor *ctx); 47 48 void accept(); 49 50 private slots: 51 void sl_formatSelected(); 52 void sl_formatChanged(const QString &newFormatId); 53 54 private: 55 void initSaveController(); 56 57 MSAEditor *ctx; 58 SaveDocumentController *saveController; 59 60 static const QString HTML; 61 static const QString CSV; 62 }; 63 64 enum DistanceMatrixMSAProfileOutputFormat { 65 DistanceMatrixMSAProfileOutputFormat_Show, 66 DistanceMatrixMSAProfileOutputFormat_CSV, 67 DistanceMatrixMSAProfileOutputFormat_HTML 68 }; 69 70 class DistanceMatrixMSAProfileTaskSettings { 71 public: 72 DistanceMatrixMSAProfileTaskSettings(); 73 74 QString algoId; // selected algorithm id 75 QString profileName; // usually object name 76 QString profileURL; // document url 77 MultipleSequenceAlignment ma; 78 bool usePercents; // report percents but not counts 79 bool excludeGaps; // exclude gaps when calculate distance 80 bool showGroupStatistic; 81 DistanceMatrixMSAProfileOutputFormat outFormat; 82 QString outURL; 83 MSAEditor *ctx; 84 }; 85 86 class DistanceMatrixMSAProfileTask : public Task { 87 Q_OBJECT 88 public: 89 DistanceMatrixMSAProfileTask(const DistanceMatrixMSAProfileTaskSettings &s); 90 91 virtual void prepare(); 92 QString generateReport() const; 93 virtual bool isReportingEnabled() const; 94 95 void createDistanceTable(MSADistanceAlgorithm *algo, const QList<MultipleSequenceAlignmentRow> &rows, QFile *f); 96 97 QList<Task *> createStatisticsDocument(Task *subTask); 98 99 QList<Task *> onSubTaskFinished(Task *subTask); 100 // void run(); 101 ReportResult report(); 102 103 private: 104 DistanceMatrixMSAProfileTaskSettings s; 105 QString resultText; 106 }; 107 108 } // namespace U2 109 110 #endif 111