(
run_dir: Path,
args: argparse.Namespace,
fastq_paths: list[Path],
tool_status: dict[str, Any],
validation: dict[str, Any],
)
| 2581 | |
| 2582 | |
| 2583 | def execute_package( |
| 2584 | run_dir: Path, |
| 2585 | args: argparse.Namespace, |
| 2586 | fastq_paths: list[Path], |
| 2587 | tool_status: dict[str, Any], |
| 2588 | validation: dict[str, Any], |
| 2589 | ) -> dict[str, Any]: |
| 2590 | results: dict[str, Any] = {"ok": True, "steps": []} |
| 2591 | if not fastq_paths: |
| 2592 | return results |
| 2593 | (run_dir / "qc").mkdir(parents=True, exist_ok=True) |
| 2594 | |
| 2595 | seqkit = run_cmd(["seqkit", "stats", "-T", *map(str, fastq_paths)], run_dir, timeout=600) |
| 2596 | write_json(run_dir / "logs" / "seqkit_stats.json", seqkit) |
| 2597 | write_text(run_dir / "qc" / "seqkit_stats.tsv", seqkit.get("stdout_tail", "")) |
| 2598 | results["steps"].append({"name": "seqkit_stats", "ok": seqkit.get("ok")}) |
| 2599 | results["ok"] = bool(results["ok"] and seqkit.get("ok")) |
| 2600 | |
| 2601 | if command_path("fastqc") and command_path("multiqc"): |
| 2602 | (run_dir / "fastqc" / "raw").mkdir(parents=True, exist_ok=True) |
| 2603 | fastqc = run_cmd( |
| 2604 | ["fastqc", "-t", str(args.threads), "-o", "fastqc/raw", *map(str, fastq_paths)], |
| 2605 | run_dir, |
| 2606 | timeout=3600, |
| 2607 | ) |
| 2608 | write_json(run_dir / "logs" / "fastqc.json", fastqc) |
| 2609 | write_text(run_dir / "logs" / "fastqc.log", fastqc.get("stdout_tail", "")) |
| 2610 | multiqc = run_cmd( |
| 2611 | ["multiqc", "--no-version-check", "fastqc/raw", "-o", "fastqc/multiqc"], |
| 2612 | run_dir, |
| 2613 | timeout=600, |
| 2614 | ) |
| 2615 | write_json(run_dir / "logs" / "multiqc.json", multiqc) |
| 2616 | write_text(run_dir / "logs" / "multiqc.log", multiqc.get("stdout_tail", "")) |
| 2617 | results["steps"].extend( |
| 2618 | [ |
| 2619 | {"name": "fastqc", "ok": fastqc.get("ok")}, |
| 2620 | {"name": "multiqc", "ok": multiqc.get("ok")}, |
| 2621 | ] |
| 2622 | ) |
| 2623 | results["ok"] = bool(results["ok"] and fastqc.get("ok") and multiqc.get("ok")) |
| 2624 | |
| 2625 | if args.lane == "shotgun_metagenomics": |
| 2626 | status = { |
| 2627 | "analysis_intent": "real_analysis", |
| 2628 | "requested_local_backend": bool(args.kraken_db), |
| 2629 | "executed": False, |
| 2630 | "reason": None, |
| 2631 | "supplemental_reports_present": bool(args.kraken_report), |
| 2632 | } |
| 2633 | if args.kraken_db and command_path("kraken2"): |
| 2634 | kraken_dir = run_dir / "taxonomic_classification" |
| 2635 | kraken_dir.mkdir(parents=True, exist_ok=True) |
| 2636 | for fastq in fastq_paths: |
| 2637 | out = ( |
| 2638 | kraken_dir |
| 2639 | / f"{fastq.stem.replace('.fastq', '').replace('.fq', '')}.kraken2.txt" |
| 2640 | ) |
no test coverage detected