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_MSA_COLOR_SCHEME_CLUSTAL_X_H_ 23 #define _U2_MSA_COLOR_SCHEME_CLUSTAL_X_H_ 24 25 #include <QColor> 26 #include <QVector> 27 28 #include "MsaColorScheme.h" 29 30 namespace U2 { 31 32 // 0.5 * alisize mem use, slow update 33 class U2ALGORITHM_EXPORT MsaColorSchemeClustalX : public MsaColorScheme { 34 Q_OBJECT 35 public: 36 MsaColorSchemeClustalX(QObject *parent, const MsaColorSchemeFactory *factory, MultipleAlignmentObject *maObj); 37 38 QColor getBackgroundColor(int seq, int pos, char c) const override; 39 QColor getFontColor(int seq, int pos, char c) const override; 40 41 private slots: 42 void sl_alignmentChanged(); 43 44 private: 45 void updateCache() const; 46 int getCacheIdx(int seq, int pos, bool &low) const; 47 48 int getColorIdx(int seq, int pos) const; 49 void setColorIdx(int seq, int pos, int cidx) const; 50 51 enum ClustalColor { 52 ClustalColor_NO_COLOR, 53 ClustalColor_BLUE, 54 ClustalColor_RED, 55 ClustalColor_GREEN, 56 ClustalColor_PINK, 57 ClustalColor_MAGENTA, 58 ClustalColor_ORANGE, 59 ClustalColor_CYAN, 60 ClustalColor_YELLOW, 61 ClustalColor_NUM_COLORS 62 }; 63 64 int objVersion; 65 mutable int cacheVersion; 66 mutable int aliLen; 67 mutable QVector<quint8> colorsCache; 68 QColor colorByIdx[ClustalColor_NUM_COLORS]; 69 }; 70 71 class MsaColorSchemeClustalXFactory : public MsaColorSchemeFactory { 72 Q_OBJECT 73 public: 74 MsaColorSchemeClustalXFactory(QObject *parent, const QString &id, const QString &name, const AlphabetFlags &supportedAlphabets); 75 76 MsaColorScheme *create(QObject *parent, MultipleAlignmentObject *maObj) const; 77 }; 78 79 } // namespace U2 80 81 #endif // _U2_MSA_COLOR_SCHEME_CLUSTAL_X_H_ 82