libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::OboTermForm Class Reference

#include <obotermform.h>

Inheritance diagram for pappso::OboTermForm:

Public Slots

void displayOboTerm (OboPsiModTerm oboTerm)

Public Member Functions

 OboTermForm (QWidget *parent=nullptr)
 ~OboTermForm ()
bool isOboTerm () const
 tells if an OBO term is displayed
const OboPsiModTerm & getOboPsiModTerm () const
 get the obo term or an exception

Protected Member Functions

void parseDefinitionLabel ()
 parse the definition label to extract external links

Private Attributes

Ui::OboTermForm * ui
OboPsiModTerm m_oboPsiModTerm

Static Private Attributes

static QRegularExpression m_findExternalLinks

Detailed Description

Definition at line 44 of file obotermform.h.

Constructor & Destructor Documentation

◆ OboTermForm()

OboTermForm::OboTermForm ( QWidget * parent = nullptr)
explicit

Default constructor

Definition at line 43 of file obotermform.cpp.

43 : QWidget(parent), ui(new Ui::OboTermForm)
44{
45 qDebug();
46 ui->setupUi(this);
47
48 OboPsiModTerm empty;
49 displayOboTerm(empty);
50}
void displayOboTerm(OboPsiModTerm oboTerm)
Ui::OboTermForm * ui
Definition obotermform.h:78

References OboTermForm(), displayOboTerm(), and ui.

Referenced by OboTermForm().

◆ ~OboTermForm()

pappso::OboTermForm::~OboTermForm ( )

Destructor

Definition at line 52 of file obotermform.cpp.

53{
54 delete ui;
55}

References ui.

Member Function Documentation

◆ displayOboTerm

void pappso::OboTermForm::displayOboTerm ( pappso::OboPsiModTerm oboTerm)
slot

Definition at line 58 of file obotermform.cpp.

59{
60 qDebug() << oboTerm.getAccession();
61 ui->accessionHttpButton->setText(oboTerm.getAccession());
62 ui->nameLabel->setText(oboTerm.m_name);
63 ui->definitionLabel->setText(oboTerm.m_definition);
64 ui->diffFormulaLabel->setText(oboTerm.m_diffFormula);
65 if(oboTerm.isValid())
66 {
67 ui->diffMonoLabel->setText(QString::number(oboTerm.m_diffMono, 'f', 4));
69 }
70 else
71 {
72 ui->diffMonoLabel->setText("");
73 }
74 ui->originLabel->setText(oboTerm.m_origin);
75 ui->psiModLabel->setText(oboTerm.m_psiModLabel);
76
77
78 m_oboPsiModTerm = oboTerm;
79}
const QString & getAccession() const
OboPsiModTerm m_oboPsiModTerm
Definition obotermform.h:80
void parseDefinitionLabel()
parse the definition label to extract external links

References pappso::OboPsiModTerm::getAccession(), pappso::OboPsiModTerm::isValid(), pappso::OboPsiModTerm::m_definition, pappso::OboPsiModTerm::m_diffFormula, pappso::OboPsiModTerm::m_diffMono, pappso::OboPsiModTerm::m_name, m_oboPsiModTerm, pappso::OboPsiModTerm::m_origin, pappso::OboPsiModTerm::m_psiModLabel, parseDefinitionLabel(), and ui.

Referenced by pappso::OboChooserWidget::OboChooserWidget(), and OboTermForm().

◆ getOboPsiModTerm()

const pappso::OboPsiModTerm & pappso::OboTermForm::getOboPsiModTerm ( ) const

get the obo term or an exception

Definition at line 82 of file obotermform.cpp.

83{
84 if(isOboTerm())
85 {
86 }
87 else
88 {
89 throw pappso::ExceptionNotFound(tr("OBO term not available"));
90 }
91 return m_oboPsiModTerm;
92}
bool isOboTerm() const
tells if an OBO term is displayed

References isOboTerm(), and m_oboPsiModTerm.

◆ isOboTerm()

bool pappso::OboTermForm::isOboTerm ( ) const

tells if an OBO term is displayed

Definition at line 95 of file obotermform.cpp.

96{
97 return m_oboPsiModTerm.isValid();
98}

References m_oboPsiModTerm.

Referenced by getOboPsiModTerm().

◆ parseDefinitionLabel()

void pappso::OboTermForm::parseDefinitionLabel ( )
protected

parse the definition label to extract external links

Definition at line 101 of file obotermform.cpp.

102{
103 QString label = ui->definitionLabel->text();
104 //"Oxidation of methionine to methionine sulfoxide with neutral loss of
105 // CH3SOH." [PubMed:18688235, PubMed:9004526]
106
107 QLayoutItem *child;
108 while((child = ui->xrefScrollAreaLayout->takeAt(0)) != 0)
109 {
110 if(child->widget() != NULL)
111 {
112 delete(child->widget());
113 }
114 delete child;
115 }
116
117 ui->xrefScrollArea->hide();
118 QRegularExpressionMatch match = m_findExternalLinks.match(label);
119 if(match.hasMatch())
120 {
121 QStringList pline = match.capturedTexts();
122 ui->definitionLabel->setText(pline[1]);
123
124 QStringList list_xref = pline[2].split(",");
125
126 ui->xrefScrollArea->show();
127 for(auto xref : list_xref)
128 {
129 HttpButton *newButton = new HttpButton;
130 newButton->setText(xref.trimmed());
131 newButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
132 ui->xrefScrollAreaLayout->addWidget(newButton);
133 }
134 }
135}
void setText(const QString &text)
static QRegularExpression m_findExternalLinks
Definition obotermform.h:83

References m_findExternalLinks, pappso::HttpButton::setText(), and ui.

Referenced by displayOboTerm().

Member Data Documentation

◆ m_findExternalLinks

QRegularExpression OboTermForm::m_findExternalLinks
staticprivate

Definition at line 83 of file obotermform.h.

Referenced by parseDefinitionLabel().

◆ m_oboPsiModTerm

OboPsiModTerm pappso::OboTermForm::m_oboPsiModTerm
private

Definition at line 80 of file obotermform.h.

Referenced by displayOboTerm(), getOboPsiModTerm(), and isOboTerm().

◆ ui

Ui::OboTermForm* pappso::OboTermForm::ui
private

Definition at line 78 of file obotermform.h.

Referenced by OboTermForm(), ~OboTermForm(), displayOboTerm(), and parseDefinitionLabel().


The documentation for this class was generated from the following files: