Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ public class GeneEdaVizWithComputePlugin extends AbstractEdaGenesPlugin {

private static final Logger LOG = Logger.getLogger(GeneEdaVizWithComputePlugin.class);

private enum EffectDirection {
UP_AND_DOWN, UP_ONLY, DOWN_ONLY;

static EffectDirection fromString(String s) {
return switch (s == null ? "" : s) {
case "up only" -> UP_ONLY;
case "down only" -> DOWN_ONLY;
default -> UP_AND_DOWN;
};
}
}

private static class Point {

String pointId;
Expand All @@ -52,6 +64,7 @@ public String toString() {

private double _effectSizeThreshold;
private double _significanceThreshold;
private EffectDirection _effectDirection;
private Path _tmpFile;

@Override
Expand Down Expand Up @@ -135,6 +148,7 @@ protected InputStream getEdaTabularDataStream(String edaBaseUrl, Map<String, Str
// values to be used later to filter returned rows
_effectSizeThreshold = vizConfig.getDouble("effectSizeThreshold");
_significanceThreshold = vizConfig.getDouble("significanceThreshold");
_effectDirection = EffectDirection.fromString(vizConfig.optString("effectDirection", "up and down"));

// make request with JSON like
/**
Expand Down Expand Up @@ -383,9 +397,15 @@ private void handleComputeStatus(String edaBaseUrl, String studyId, JSONArray fi
protected Boolean isRetainedRow(String[] edaRow) {
try {
//LOG.info("Checking if edaRow of size " + edaRow.length + " should be retained, array = [ " + String.join(", ", edaRow) + " ]");
double effectSize = Math.abs(Double.valueOf(edaRow[1]));
double rawEffectSize = Double.valueOf(edaRow[1]);
double effectSize = Math.abs(rawEffectSize);
double pValue = Math.abs(Double.valueOf(edaRow[2]));
return pValue <= _significanceThreshold && effectSize >= _effectSizeThreshold;
if (!(pValue <= _significanceThreshold && effectSize >= _effectSizeThreshold)) return false;
return switch (_effectDirection) {
case UP_ONLY -> rawEffectSize > 0;
case DOWN_ONLY -> rawEffectSize < 0;
default -> true;
};
}
catch (NumberFormatException e) {
LOG.warn("Skipping EDA output row in which effectSize or pValue property is not a valid double value. Row = [ " + String.join(", ", edaRow) + " ]", e);
Expand Down