1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
|
/**
* @author Mark Larkin, Conway Institute, UCD. mark.larkin@ucd.ie
*
* CHANGES:
* Mark: Jan 16th 2007. I am working on Bugzilla bug 11. Allowing the user to
* paste sequences into the lower profile even though there has only been one
* profile added. I have changed the pasteSequences() function.
* Mark: Jan 18th 2007. Bugzilla bug 3. Changed the way Files are opened
*
* 12-4-07, Mark Larkin : Changed destructor. We dont need to delete QObjects.
*
* 25-04-07,Nigel Brown(EMBL): Added keyPressEvent() and keyReleaseEvent().
*
* 16-5-07, Mark Larkin: Added a submenu to the tree menu to allow the selection of
* NJ or UPGMA for tree construction. Also added support functions.
* Also added a sub menu for iteration selection.
*
* 22-5-2007, Mark Larkin: added function hideLowScoreSegs()
*
* 23-5-2007, Mark Larkin: added resetAndHideLowScoreSeqs()
*
* 24-05-07,Nigel Brown(EMBL): simplified default parameter loading mechanism;
* removed setPathToExecutable(), removeExecutableNameFromPath(),
* executablePath members. Added loadDefaultParamFile().
*
* 2007-12-03, Andreas Wilm (UCD): moved loadSequences() with optional
* file argument to public slot
*
****************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <list>
#include "AlignmentViewerWidget.h"
#include "AlignmentFormatOptions.h"
#include "TreeFormatOptions.h"
#include "ProteinGapParameters.h"
#include "AlignmentParameters.h"
#include "ColumnScoreParams.h"
#include "LowScoringSegParams.h"
#include "PairwiseParams.h"
#include "clustalW/Clustal.h"
#include "clustalW/general/userparams.h"
#include "clustalW/alignment/Sequence.h"
#include "ColorFileXmlParser.h"
#include "ColorParameters.h"
#include "SearchForString.h"
#include "version.h"
class QAction;
class QActionGroup;
class QLabel;
class QMenu;
class QComboBox;
class QStringList;
class QGroupBox;
class QTextEdit;
class QListView;
class QListWidget;
class QListWidgetItem;
class QTextCursor;
class QFont;
class QTableView;
class QScrollArea;
class QScrollBar;
class QCheckBox;
class QVBoxLayout;
class QHBoxLayout;
class QKeyEvent;
/**
* This class is an extension of the widget QMainWindow. It contains an
* alignment widget, a histogram widget and a sequence name widget.
* It is currently used as an alignment viewer, but it will be possible to extend its
* functionality to an alignment editor.
*/
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
~MainWindow();
public slots:
void loadSequences(QString myFile = "");
void commandLineHelp();
// the following are public so they can be called from main.cpp at startup
void setProfileModeCmd();
void loadProfile1(string myFile);
void loadProfile2(string myFile);
protected:
/*
* slots are functions, they can be linked to signals
*/
void showEvent(QShowEvent* event);
private slots:
void changeMode(int mode);
void enableProfileActions();
void enableSequenceActions();
// Functions for menu actions
// File menu
void appendSequences();
void saveSequencesAs();
void loadProfile1();
void loadProfile2();
void saveProfile1As();
void saveProfile2As();
void writeAlignmentAsPostscript();
void writeProfile1AsPostscript();
void writeViewer1AsPostscript(int type);
void writeProfile2AsPostscript();
void quitProgram();
// Edit menu
void cutSequences();
void pasteSequences();
void selectAllSequences();
void selectProfile1();
void selectProfile2();
void addProfile2ToProfile1();
void clearSequenceSelection();
void clearRangeSelection();
void searchForString();
void removeAllGaps();
void removeGapOnlyColumns();
//Alignment menu
void doCompleteAlignment();
void produceGuideTreeOnly();
void doAlignmentFromGuideTree();
void realignSelectedSequences();
void realignSelectedResidueRange();
void alignProfile2ToProfile1();
void alignProfilesFromGuideTrees();
void alignSequencesToProfile1();
void alignSequencesToProfile1FromTree();
void outputFormatOptions();
void setDefaultParameters();
// Submenu
void resetNewGapsBeforeAlignment();
void resetAllGapsBeforeAlignment();
void pairwiseAlignmentParameters();
void multipleAlignmentParameters();
void proteinGapParameters();
void secondaryStructureParameters();
// Tree menu
void drawNJTree();
void bootstrapNJTree();
void excludePositionsWithGaps();
void correctForMultipleSubstitutions();
void treeOutputFormatOptions();
// Colors menu
void backgroundColoring();
void blackAndWhite();
void defaultColors();
void loadColorParameterFile();
// Quality menu
void showLowScoreSeg();
void showExceptionalRes();
void lowScoreSegParams();
void columnScoreParams();
void saveColumnScoresToFile();
// Help menu
void generalHelp();
void inputOutputHelp();
void editAlignHelp();
void multiAlignHelp();
void profileAlignHelp();
void secondaryStructureHelp();
void treesHelp();
void colorsHelp();
void alignQualityHelp();
void referencesHelp();
// Clustering algorithm submenu
void setUPGMA(); // Mark 16-5-07
void setNJ(); // Mark 16-5-07
// Iteration submenu
void setNoIteration(); // Mark 16-5-07
void setTreeIteration(); // Mark 16-5-07
void setAlignIteration(); // Mark 16-5-07
void scrollLockClicked();
void searchFromStart();
void searchAgain();
private:
void createActions();
void createMenus();
void createAlignModeMenu();
void createFontMenu();
void createHorizontalBox();
void errorHandler(int errorCode, string offendingSeq=NULL);
void calculateLowScoreAlign();
void calculateLowScoreProfile();
void recalculateLowScoreSegments();
void loadDefaultParamFile(const QString &fileName, ColorParameters* colorParam,
bool showMessage = true); //- nige
bool readInParamFile(QString file, ColorParameters* colorParam, bool showMessage = true);
void setUpSearchForStringDialog();
bool findNextInstanceOfString(const std::vector<int>* seqsSelected, int firstSeq,
Viewer viewerSearched);
vector<int> getAllSelectedSeqsVector();
bool allSeqsInAlignmentOrProfileSelected(std::vector<int>* seqsSelected);
bool anySeqsSelected();
void setAllPtrsToZero();
void hideLowScoreSegs();
void resetAndHideLowScoreSeqs();
QVBoxLayout *mainlayout;
QWidget *sideFiller;
QHBoxLayout *layoutHbox;
AlignmentViewerWidget* alignmentViewer; // Displayes alignment
AlignmentViewerWidget* profile2Viewer; // displays profile 2
clustalw::Clustal* clustalObj;
clustalw::Alignment* alignPtr;
int profileMode;
int multiMode;
int currentMode;
QWidget *w;
QMenu *fileMenu;
QMenu *editMenu;
QMenu *alignmentMenu;
QMenu *treeMenu;
QMenu *colorMenu;
QMenu *qualityMenu;
QMenu *helpMenu;
list<QMenu *> toplevelMenuList;// AW used for enabling/disabling menus
QMenu *treeSubMenu; // Mark 16-5-07
QMenu *iterationSubMenu; // Mark 16-5-07
QComboBox *alignmentModeMenu;
QComboBox *fontMenu;
/*
* Each command in Qt is usually implemented as an action.
* These are the commands for the file menu
*/
QActionGroup *alignmentGroup;
QAction *actionLoadSequences;
QAction *actionAppendSequences;
QAction *actionSaveSeqAs;
QAction *actionLoadProfile1;
QAction *actionLoadProfile2;
QAction *actionSaveProfile1As;
QAction *actionSaveProfile2As;
QAction *actionWriteAlignmentAsPost;
QAction *actionWriteProfile1AsPost;
QAction *actionWriteProfile2AsPost;
QAction *actionQuit;
/*
* Actions for the clustal edit menu
*/
QAction *actionCutSequences;
QAction *actionPasteSequences;
QAction *actionSelectAllSequences;
QAction *actionSelectProfile1;
QAction *actionSelectProfile2;
QAction *actionAddProfile2ToProfile1;
QAction *actionClearSequenceSelection;
QAction *actionClearRangeSelection;
QAction *actionSearchForString;
QAction *actionRemoveAllGaps;
QAction *actionRemoveGapOnlyColumns;
/*
* Actions for the Alignment menu
*/
QAction *actionDoCompleteAlign;
QAction *actionDoGuideTreeOnly;
QAction *actionDoAlignmentFromGuideTree;
QAction *actionRealignSelectSeq;
QAction *actionRealignSelectRange;
QAction *actionAlignProfile1ToProfile2;
QAction *actionAlignProfileFromTree;
QAction *actionAlignSequencesToProfile1;
QAction *actionAlignSequencesToProfile1FromTree;
QMenu *menuAlignParameters;
QAction *actionOutputFormatOptions;
QAction *actionResetNewGapsBeforeAlignment;
QAction *actionResetAllGapsBeforeAlignment;
QAction *actionPairwiseAlignmentParameters;
QAction *actionMultipleAlignmentParameters;
QAction *actionProteinGapParameters;
QAction *actionSecondaryStructureParameters;
QAction *actionSetDefaultParameters;
/*
* Actions for the Tree menu
*/
QAction *actionDrawNJTree;
QAction *actionBootstrapNJTree;
QAction *actionExcludePosWithGap;
QAction *actionCorrectForMultiSub;
QAction *actionTreeOutputFormatOptions;
/*
* Actions for the color Menu
*/
QAction *actionBackColoring;
QAction *actionBlackAndWhite;
QAction *actionDefaultColors;
QAction *actionLoadColorParameterFile;
/*
* Actions for the quality Menu
*/
QAction *actionShowLowScoreSeg;
QAction *actionShowExceptionalRes;
QAction *actionLowScoreSegParams;
QAction *actionColumnScoreParams;
QAction *actionSaveColumnScoresToFile;
/*
* Actions for the help menu
*/
QAction *actionGeneralHelp;
QAction *actionInputOutputHelp;
QAction *actionEditAlignHelp;
QAction *actionMultiAlignHelp;
QAction *actionProfileAlignHelp;
QAction *actionSecondaryStructureHelp;
QAction *actionTreesHelp;
QAction *actionColorsHelp;
QAction *actionAlignQualityHelp;
QAction *actionCommandLineHelp;
QAction *actionReferencesHelp;
/** Mark 16-5-07
* Actions for the Clustering algorithm sub menu
*/
QAction *actionUseUPGMA; // Mark 16-5-07
QAction *actionUseNJ; // Mark 16-5-07
/** Mark 16-5-07
* Actions for the iteration sub menu
*/
QAction *actionNoIteration; // Mark 16-5-07
QAction *actionTreeIteration; // Mark 16-5-07
QAction *actionAlignIteration; // Mark 16-5-07
QGroupBox *horizontalGroupBox;
QCheckBox* profileScrollLock;
/*
* The main font for the application
*/
QFont displayFont;
AlignmentParameters* alignmentParams;
PairwiseParams* pairwiseParams;
ColumnScoreParams* colScoreParams;
LowScoringSegParams* lowScoreParams;
SearchForString* searchSeqs;
bool showExceptionalResidues;
bool showLowScoreSegments;
bool seqWeightCalculatedAlignmentViewer;
vector<int>* lowScoreSeqWeightAlignmentViewer; // Should be nSeqs long + 1
clustalw::Array2D<int>* lowScoreResAlignmentViewer;
bool seqWeightCalculatedProfile2Viewer;
vector<int>* lowScoreSeqWeightProfile2Viewer; // Should be nSeqs long + 1
clustalw::Array2D<int>* lowScoreResProfile2Viewer;
QLabel* fontLabel;
QLabel* alignModeLabel;
QLabel* bottomInfoLabel;
ColorParameters proteinColors;
ColorParameters dnaColors;
ColorParameters userColors;
ColorParameters printerColors;
QString protColorFile;
QString dnaColorFile;
QString printerColorFile;
QString sequenceFileName;
QString profile2FileName;
bool backGroundColors;
int searchBeginSeq;
int searchBeginRes;
std::string searchString;
vector<clustalw::Sequence> cutSeqs;
//- nige
void keyPressEvent(QKeyEvent *);
void keyReleaseEvent(QKeyEvent *);
void toplevelMenusEnabled(bool b);
};
#endif
|