diff --git a/src/gui/mcqr_run_view/mcqr_sds_widget/mcqrsdswidget.cpp b/src/gui/mcqr_run_view/mcqr_sds_widget/mcqrsdswidget.cpp index efdd977449deb3e5bb412bc1e10bb3ccbc93f082..945f31fcfb45778486d5ad8212b306e9eca72b8e 100644 --- a/src/gui/mcqr_run_view/mcqr_sds_widget/mcqrsdswidget.cpp +++ b/src/gui/mcqr_run_view/mcqr_sds_widget/mcqrsdswidget.cpp @@ -243,8 +243,8 @@ McqrSdsWidget::analyseQualityData() grantlee_context.insert("factors_list", factors_list.join("\", \"")); - getMcqrRunParentView()->getRProcessRunning()->write( - msp_rscriptTemplate->render(&grantlee_context).toUtf8()); + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( + "analyzing_sc", msp_rscriptTemplate->render(&grantlee_context)); } } @@ -291,8 +291,8 @@ McqrSdsWidget::filteringData() ui->fc_cutoff_spinbox->value()); grantlee_context.insert("factors_list", factors.join("\", \"")); - getMcqrRunParentView()->getRProcessRunning()->write( - msp_rscriptTemplate->render(&grantlee_context).toUtf8()); + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( + "filtering_sc", msp_rscriptTemplate->render(&grantlee_context)); } } @@ -348,8 +348,9 @@ McqrSdsWidget::plotProteinHeatmapAbundance() grantlee_context.insert("agg_method", ui->agg_method_combobox->currentText()); - getMcqrRunParentView()->getRProcessRunning()->write( - msp_rscriptTemplate->render(&grantlee_context).toUtf8()); + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( + "heatmap_abundance", + msp_rscriptTemplate->render(&grantlee_context)); } else { @@ -392,8 +393,8 @@ McqrSdsWidget::runProteinClustering() grantlee_context.insert("factor_list", factors_list.join("\", \"")); grantlee_context.insert("nb_cluster", ui->cluster_spin->value()); - getMcqrRunParentView()->getRProcessRunning()->write( - msp_rscriptTemplate->render(&grantlee_context).toUtf8()); + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( + "protein_clustering", msp_rscriptTemplate->render(&grantlee_context)); } } @@ -434,8 +435,8 @@ McqrSdsWidget::runProteinAnova() grantlee_context.insert("interaction", "FALSE"); } - getMcqrRunParentView()->getRProcessRunning()->write( - msp_rscriptTemplate->render(&grantlee_context).toUtf8()); + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( + "protein_anova", msp_rscriptTemplate->render(&grantlee_context)); } } @@ -485,8 +486,8 @@ McqrSdsWidget::runProteinAbundance() } grantlee_context.insert("alpha", ui->alpha_spin->value()); - getMcqrRunParentView()->getRProcessRunning()->write( - msp_rscriptTemplate->render(&grantlee_context).toUtf8()); + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( + "protein_abundance", msp_rscriptTemplate->render(&grantlee_context)); } } @@ -502,8 +503,8 @@ McqrSdsWidget::runProteinFcAbundance() grantlee_context.insert("num", ui->numerator_combobox->currentText()); grantlee_context.insert("denom", ui->denominator_combobox->currentText()); - getMcqrRunParentView()->getRProcessRunning()->write( - msp_rscriptTemplate->render(&grantlee_context).toUtf8()); + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( + "protein_fc_abundance", msp_rscriptTemplate->render(&grantlee_context)); } void @@ -525,8 +526,8 @@ McqrSdsWidget::saveFinalRData() grantlee_context.insert("mcqr_step", (std::int8_t)m_ongoingMcqrStep); grantlee_context.insert("rdata_file", file_name); - getMcqrRunParentView()->getRProcessRunning()->write( - msp_rscriptTemplate->render(&grantlee_context).toUtf8()); + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( + "last", msp_rscriptTemplate->render(&grantlee_context)); } void diff --git a/src/gui/mcqr_run_view/mcqr_sds_xic_widget/mcqrsdsxicwidget.cpp b/src/gui/mcqr_run_view/mcqr_sds_xic_widget/mcqrsdsxicwidget.cpp index 1573fd08f6d1069f8f6dc057047bfc2326dc2eca..98900e553243e4f9a7f870e5b14ea0a21d18b42d 100644 --- a/src/gui/mcqr_run_view/mcqr_sds_xic_widget/mcqrsdsxicwidget.cpp +++ b/src/gui/mcqr_run_view/mcqr_sds_xic_widget/mcqrsdsxicwidget.cpp @@ -467,8 +467,6 @@ McqrSdsXicWidget::runReconstitutingTracks() grantlee_context.insert("track_level", ui->track_ref_combobox->currentText()); - getMcqrRunParentView()->getRProcessRunning()->write( - msp_rscriptTemplate->render(&grantlee_context).toUtf8()); getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( "reconstituting_tracks", @@ -532,8 +530,7 @@ McqrSdsXicWidget::runNormaliseIntensities() ui->norm_method_combo->currentText()); getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( - "normalise", - msp_rscriptTemplate->render(&grantlee_context)); + "normalise", msp_rscriptTemplate->render(&grantlee_context)); } qDebug(); } @@ -573,10 +570,9 @@ McqrSdsXicWidget::runFilteringSharedPeptides() grantlee_context.insert("corr_cutoff", ui->corr_cutoff_spin->value()); grantlee_context.insert("n_prot_corr", ui->nb_prot_corr_spin->value()); - + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( - "filtering_shared", - msp_rscriptTemplate->render(&grantlee_context)); + "filtering_shared", msp_rscriptTemplate->render(&grantlee_context)); } qDebug(); } @@ -613,7 +609,7 @@ McqrSdsXicWidget::runFilteringUncorrelatedPeptides() grantlee_context.insert("corr_cutoff", ui->corr_cutoff_spin->value()); grantlee_context.insert("nb_pep", ui->nb_peptides_cutoff_spin->value()); - + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( "filtering_uncorrelated", msp_rscriptTemplate->render(&grantlee_context)); @@ -646,10 +642,9 @@ McqrSdsXicWidget::runImputingPeptidesProteins() grantlee_context.insert("abundance_method", ui->abundance_method_combo->currentText()); - - getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( - "imputing", - msp_rscriptTemplate->render(&grantlee_context)); + + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( + "imputing", msp_rscriptTemplate->render(&grantlee_context)); qDebug(); } @@ -685,9 +680,8 @@ McqrSdsXicWidget::runHeatMapProteinAbundance() grantlee_context.insert("distance_fun", ui->distfun_combobox->currentText()); grantlee_context.insert("agg_method", ui->agg_method_combobox->currentText()); - getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( - "heatmap", - msp_rscriptTemplate->render(&grantlee_context)); + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( + "heatmap", msp_rscriptTemplate->render(&grantlee_context)); qDebug(); } @@ -716,7 +710,7 @@ McqrSdsXicWidget::runProteinClustering() getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( "protein_clustering", msp_rscriptTemplate->render(&grantlee_context)); - + qDebug(); } @@ -786,10 +780,9 @@ McqrSdsXicWidget::runProteinAbundance() pappso::Utils::booleanToString(ui->padjust_switch->getSwitchValue())); grantlee_context.insert("alpha", ui->alpha_spin->value()); - - getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( - "protein_abundance", - msp_rscriptTemplate->render(&grantlee_context)); + + getMcqrRunParentView()->getRProcessRunning()->executeMcqrStep( + "protein_abundance", msp_rscriptTemplate->render(&grantlee_context)); qDebug(); } diff --git a/src/gui/mcqr_run_view/mcqrparamwidget.cpp b/src/gui/mcqr_run_view/mcqrparamwidget.cpp index 1caf0b334f051512d0f2f7ee803842d75bd5a292..517c046ed3476310a81add168c1bda3a510d3f76 100644 --- a/src/gui/mcqr_run_view/mcqrparamwidget.cpp +++ b/src/gui/mcqr_run_view/mcqrparamwidget.cpp @@ -96,5 +96,5 @@ McqrParamWidget::saveModifiedRData(QString new_rdata_path) { QString save_script; save_script = " save.image(file=\"" + new_rdata_path + "\")"; - mp_mcqrRunWindow->getRProcessRunning()->write(save_script.toUtf8()); + mp_mcqrRunWindow->getRProcessRunning()->executeOffTheRecord(save_script); } diff --git a/src/gui/mcqr_run_view/mcqrqprocess.cpp b/src/gui/mcqr_run_view/mcqrqprocess.cpp index b16271a388e66529c67c7ad1d491a56a87f3064f..0aac5233b7e869a53c31d7f63cc96ce3bc6ba32f 100644 --- a/src/gui/mcqr_run_view/mcqrqprocess.cpp +++ b/src/gui/mcqr_run_view/mcqrqprocess.cpp @@ -40,7 +40,7 @@ McqrQProcess::~McqrQProcess() } qint64 -McqrQProcess::write(const QString &mcqr_code) +McqrQProcess::executeOnTheRecord(const QString &mcqr_code) { m_RscriptRun << mcqr_code; return QProcess::write(mcqr_code.toUtf8()); @@ -52,10 +52,10 @@ McqrQProcess::getRScriptRun() const return m_RscriptRun; } -void +qint64 McqrQProcess::executeOffTheRecord(const QString &mcqr_otr) { - QProcess::write(mcqr_otr.toUtf8()); + return QProcess::write(mcqr_otr.toUtf8()); } @@ -64,12 +64,13 @@ McqrQProcess::executeMcqrStep(const QString &mcqr_step_name, const QString &mcqr_step) { - write(QString("message(\"MCQRBegin: %1\")\n").arg(mcqr_step_name).toUtf8()); + executeOnTheRecord( + QString("message(\"MCQRBegin: %1\")\n").arg(mcqr_step_name)); executeOffTheRecord("vl <- tryCatch({\n"); - write(mcqr_step.toUtf8()); + executeOnTheRecord(mcqr_step); - write(QString("message(\"MCQREnd: %1\")\n").arg(mcqr_step_name).toUtf8()); + executeOnTheRecord(QString("message(\"MCQREnd: %1\")\n").arg(mcqr_step_name)); // write(mcqr_step.toUtf8()); executeOffTheRecord( QString( diff --git a/src/gui/mcqr_run_view/mcqrqprocess.h b/src/gui/mcqr_run_view/mcqrqprocess.h index 9f3220716bce484b0f9aefeb5bad817058581b18..d4529722344ed10d7cd91638339a39604f810e8d 100644 --- a/src/gui/mcqr_run_view/mcqrqprocess.h +++ b/src/gui/mcqr_run_view/mcqrqprocess.h @@ -39,9 +39,8 @@ class McqrQProcess : public QProcess McqrQProcess(QObject *parent = nullptr); ~McqrQProcess(); - - qint64 write(const QString &mcqr_code); - void executeOffTheRecord(const QString &mcqr_otr); + qint64 executeOnTheRecord(const QString &mcqr_code); + qint64 executeOffTheRecord(const QString &mcqr_otr); void executeMcqrStep(const QString &mcqr_step_name, const QString &mcqr_step); const QTextStream &getRScriptRun() const; diff --git a/src/gui/mcqr_run_view/mcqrrunview.cpp b/src/gui/mcqr_run_view/mcqrrunview.cpp index 823f099fc9b1759a7694fb83d69e0344ea530e2d..7bc47c86174aa36724b5cf36a4d274f343f1b8b2 100644 --- a/src/gui/mcqr_run_view/mcqrrunview.cpp +++ b/src/gui/mcqr_run_view/mcqrrunview.cpp @@ -140,7 +140,7 @@ McqrRunView::checkLibrariesInstalled() Grantlee::Template rscript_template_sp = engine_p->loadByName("mcqr_packages_handler.R"); Grantlee::Context empty_context; - mp_rProcess->write(rscript_template_sp->render(&empty_context).toUtf8()); + mp_rProcess->executeOnTheRecord(rscript_template_sp->render(&empty_context)); } void @@ -153,7 +153,7 @@ McqrRunView::endRProcess() } else { - mp_rProcess->write(QString("quit( save = \"no\")").toUtf8()); + mp_rProcess->executeOffTheRecord(QString("quit( save = \"no\")")); mp_rProcess->waitForFinished(); QProcess::ExitStatus Status = mp_rProcess->exitStatus(); qDebug() << Status;