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_PAIR_ALIGN_H
23 #define _U2_PAIR_ALIGN_H
24 
25 #include <QCheckBox>
26 #include <QComboBox>
27 #include <QGroupBox>
28 #include <QLabel>
29 #include <QLineEdit>
30 #include <QList>
31 #include <QPushButton>
32 #include <QString>
33 #include <QStringList>
34 #include <QToolButton>
35 #include <QVBoxLayout>
36 #include <QWidget>
37 
38 #include <U2Gui/SuggestCompleter.h>
39 
40 #include "../MsaOpSavableTab.h"
41 #include "../SequenceSelectorWidgetController.h"
42 #include "ui_PairwiseAlignmentOptionsPanelWidget.h"
43 
44 namespace U2 {
45 
46 class AlignmentAlgorithm;
47 class AlignmentAlgorithmMainWidget;
48 class MaModificationInfo;
49 class MSADistanceAlgorithm;
50 class MSAEditor;
51 class PairwiseAlignmentTaskSettings;
52 class SaveDocumentController;
53 class ShowHideSubgroupWidget;
54 
55 class U2VIEW_EXPORT PairAlign : public QWidget, public Ui_PairwiseAlignmentOptionsPanelWidget {
56     Q_OBJECT
57     Q_DISABLE_COPY(PairAlign)
58 
59 public:
60     PairAlign(MSAEditor *_msa);
61 
62 private slots:
63     void sl_algorithmSelected(const QString &algorithmName);
64     void sl_subwidgetStateChanged(const QString &id);
65     void sl_inNewWindowCheckBoxChangeState(bool newState);
66     void sl_alignButtonPressed();
67     void sl_outputFileChanged();
68 
69     void sl_distanceCalculated();
70     void sl_alignComplete();
71     void sl_selectorTextChanged();
72     void sl_checkState();
73     void sl_alignmentChanged();
74 
75 private:
76     void initLayout();
77     void initParameters();
78     void connectSignals();
79     void checkState();
80     void updatePercentOfSimilarity();
81     bool checkSequenceNames();
82     AlignmentAlgorithm *getAlgorithmById(const QString &algorithmId);
83     /* Updates label with warning message. Types: 0 -> bad alphabet, 1 -> same sequences in selectors. */
84     void updateWarningMessage(int warningMessageType);
85     void initSaveController();
86     /* Checks if the given sequence is in the alignment */
87     bool isValidSequenceId(qint64 sequenceId) const;
88     static QString getDefaultFilePath();
89 
90     MSAEditor *msa;
91     PairwiseAlignmentWidgetsSettings *pairwiseAlignmentWidgetsSettings;
92     MSADistanceAlgorithm *distanceCalcTask;
93 
94     AlignmentAlgorithmMainWidget *settingsWidget;  // created by factories on demand
95 
96     ShowHideSubgroupWidget *showHideSequenceWidget;
97     ShowHideSubgroupWidget *showHideSettingsWidget;
98     ShowHideSubgroupWidget *showHideOutputWidget;
99 
100     SequenceSelectorWidgetController *firstSeqSelectorWC;
101     SequenceSelectorWidgetController *secondSeqSelectorWC;
102 
103     SaveDocumentController *saveController;
104     MsaOpSavableTab savableTab;
105 
106     bool showSequenceWidget;
107     bool showAlgorithmWidget;
108     bool showOutputWidget;
109 
110     bool firstSequenceSelectionOn;
111     bool secondSequenceSelectionOn;
112 
113     bool sequencesChanged;
114     bool sequenceNamesIsOk;
115     bool alphabetIsOk;  // no RNA alphabet allowed
116     bool canDoAlign;
117 };
118 
119 }  // namespace U2
120 
121 #endif  // PAIR_ALIGN_H
122