()
| 2891 | |
| 2892 | |
| 2893 | def main() -> int: |
| 2894 | args = parse_args() |
| 2895 | run_id = args.run_id or slug_timestamp(args.lane.replace("_", "-")) |
| 2896 | run_dir = (args.outdir or (DEFAULT_RUN_ROOT / args.lane / run_id)).expanduser().resolve() |
| 2897 | if run_dir.exists(): |
| 2898 | raise FileExistsError(f"run directory already exists: {run_dir}") |
| 2899 | run_dir.mkdir(parents=True) |
| 2900 | (run_dir / "logs").mkdir(parents=True, exist_ok=True) |
| 2901 | |
| 2902 | validation, rows, fastq_paths = normalize_samples(args) |
| 2903 | input_provenance = stage_analysis_inputs(run_dir, args, rows) |
| 2904 | replay_sample_sheet = run_dir / input_provenance["sample_sheet"]["resolved_path"] |
| 2905 | tool_status = tool_preflight( |
| 2906 | LANES[args.lane]["required"], optional=LANES[args.lane]["optional"] |
| 2907 | ) |
| 2908 | write_json( |
| 2909 | run_dir / "config.json", |
| 2910 | { |
| 2911 | "lane": args.lane, |
| 2912 | "sample_sheet": str(args.sample_sheet.expanduser().resolve()), |
| 2913 | "resolved_sample_sheet": str(replay_sample_sheet), |
| 2914 | "kraken_db": str(args.kraken_db) if args.kraken_db else None, |
| 2915 | "asv_table": str(args.asv_table.expanduser().resolve()) if args.asv_table else None, |
| 2916 | "taxonomy_table": str(args.taxonomy_table.expanduser().resolve()) |
| 2917 | if args.taxonomy_table |
| 2918 | else None, |
| 2919 | "synthetic_downstream_inputs": args.synthetic_downstream_inputs, |
| 2920 | "allow_synthetic_diversity": args.allow_synthetic_diversity, |
| 2921 | "primer_forward": args.primer_forward, |
| 2922 | "primer_reverse": args.primer_reverse, |
| 2923 | "primer_orientation": args.primer_orientation, |
| 2924 | "merge_reads": args.merge_reads, |
| 2925 | "trunc_len_f": args.trunc_len_f, |
| 2926 | "trunc_len_r": args.trunc_len_r, |
| 2927 | "denoiser": args.denoiser, |
| 2928 | "taxonomy_database": args.taxonomy_database, |
| 2929 | "taxonomy_database_version": args.taxonomy_database_version, |
| 2930 | "normalization": args.normalization, |
| 2931 | "rarefaction_depth": args.rarefaction_depth, |
| 2932 | "amplicon_backend": args.amplicon_backend, |
| 2933 | "kraken_reports": [str(path.expanduser().resolve()) for path in args.kraken_report], |
| 2934 | "bracken_tables": [str(path.expanduser().resolve()) for path in args.bracken_table], |
| 2935 | "humann_pathabundance": str(args.humann_pathabundance.expanduser().resolve()) |
| 2936 | if args.humann_pathabundance |
| 2937 | else None, |
| 2938 | "humann_genefamilies": str(args.humann_genefamilies.expanduser().resolve()) |
| 2939 | if args.humann_genefamilies |
| 2940 | else None, |
| 2941 | }, |
| 2942 | ) |
| 2943 | write_json(run_dir / "validation" / "input_summary.json", {"samples": rows}) |
| 2944 | write_json(run_dir / "validation" / "validation_summary.json", validation) |
| 2945 | write_json(run_dir / "validation" / "tool_preflight.json", tool_status) |
| 2946 | write_normalized_samples(run_dir, rows) |
| 2947 | write_json(run_dir / "inputs" / "input_provenance.json", input_provenance) |
| 2948 | write_commands(run_dir, args, fastq_paths, replay_sample_sheet) |
| 2949 | write_json( |
| 2950 | run_dir / "versions" / "software_versions.json", |
no test coverage detected