Loading...
Searching...
No Matches
pappso::OboListModel Class Reference

`#include <obolistmodel.h>`

Inheritance diagram for pappso::OboListModel:

## Classes

class | OboPsiModHandler

## Public Member Functions

| OboListModel (QObject *parent=nullptr)
| ~OboListModel ()
void | loadPsiMod ()
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override
int | rowCount (const QModelIndex &parent=QModelIndex()) const override
const OboPsiModTerm & | getOboPsiModTerm (int row) const

## Protected Attributes

std::vector< OboPsiModTerm > | m_oboPsiModTermList

## Detailed Description

Todo
  write docs

Definition at line 45 of file obolistmodel.h.

## Constructor & Destructor Documentation

## OboListModel()

OboListModel::OboListModel | ( | QObject * | parent = nullptr | ) |

Default constructor

Definition at line 42 of file obolistmodel.cpp.

: QStringListModel(parent)
{
}

## ~OboListModel()

OboListModel::~OboListModel | ( |  | ) |

Destructor

Definition at line 46 of file obolistmodel.cpp.

{
}

## Member Function Documentation

## data()

QVariant pappso::OboListModel::data | ( | const QModelIndex & | index,
|  | int | role = Qt::DisplayRole ) const

override

Definition at line 89 of file obolistmodel.cpp.

{
// generate a log message when this method gets called
std::size_t row = index.row();
// int col = index.column();
// qDebug() << QString("row %1, col%2, role %3")
// .arg(row).arg(col).arg(role);
if(row < m_oboPsiModTermList.size())
{
switch(role)
{
case Qt::CheckStateRole:
break;
case Qt::BackgroundRole:
// return QVariant(QColor("grey"));
break;
case Qt::SizeHintRole:
// qDebug() << "ProteinTableModel::headerData " <<
// ProteinTableModel::getColumnWidth(section);
// return QSize(PeptideTableModel::getColumnWidth(col), 30);
break;
case Qt::ToolTipRole:
break;
case Qt::DisplayRole:
return QVariant(QString("%1 %2 %3")
.arg(m_oboPsiModTermList[row].getAccession())
.arg(m_oboPsiModTermList[row].m_diffMono)
.arg(m_oboPsiModTermList[row].m_name));
break;
case Qt::UserRole:
QVariant value;
value.setValue(m_oboPsiModTermList[row]);
return value;
break;
}
}
return QVariant();
}
pappso::OboListModel::m_oboPsiModTermList
std::vector< OboPsiModTerm > m_oboPsiModTermList
Definition obolistmodel.h:83

References m_oboPsiModTermList.

Referenced by pappso::OboListProxyModel::lessThan().

## getOboPsiModTerm()

const pappso::OboPsiModTerm & pappso::OboListModel::getOboPsiModTerm | ( | int | row | ) | const

Definition at line 138 of file obolistmodel.cpp.

{
if(row < (int)m_oboPsiModTermList.size())
{
return m_oboPsiModTermList[row];
}
else
{
throw pappso::ExceptionNotFound(tr("OBO term not found"));
}
}

References m_oboPsiModTermList.

## loadPsiMod()

void OboListModel::loadPsiMod | ( |  | ) |

Definition at line 67 of file obolistmodel.cpp.

{
OboPsiModHandler handler(this);
OboPsiMod reader(handler);
OboUnimod unimod_reader(handler);
// https://pubchem.ncbi.nlm.nih.gov/compound/640368
OboPsiModTerm term;
term.setAccession("USER:2-Ethynylbenzaldehyde");
term.m_diffFormula = "H 4 C 9 O 0"; // C9H6O
term.m_name = "2-Ethynylbenzaldehyde";
ChemicalFormula formula;
formula.setOboPsiModTerm(term);
term.m_diffMono = formula.getMass();
m_oboPsiModTermList.push_back(term);
qDebug() << m_oboPsiModTermList.size();
}
pappso::ChemicalFormula::setOboPsiModTerm
void setOboPsiModTerm(const OboPsiModTerm &term)
get formula from an Obo term
Definition chemicalformula.cpp:352
pappso::ChemicalFormula::getMass
double getMass() const
Definition chemicalformula.cpp:296
pappso::OboListModel::OboPsiModHandler
Definition obolistmodel.h:71
pappso::OboPsiModTerm::setAccession
void setAccession(const QString &accession)
Definition obopsimodterm.cpp:267
pappso::OboPsiModTerm::m_diffFormula
QString m_diffFormula
Definition obopsimodterm.h:62
pappso::OboPsiModTerm::m_diffMono
double m_diffMono
Definition obopsimodterm.h:66
pappso::OboPsiModTerm::m_name
QString m_name
Definition obopsimodterm.h:58

References pappso::ChemicalFormula::getMass(), pappso::OboPsiModTerm::m_diffFormula, pappso::OboPsiModTerm::m_diffMono, pappso::OboPsiModTerm::m_name, m_oboPsiModTermList, pappso::OboPsiModTerm::setAccession(), and pappso::ChemicalFormula::setOboPsiModTerm().

## rowCount()

int pappso::OboListModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const

override

Definition at line 132 of file obolistmodel.cpp.

{
return (int)m_oboPsiModTermList.size();
}

References m_oboPsiModTermList.

## Member Data Documentation

## m_oboPsiModTermList

std::vector<OboPsiModTerm> pappso::OboListModel::m_oboPsiModTermList

protected

Definition at line 83 of file obolistmodel.h.

Referenced by data(), getOboPsiModTerm(), loadPsiMod(), and rowCount().

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

- pappsomspp/gui/obo/obolistwidget/obolistmodel.h
- pappsomspp/gui/obo/obolistwidget/obolistmodel.cpp