Skip to content

Commit

Permalink
GSvar: added search box to disease/phenotype data in gene tab.
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-sturm committed Dec 4, 2023
1 parent 061bfda commit 1fe1d82
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 49 deletions.
41 changes: 34 additions & 7 deletions src/GSvar/GeneWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ GeneWidget::GeneWidget(QWidget* parent, QByteArray symbol)
connect(ui_.variation_btn, SIGNAL(clicked(bool)), this, SLOT(showGeneVariationDialog()));
connect(ui_.pseudogenes, SIGNAL(linkActivated(QString)), this, SLOT(parseLink(QString)));
connect(ui_.type, SIGNAL(linkActivated(QString)), this, SLOT(openGeneTab(QString)));
connect(ui_.pheno_search, SIGNAL(editingFinished()), this, SLOT(updatePhenotypeSearch()));

//edit button
QMenu* menu = new QMenu();
Expand Down Expand Up @@ -148,7 +149,7 @@ void GeneWidget::updateGUI()
ui_.hgnc_synonymous->setText(db.synonymousSymbols(gene_id).join(", "));

//show phenotypes/diseases from HPO
QStringList hpo_links;
hpo_lines.clear();
PhenotypeList pheno_list = db.phenotypes(symbol_);
foreach(const Phenotype& pheno, pheno_list)
{
Expand All @@ -165,12 +166,12 @@ void GeneWidget::updateGUI()
}

}
hpo_links << "<a href=\"https://hpo.jax.org/app/browse/term/" + pheno.accession()+ "\">" + pheno.accession() + "</a> " + pheno.name() + " (sources: " + sources.toList().join(", ") + ")";
hpo_lines << "<a href=\"https://hpo.jax.org/app/browse/term/" + pheno.accession()+ "\">" + pheno.accession() + "</a> " + pheno.name() + " (sources: " + sources.toList().join(", ") + ")";
}
ui_.hpo->setText(hpo_links.join("<br>"));
ui_.hpo->setText(hpo_lines.join("<br>"));

//show OMIM info
QStringList omim_lines;
omim_lines.clear();
QList<OmimInfo> omim_infos = db.omimInfo(symbol_);
foreach(const OmimInfo& omim, omim_infos)
{
Expand All @@ -184,17 +185,17 @@ void GeneWidget::updateGUI()
ui_.omim->setText(omim_lines.join("<br>"));

//show OrphaNet info
QByteArrayList orpha_links;
orpha_lines.clear();
SqlQuery query = db.getQuery();
query.exec("SELECT dt.* FROM disease_term dt, disease_gene dg WHERE dg.disease_term_id=dt.id AND dt.source='OrphaNet' AND dg.gene='" + symbol_ + "'");
while (query.next())
{
QByteArray identifier = query.value("identifier").toByteArray();
QByteArray number = identifier.mid(6);
QByteArray name = query.value("name").toByteArray();
orpha_links << ("<a href=\"https://www.orpha.net/consor/cgi-bin/OC_Exp.php?Expert=" + number + "\">" + identifier + "</a> " + name);
orpha_lines << ("<a href=\"https://www.orpha.net/consor/cgi-bin/OC_Exp.php?Expert=" + number + "\">" + identifier + "</a> " + name);
}
ui_.diseases->setText(orpha_links.join(orpha_links.count()>20 ? " " : "<br>"));
ui_.diseases->setText(orpha_lines.join("<br>"));

updateTranscriptsTable(db);
}
Expand Down Expand Up @@ -264,6 +265,32 @@ void GeneWidget::openGeneTab(QString symbol)
GlobalServiceProvider::openGeneTab(symbol);
}

void GeneWidget::updatePhenotypeSearch()
{
QString search_text = ui_.pheno_search->text().trimmed();

QStringList tmp;
foreach(const QString& line, omim_lines)
{
if (line.contains(search_text, Qt::CaseInsensitive)) tmp << line;
}
ui_.omim->setText(tmp.join("<br>"));

tmp.clear();
foreach(const QString& line, orpha_lines)
{
if (line.contains(search_text, Qt::CaseInsensitive)) tmp << line;
}
ui_.diseases->setText(tmp.join("<br>"));

tmp.clear();
foreach(const QString& line, hpo_lines)
{
if (line.contains(search_text, Qt::CaseInsensitive)) tmp << line;
}
ui_.hpo->setText(tmp.join("<br>"));
}

void GeneWidget::updateTranscriptsTable(NGSD& db)
{
//clear
Expand Down
4 changes: 4 additions & 0 deletions src/GSvar/GeneWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ private slots:
void openGeneDatabase();
void parseLink(QString link);
void openGeneTab(QString symbol);
void updatePhenotypeSearch();

private:
Ui::GeneWidget ui_;
QByteArray symbol_;
QStringList omim_lines;
QStringList orpha_lines;
QStringList hpo_lines;

void updateTranscriptsTable(NGSD& db);
};
Expand Down
126 changes: 84 additions & 42 deletions src/GSvar/GeneWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0">
<property name="spacing">
<number>3</number>
</property>
Expand Down Expand Up @@ -607,13 +607,7 @@
<property name="flat">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout_2">
<property name="horizontalSpacing">
<number>3</number>
</property>
<property name="verticalSpacing">
<number>3</number>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,1,0,0">
<property name="leftMargin">
<number>3</number>
</property>
Expand All @@ -626,7 +620,23 @@
<property name="bottomMargin">
<number>3</number>
</property>
<item row="2" column="1">
<property name="spacing">
<number>3</number>
</property>
<item row="4" column="0" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="QLabel" name="hpo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
Expand All @@ -648,38 +658,53 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>HPO phenotypes:</string>
<string>OMIM phenotypes:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<item row="2" column="2">
<widget class="QLabel" name="diseases">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>OMIM phenotypes:</string>
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_12">
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>OrphaNet diseases:</string>
<string>HPO phenotypes:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="0" column="2">
<widget class="QLabel" name="omim">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
Expand All @@ -694,35 +719,52 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="diseases">
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string/>
</property>
<property name="openExternalLinks">
<bool>true</bool>
<string>OrphaNet diseases:</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="0" column="3" rowspan="5">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>3</number>
</property>
<item>
<widget class="QLineEdit" name="pheno_search">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>Search</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
Expand Down
7 changes: 7 additions & 0 deletions src/GSvar/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ MainWindow::MainWindow(QWidget *parent)
debug_btn->menu()->addAction("variant: chr1:948519-948519 T>G", this, SLOT(openDebugTab()));
debug_btn->menu()->addSeparator();
debug_btn->menu()->addAction("gene: BRCA2", this, SLOT(openDebugTab()));
debug_btn->menu()->addSeparator();
debug_btn->menu()->addAction("processed sample: NA12878_58", this, SLOT(openDebugTab()));
debug_btn->menu()->addAction("processed sample: NA12878_45", this, SLOT(openDebugTab()));
ui_.tools->addWidget(debug_btn);
}
ui_.actionEncrypt->setVisible(Settings::boolean("debug_mode_enabled", true));
Expand Down Expand Up @@ -1601,6 +1604,10 @@ void MainWindow::openDebugTab()
{
openGeneTab(text.mid(5).trimmed());
}
else if (text.startsWith("processed sample:"))
{
openProcessedSampleTab(text.mid(17).trimmed());
}
else
{
THROW(ProgrammingException, "Unprocessed debug action: " + text);
Expand Down

0 comments on commit 1fe1d82

Please sign in to comment.