Skip to content

Commit 40427ba

Browse files
committed
Add threshold slider for %expressed
1 parent 43300dc commit 40427ba

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/DifferentialExpressionPlugin.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ DifferentialExpressionPlugin::DifferentialExpressionPlugin(const PluginFactory*
194194
_buttonProgressBar(nullptr),
195195
_copyToClipboardAction(&getWidget(), "Copy"),
196196
_saveToCsvAction(&getWidget(), "Save As..."),
197-
_normAction(&getWidget(), "Min max normalization")
197+
_normAction(&getWidget(), "Min max norm"),
198+
_thresholdExpressedAction(&getWidget(), "Threshold %expressed", 0.0f, 4.0f, 0.0f, 1)
198199
{
199200
// This line is mandatory if drag and drop behavior is required
200201
_currentDatasetNameLabel->setAcceptDrops(true);
@@ -255,6 +256,11 @@ DifferentialExpressionPlugin::DifferentialExpressionPlugin(const PluginFactory*
255256
_updateStatisticsAction.trigger();
256257
});
257258

259+
connect(&_thresholdExpressedAction, &DecimalAction::valueChanged, this, [this](float value)
260+
{
261+
_updateStatisticsAction.trigger();
262+
});
263+
258264
_serializedActions.append(&_loadedDatasetsAction);
259265
_serializedActions.append(&_selectedIdAction);
260266
_serializedActions.append(&_filterOnIdAction);
@@ -284,8 +290,9 @@ void DifferentialExpressionPlugin::init()
284290
filterWidget->setContentsMargins(0, 3, 0, 3);
285291

286292
QHBoxLayout* toolBarLayout = new QHBoxLayout;
287-
toolBarLayout->addWidget(filterWidget, 8);
293+
toolBarLayout->addWidget(filterWidget, 6);
288294
toolBarLayout->addWidget(_normAction.createWidget(&mainWidget), 2);
295+
toolBarLayout->addWidget(_thresholdExpressedAction.createWidget(&mainWidget), 2);
289296

290297
layout->addLayout(toolBarLayout);
291298
}
@@ -475,7 +482,7 @@ void DifferentialExpressionPlugin::init()
475482
std::vector<float> pctExpressedA(numDimensions, 0);
476483
std::vector<float> pctExpressedB(numDimensions, 0);
477484

478-
float thr = 0.0f;
485+
float thr = _thresholdExpressedAction.getValue();
479486

480487
// first compute the sum of values per dimension for selectionA and selectionB
481488
local::visitElements(_points, selectionA, [&meanA, &valuesA, &countExpressedA, thr](auto row, auto column, auto value)

src/DifferentialExpressionPlugin.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include "LoadedDatasetsAction.h"
66
#include "MultiTriggerAction.h"
77

8+
#include "actions/DecimalAction.h"
9+
810
#include <Dataset.h>
911
#include <widgets/DropWidget.h>
1012

@@ -124,6 +126,9 @@ protected slots:
124126
// TEMP: toggle for normalization within the loaded dataset
125127
ToggleAction _normAction; // min max normalization
126128
bool _norm = false;
129+
130+
// TEMP: slider for threshold for % expressed
131+
DecimalAction _thresholdExpressedAction; // threshold for % expressed
127132
};
128133

129134
/**

0 commit comments

Comments
 (0)