Skip to content
Snippets Groups Projects
Commit acf0c54c authored by Olivier Langella's avatar Olivier Langella
Browse files

button layout

parent fd4a185b
No related branches found
No related tags found
No related merge requests found
...@@ -137,31 +137,34 @@ void ProteinXtp::parseAccession2dbxref() { ...@@ -137,31 +137,34 @@ void ProteinXtp::parseAccession2dbxref() {
qDebug() << "ProteinXtp::parseAccession2dbxref accession " << accession; qDebug() << "ProteinXtp::parseAccession2dbxref accession " << accession;
if (atg.indexIn(accession, 0) != -1) { if (atg.indexIn(accession, 0) != -1) {
QStringList temp = accession.split("\\."); QStringList temp = accession.split("\\.");
_dbxref_list.push_back(std::make_pair(ExternalDatabase::AGI_LocusCode, temp.at(0))); _dbxref_list.push_back(DbXref(ExternalDatabase::AGI_LocusCode, temp.at(0)));
} }
if (ncbi_gi.indexIn(accession, 0) != -1) { if (ncbi_gi.indexIn(accession, 0) != -1) {
_dbxref_list.push_back(std::make_pair(ExternalDatabase::NCBI_gi, accession)); _dbxref_list.push_back(DbXref(ExternalDatabase::NCBI_gi, accession));
} }
if (swiss_prot.indexIn(accession, 0) != -1) { if (swiss_prot.indexIn(accession, 0) != -1) {
qDebug() << "ProteinXtp::parseAccession2dbxref accession SwissProt " << accession; qDebug() << "ProteinXtp::parseAccession2dbxref accession SwissProt " << accession;
_dbxref_list.push_back(std::make_pair(ExternalDatabase::SwissProt, accession)); _dbxref_list.push_back(DbXref(ExternalDatabase::SwissProt, accession));
} }
if (trembl.indexIn(accession, 0) != -1) { if (trembl.indexIn(accession, 0) != -1) {
qDebug() << "ProteinXtp::parseAccession2dbxref accession TrEMBL " << accession; qDebug() << "ProteinXtp::parseAccession2dbxref accession TrEMBL " << accession;
_dbxref_list.push_back(std::make_pair(ExternalDatabase::TrEMBL, accession)); _dbxref_list.push_back(DbXref(ExternalDatabase::TrEMBL, accession));
} }
if (ref.indexIn(accession, 0) != -1) { if (ref.indexIn(accession, 0) != -1) {
_dbxref_list.push_back(std::make_pair(ExternalDatabase::ref, accession)); _dbxref_list.push_back(DbXref(ExternalDatabase::ref, accession));
} }
} }
if (_dbxref_list.size() > 1) { if (_dbxref_list.size() > 1) {
_dbxref_list.sort(); _dbxref_list.sort([] (const DbXref & first, const DbXref & second)
_dbxref_list.unique([] (const std::pair<ExternalDatabase, QString> & first, const std::pair<ExternalDatabase, QString> & second)
{ {
return ( first.first == second.first ) && (first.second == second.second); return std::tie(first.database, first.accession) < std::tie(second.database, second.accession);
});
_dbxref_list.unique([] (const DbXref & first, const DbXref & second)
{
return ( first.database == second.database ) && (first.accession == second.accession);
}); });
} }
...@@ -169,6 +172,6 @@ void ProteinXtp::parseAccession2dbxref() { ...@@ -169,6 +172,6 @@ void ProteinXtp::parseAccession2dbxref() {
} }
const std::list<std::pair<ExternalDatabase, QString>> & ProteinXtp::getDbxrefList() const { const std::list<DbXref> & ProteinXtp::getDbxrefList() const {
return _dbxref_list; return _dbxref_list;
} }
...@@ -30,6 +30,12 @@ ...@@ -30,6 +30,12 @@
#ifndef PROTEIN_XTP_H #ifndef PROTEIN_XTP_H
#define PROTEIN_XTP_H #define PROTEIN_XTP_H
struct DbXref {
DbXref(ExternalDatabase database_in, const QString & accession_in):database(database), accession(accession_in) {
};
ExternalDatabase database;
QString accession;
};
class ProteinXtp; class ProteinXtp;
...@@ -68,13 +74,13 @@ public: ...@@ -68,13 +74,13 @@ public:
*/ */
void parseAccession2dbxref(); void parseAccession2dbxref();
const std::list<std::pair<ExternalDatabase, QString>> & getDbxrefList() const; const std::list<DbXref> & getDbxrefList() const;
private: private:
SequenceDatabase * _p_sequence_database; SequenceDatabase * _p_sequence_database;
bool _is_decoy=false; bool _is_decoy=false;
bool _is_contaminant=false; bool _is_contaminant=false;
std::list<std::pair<ExternalDatabase, QString>> _dbxref_list; std::list<DbXref> _dbxref_list;
}; };
#endif // PROTEIN_XTP_H #endif // PROTEIN_XTP_H
...@@ -47,6 +47,26 @@ ...@@ -47,6 +47,26 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="button_space_layout">
<item>
<layout class="QHBoxLayout" name="dbxref_list_layout"/>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item> <item>
<widget class="QLabel" name="description_label"> <widget class="QLabel" name="description_label">
<property name="text"> <property name="text">
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <pappsomspp/pappsoexception.h> #include <pappsomspp/pappsoexception.h>
#include <QMessageBox> #include <QMessageBox>
#include <cmath> #include <cmath>
#include <QPushButton>
ProteinWindow::ProteinWindow(ProjectWindow *parent): ProteinWindow::ProteinWindow(ProjectWindow *parent):
QMainWindow(parent), QMainWindow(parent),
...@@ -56,6 +57,7 @@ ProteinWindow::ProteinWindow(ProjectWindow *parent): ...@@ -56,6 +57,7 @@ ProteinWindow::ProteinWindow(ProjectWindow *parent):
ProteinWindow::~ProteinWindow() ProteinWindow::~ProteinWindow()
{ {
clearDbXrefLayout();
delete ui; delete ui;
} }
void ProteinWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identification_group) { void ProteinWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identification_group) {
...@@ -68,18 +70,34 @@ void ProteinWindow::doPeptideMatchSelected(PeptideMatch * peptide_match) { ...@@ -68,18 +70,34 @@ void ProteinWindow::doPeptideMatchSelected(PeptideMatch * peptide_match) {
} }
} }
void ProteinWindow::clearDbXrefLayout() {
for (int i = 0; i < ui->dbxref_list_layout->count(); ++i)
{
delete ui->dbxref_list_layout->itemAt(i)->widget();
}
}
void ProteinWindow::updateDisplay() { void ProteinWindow::updateDisplay() {
try { try {
clearDbXrefLayout();
ui->valid_checkbox->setCheckState(Qt::Unchecked); ui->valid_checkbox->setCheckState(Qt::Unchecked);
if (_p_protein_match->isValid()) ui->valid_checkbox->setCheckState(Qt::Checked); if (_p_protein_match->isValid()) ui->valid_checkbox->setCheckState(Qt::Checked);
ui->decoy_checkbox->setCheckState(Qt::Unchecked); ui->decoy_checkbox->setCheckState(Qt::Unchecked);
if (_p_protein_match->getProteinXtpSp().get()->isDecoy()) ui->decoy_checkbox->setCheckState(Qt::Checked); if (_p_protein_match->getProteinXtpSp().get()->isDecoy()) ui->decoy_checkbox->setCheckState(Qt::Checked);
ui->accession_label->setText(_p_protein_match->getProteinXtpSp().get()->getAccession()); ui->accession_label->setText(_p_protein_match->getProteinXtpSp().get()->getAccession());
for (std::pair<ExternalDatabase, QString> dbxref:_p_protein_match->getProteinXtpSp().get()->getDbxrefList()) { for (const DbXref & dbxref:_p_protein_match->getProteinXtpSp().get()->getDbxrefList()) {
QString accession = ui->accession_label->text().replace(dbxref.second, QString("<a href=\"\" style=\"color:%2;\">%1</a>").arg(dbxref.second).arg("blue")); QString accession = ui->accession_label->text().replace(dbxref.accession, QString("<span style=\"color:%2;\">%1</span>").arg(dbxref.accession).arg("blue"));
ui->accession_label->setText(accession); ui->accession_label->setText(accession);
qDebug() << "ProteinWindow::updateDisplay " << accession; qDebug() << "ProteinWindow::updateDisplay " << accession;
QPushButton * dbxref_button = new QPushButton(this);
dbxref_button->setText(dbxref.accession);
ui->dbxref_list_layout->addWidget(dbxref_button);
}
ui->button_space_layout->setEnabled(true);
if (ui->dbxref_list_layout->count() == 0) {
ui->button_space_layout->setEnabled(false);
} }
ui->description_label->setText(_p_protein_match->getProteinXtpSp().get()->getDescription()); ui->description_label->setText(_p_protein_match->getProteinXtpSp().get()->getDescription());
ui->sequenceTextEdit->setText(_p_protein_match->getHtmlSequence()); ui->sequenceTextEdit->setText(_p_protein_match->getHtmlSequence());
......
...@@ -49,6 +49,7 @@ public slots: ...@@ -49,6 +49,7 @@ public slots:
protected : protected :
void updateDisplay(); void updateDisplay();
void clearDbXrefLayout();
private: private:
Ui::ProteinDetailView *ui; Ui::ProteinDetailView *ui;
......
...@@ -128,11 +128,11 @@ void ProticdbMl::writeSequence(ProteinMatch * p_protein_match) { ...@@ -128,11 +128,11 @@ void ProticdbMl::writeSequence(ProteinMatch * p_protein_match) {
// <dbxref key="AT5G16390" // <dbxref key="AT5G16390"
// dbname="AGI_LocusCode"></dbxref> // dbname="AGI_LocusCode"></dbxref>
//if (prot.get_dbxref_type().equals("no") == false) { //if (prot.get_dbxref_type().equals("no") == false) {
for (const std::pair<ExternalDatabase, QString> & dbxref :p_protein_match->getProteinXtpSp().get()->getDbxrefList()) { for (const DbXref & dbxref :p_protein_match->getProteinXtpSp().get()->getDbxrefList()) {
_output_stream->writeStartElement("dbxref"); _output_stream->writeStartElement("dbxref");
_output_stream->writeAttribute("dbname", Utils::getDatabaseName(dbxref.first)); _output_stream->writeAttribute("dbname", Utils::getDatabaseName(dbxref.database));
_output_stream->writeAttribute("key", _output_stream->writeAttribute("key",
dbxref.second); dbxref.accession);
_output_stream->writeEndElement();// dbxref _output_stream->writeEndElement();// dbxref
} }
_output_stream->writeStartElement("description"); _output_stream->writeStartElement("description");
......
...@@ -31,12 +31,12 @@ ...@@ -31,12 +31,12 @@
/** \def ExternalDatabase external database references /** \def ExternalDatabase external database references
* *
*/ */
enum class ExternalDatabase { enum class ExternalDatabase: std::int8_t {
AGI_LocusCode, ///< AGI_LocusCode SwissProt =1, ///< Swiss-Prot
NCBI_gi, ///< NCBI_gi TrEMBL=2, ///< TrEMBL
SwissProt, ///< Swiss-Prot AGI_LocusCode=3, ///< AGI_LocusCode
TrEMBL, ///< TrEMBL NCBI_gi=4, ///< NCBI_gi
ref ///< ref ref=5 ///< ref
}; };
/** \def IdentificationEngine identification engine /** \def IdentificationEngine identification engine
...@@ -77,10 +77,10 @@ enum class GroupingType { ...@@ -77,10 +77,10 @@ enum class GroupingType {
*/ */
enum class MzFormat { enum class MzFormat {
unknown, ///< unknown format unknown, ///< unknown format
mzML, ///< mzML mzML, ///< mzML
mzXML, ///< mzXML mzXML, ///< mzXML
MGF, ///< Mascot format MGF, ///< Mascot format
}; };
/** \def ValidationState /** \def ValidationState
...@@ -89,9 +89,9 @@ enum class MzFormat { ...@@ -89,9 +89,9 @@ enum class MzFormat {
enum class ValidationState: std::int8_t { enum class ValidationState: std::int8_t {
notValid = 0,///< notValid : automatic filter validation failed notValid = 0,///< notValid : automatic filter validation failed
valid =1, ///< valid : automatic filter validation passed valid =1, ///< valid : automatic filter validation passed
validAndChecked=2, ///< validAndChecked : automatic filter validation passed + manual checking validAndChecked=2, ///< validAndChecked : automatic filter validation passed + manual checking
grouped=3 ///< grouped : automatic filter validation passed + manual checking + grouped grouped=3 ///< grouped : automatic filter validation passed + manual checking + grouped
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment