-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
574a8ba
commit 4aee043
Showing
1 changed file
with
10 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
var ALGORITHMS = ["azimuth", "celltypist", "popv"]; | ||
var ALGORITHMS = ['azimuth', 'celltypist', 'popv']; | ||
|
||
function _find_algorithm(obj) { | ||
for (var index = 0; index < ALGORITHMS.length; ++index) { | ||
var name = ALGORITHMS[index]; | ||
if (typeof obj[name] === "object" && obj[name] !== null) { | ||
return name; | ||
for (var spec of obj.algorithms) { | ||
for (var key of Object.keys(spec)) { | ||
if (ALGORITHMS.includes(key)) { | ||
return key; | ||
} | ||
} | ||
} | ||
|
||
return null; | ||
return undefined; | ||
} | ||
|
||
function selectOutputDirectory(obj) { | ||
return obj["directory"] || _find_algorithm(obj) || "."; | ||
return obj['directory'] || _find_algorithm(obj) || '.'; | ||
} | ||
|
||
function getSummarizeOptions(obj) { | ||
return { | ||
annotationMethod: _find_algorithm(obj) || "unknown", | ||
...(obj.summarize ?? {}) | ||
annotationMethod: _find_algorithm(obj) || 'unknown', | ||
...(obj.algorithms.slice(-1)[0].summarize ?? {}), | ||
}; | ||
} |