| 270 | |
| 271 | |
| 272 | def select_method( |
| 273 | requested: str, input_mode: str, packages: dict[str, bool], errors: list[str] |
| 274 | ) -> str: |
| 275 | if requested != "auto": |
| 276 | if requested in {"DESeq2", "edgeR"} and input_mode != "raw_counts": |
| 277 | errors.append( |
| 278 | f"{requested} requires raw integer-like counts; input_mode={input_mode} is not compatible" |
| 279 | ) |
| 280 | if requested != "limma_log2" and not packages.get(requested, False): |
| 281 | errors.append(f"{requested} was requested but the R package is not installed") |
| 282 | return requested |
| 283 | if input_mode == "raw_counts" and packages.get("DESeq2", False): |
| 284 | return "DESeq2" |
| 285 | if input_mode == "raw_counts" and packages.get("edgeR", False): |
| 286 | return "edgeR" |
| 287 | return "limma_log2" |
| 288 | |
| 289 | |
| 290 | def write_workflow(run_dir: Path) -> None: |