libpappsomspp
Library for mass spectrometry
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 More...
 
const OboPsiModTermgetOboPsiModTerm () const
 get the obo term or an exception More...
 

Protected Member Functions

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

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.

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

References displayOboTerm(), and ui.

◆ ~OboTermForm()

pappso::OboTermForm::~OboTermForm ( )

Destructor

Definition at line 53 of file obotermform.cpp.

54 {
55  delete ui;
56 }

Member Function Documentation

◆ displayOboTerm

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

Definition at line 59 of file obotermform.cpp.

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

References pappso::OboPsiModTerm::isValid(), pappso::OboPsiModTerm::m_accession, pappso::OboPsiModTerm::m_definition, pappso::OboPsiModTerm::m_diffFormula, pappso::OboPsiModTerm::m_diffMono, pappso::OboPsiModTerm::m_name, pappso::OboPsiModTerm::m_origin, and pappso::OboPsiModTerm::m_psiModLabel.

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 83 of file obotermform.cpp.

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

◆ isOboTerm()

bool pappso::OboTermForm::isOboTerm ( ) const

tells if an OBO term is displayed

Definition at line 96 of file obotermform.cpp.

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

◆ parseDefinitionLabel()

void pappso::OboTermForm::parseDefinitionLabel ( )
protected

parse the definition label to extract external links

Definition at line 102 of file obotermform.cpp.

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

References pappso::HttpButton::setText().

Member Data Documentation

◆ m_findExternalLinks

QRegularExpression OboTermForm::m_findExternalLinks
staticprivate

Definition at line 83 of file obotermform.h.

◆ m_oboPsiModTerm

OboPsiModTerm pappso::OboTermForm::m_oboPsiModTerm
private

Definition at line 80 of file obotermform.h.

◆ ui

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

Definition at line 78 of file obotermform.h.

Referenced by OboTermForm().


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