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() {
qDebug() << "ProteinXtp::parseAccession2dbxref accession " << accession;
if (atg.indexIn(accession, 0) != -1) {
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) {
_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) {
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) {
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) {
_dbxref_list.push_back(std::make_pair(ExternalDatabase::ref, accession));
_dbxref_list.push_back(DbXref(ExternalDatabase::ref, accession));
}
}
if (_dbxref_list.size() > 1) {
_dbxref_list.sort();
_dbxref_list.unique([] (const std::pair<ExternalDatabase, QString> & first, const std::pair<ExternalDatabase, QString> & second)
_dbxref_list.sort([] (const DbXref & first, const DbXref & 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() {
}
const std::list<std::pair<ExternalDatabase, QString>> & ProteinXtp::getDbxrefList() const {
const std::list<DbXref> & ProteinXtp::getDbxrefList() const {
return _dbxref_list;
}
......@@ -30,6 +30,12 @@
#ifndef 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;
......@@ -68,13 +74,13 @@ public:
*/
void parseAccession2dbxref();
const std::list<std::pair<ExternalDatabase, QString>> & getDbxrefList() const;
const std::list<DbXref> & getDbxrefList() const;
private:
SequenceDatabase * _p_sequence_database;
bool _is_decoy=false;
bool _is_contaminant=false;
std::list<std::pair<ExternalDatabase, QString>> _dbxref_list;
std::list<DbXref> _dbxref_list;
};
#endif // PROTEIN_XTP_H
......@@ -47,6 +47,26 @@
</property>
</widget>
</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>
<widget class="QLabel" name="description_label">
<property name="text">
......
......@@ -27,6 +27,7 @@
#include <pappsomspp/pappsoexception.h>
#include <QMessageBox>
#include <cmath>
#include <QPushButton>
ProteinWindow::ProteinWindow(ProjectWindow *parent):
QMainWindow(parent),
......@@ -56,6 +57,7 @@ ProteinWindow::ProteinWindow(ProjectWindow *parent):
ProteinWindow::~ProteinWindow()
{
clearDbXrefLayout();
delete ui;
}
void ProteinWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identification_group) {
......@@ -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() {
try {
clearDbXrefLayout();
ui->valid_checkbox->setCheckState(Qt::Unchecked);
if (_p_protein_match->isValid()) ui->valid_checkbox->setCheckState(Qt::Checked);
ui->decoy_checkbox->setCheckState(Qt::Unchecked);
if (_p_protein_match->getProteinXtpSp().get()->isDecoy()) ui->decoy_checkbox->setCheckState(Qt::Checked);
ui->accession_label->setText(_p_protein_match->getProteinXtpSp().get()->getAccession());
for (std::pair<ExternalDatabase, QString> 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"));
for (const DbXref & dbxref:_p_protein_match->getProteinXtpSp().get()->getDbxrefList()) {
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);
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->sequenceTextEdit->setText(_p_protein_match->getHtmlSequence());
......
......@@ -49,6 +49,7 @@ public slots:
protected :
void updateDisplay();
void clearDbXrefLayout();
private:
Ui::ProteinDetailView *ui;
......
......@@ -128,11 +128,11 @@ void ProticdbMl::writeSequence(ProteinMatch * p_protein_match) {
// <dbxref key="AT5G16390"
// dbname="AGI_LocusCode"></dbxref>
//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->writeAttribute("dbname", Utils::getDatabaseName(dbxref.first));
_output_stream->writeAttribute("dbname", Utils::getDatabaseName(dbxref.database));
_output_stream->writeAttribute("key",
dbxref.second);
dbxref.accession);
_output_stream->writeEndElement();// dbxref
}
_output_stream->writeStartElement("description");
......
......@@ -31,12 +31,12 @@
/** \def ExternalDatabase external database references
*
*/
enum class ExternalDatabase {
AGI_LocusCode, ///< AGI_LocusCode
NCBI_gi, ///< NCBI_gi
SwissProt, ///< Swiss-Prot
TrEMBL, ///< TrEMBL
ref ///< ref
enum class ExternalDatabase: std::int8_t {
SwissProt =1, ///< Swiss-Prot
TrEMBL=2, ///< TrEMBL
AGI_LocusCode=3, ///< AGI_LocusCode
NCBI_gi=4, ///< NCBI_gi
ref=5 ///< ref
};
/** \def IdentificationEngine identification engine
......@@ -77,10 +77,10 @@ enum class GroupingType {
*/
enum class MzFormat {
unknown, ///< unknown format
mzML, ///< mzML
mzXML, ///< mzXML
MGF, ///< Mascot format
unknown, ///< unknown format
mzML, ///< mzML
mzXML, ///< mzXML
MGF, ///< Mascot format
};
/** \def ValidationState
......@@ -89,9 +89,9 @@ enum class MzFormat {
enum class ValidationState: std::int8_t {
notValid = 0,///< notValid : automatic filter validation failed
valid =1, ///< valid : automatic filter validation passed
validAndChecked=2, ///< validAndChecked : automatic filter validation passed + manual checking
grouped=3 ///< grouped : automatic filter validation passed + manual checking + grouped
valid =1, ///< valid : automatic filter validation passed
validAndChecked=2, ///< validAndChecked : automatic filter validation passed + manual checking
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