From d38c438ed42cc0541b399afc3309822d70ca07a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Sch=C3=BCtz?= Date: Tue, 14 Jan 2025 14:51:34 +0100 Subject: [PATCH] src/GSvar/MethylationWidget.cpp: Bugfix: fixed methylation image for server-client version --- src/GSvar/MethylationWidget.cpp | 12 ++++++------ src/GSvarServer/ServerController.cpp | 1 + src/cppNGSD/FileLocationProviderLocal.cpp | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/GSvar/MethylationWidget.cpp b/src/GSvar/MethylationWidget.cpp index 78eb02d0b..c73ff0696 100644 --- a/src/GSvar/MethylationWidget.cpp +++ b/src/GSvar/MethylationWidget.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "GlobalServiceProvider.h" MethylationWidget::MethylationWidget(QString filename, QWidget *parent) : @@ -82,15 +83,14 @@ void MethylationWidget::openMethylationPlot(int row_idx, int col_idx) FileLocation methylation_plot = GlobalServiceProvider::fileLocationProvider().getMethylationImage(locus); - qDebug() << methylation_plot.filename; - - if (!methylation_plot.exists) + VersatileFile file(methylation_plot.filename); + if (!file.open(QIODevice::ReadOnly)) { - GUIHelper::showMessage("File not found!", "Methylation plot for '" + locus + "' not found!"); + QMessageBox::warning(this, "Read error", "Could not open a methylation plot image file: '" + methylation_plot.filename); return; } - - QPixmap plot_data(methylation_plot.filename); + QPixmap plot_data; + plot_data.loadFromData(file.readAll()); QLabel* image_label = new QLabel(); image_label->setPixmap(plot_data); diff --git a/src/GSvarServer/ServerController.cpp b/src/GSvarServer/ServerController.cpp index 7068d7099..89a783183 100644 --- a/src/GSvarServer/ServerController.cpp +++ b/src/GSvarServer/ServerController.cpp @@ -480,6 +480,7 @@ HttpResponse ServerController::locateFileByType(const HttpRequest& request) for (int i = 0; i < file_list.count(); ++i) { + Log::info("file path: " + file_list.at(i).filename); QJsonObject cur_json_item; QJsonObject cur_json_item_without_token; cur_json_item.insert("id", file_list[i].id); diff --git a/src/cppNGSD/FileLocationProviderLocal.cpp b/src/cppNGSD/FileLocationProviderLocal.cpp index 3f455bf6d..6b29b6384 100644 --- a/src/cppNGSD/FileLocationProviderLocal.cpp +++ b/src/cppNGSD/FileLocationProviderLocal.cpp @@ -120,6 +120,7 @@ FileLocation FileLocationProviderLocal::getMethylationImage(QString locus) const { QString name = QFileInfo(gsvar_file_).baseName(); QString file = getAnalysisPath() + QDir::separator() + "methylartist" + QDir::separator() + name + "_" + locus + ".png"; + return FileLocation(name, PathType::METHYLATION_IMAGE, file, QFile::exists(file)); }