From b095d6461832b4d64f938b2ac8457a50b45bdd12 Mon Sep 17 00:00:00 2001 From: Vicky Daiya <37933641+vickydaiya@users.noreply.github.com> Date: Fri, 1 Dec 2023 05:28:50 -0500 Subject: [PATCH] Update options-util.js --- steps/js/options-util.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/steps/js/options-util.js b/steps/js/options-util.js index 19015d5..25b40a8 100644 --- a/steps/js/options-util.js +++ b/steps/js/options-util.js @@ -1,23 +1,22 @@ -var ALGORITHMS = ['azimuth', 'celltypist', 'popv']; +var ALGORITHMS = ["azimuth", "celltypist", "popv"]; function _find_algorithm(obj) { - for (var spec of obj.algorithms) { - for (var key of Object.keys(spec)) { - if (ALGORITHMS.includes(key)) { - return key; - } + for (var index = 0; index < ALGORITHMS.length; ++index) { + var name = ALGORITHMS[index]; + if (typeof obj[name] === "object") { + return name; } } - return undefined; + + return null; } function selectOutputDirectory(obj) { - return obj['directory'] || _find_algorithm(obj) || '.'; + return obj["directory"] || _find_algorithm(obj) || "."; } -function getSummarizeOptions(obj) { +function getDefaultSummarizeOptions(obj) { return { - annotationMethod: _find_algorithm(obj) || 'unknown', - ...(obj.algorithms.splice(-1)[0].summarize ?? {}), + annotationMethod: _find_algorithm(obj) || "unknown", }; }