-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (53 loc) · 2.33 KB
/
Makefile
File metadata and controls
68 lines (53 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
.ONESHELL:
include config.mk
-include config.local.mk
.PHONY: help check dirs clean print-config all
.DEFAULT_GOAL := help
help: ## Show targets
@echo "Usage: make <target>"
@grep -E '^[a-zA-Z0-9_/.-]+:.*?## ' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN{FS=":.*?## "}{printf " %-22s %s\n", $$1, $$2}'
print-config: ## Show config
@echo "=== CONFIG ($$(date)) ==="
@echo "FASTA = $(FASTA)"
@echo "OUT = $(OUT)"
@echo "DATASET = $(DATASET)"
@echo "IQTREE = $(IQTREE)"
@echo "MPTP = $(MPTP)"
@echo "PYTHON = $(PYTHON)"
check: ## Verify core tools
@for t in "$(PYTHON)"; do command -v $$t >/dev/null || { echo "Missing: $$t"; exit 1; }; done
@echo "[OK] core tools present"
dirs: ## Create output folders
@mkdir -p $(OUT)/{logs,trees,spart,tmp}
clean: ## Remove outputs
@rm -rf $(OUT)
# Snapshot config
$(LOGDIR)/run_config.txt: | dirs
@$(MAKE) -s print-config >"$@"
# ===== QC =====
$(OUT)/tmp/fasta.qc.ok: $(FASTA) | dirs ## FASTA sanity check
bin/qc_fasta.sh "$<" >"$(LOGDIR)/qc_fasta.log" 2>&1
@touch "$@"
# ===== IQ-TREE (ML tree) =====
$(OUT)/trees/ml.treefile: $(FASTA) $(OUT)/tmp/fasta.qc.ok | dirs ## ML tree
"$(IQTREE)" -s "$<" -m $(IQTREE_MODEL) -bb $(IQTREE_BB) -nt AUTO -seed $(SEED) -pre "$(OUT)/trees/coi" -redo \
>"$(LOGDIR)/iqtree.stdout.log" 2>"$(LOGDIR)/iqtree.stderr.log" || { echo "[IQTREE] failed"; exit 1; }
cp "$(OUT)/trees/coi.treefile" "$@"
# ===== mPTP (MCMC) → SPART =====
$(OUT)/spart/mptp.spart: $(OUT)/trees/ml.treefile | dirs ## mPTP partition from ML tree
bin/run_mptp.sh "$<" "$(OUT)/tmp/mptp.tsv" $(MPTP_ITERS) $(MPTP_BURNIN) $(MPTP_THIN) $(MPTP_SEED) \
>"$(LOGDIR)/mptp.log" 2>&1
"$(PYTHON)" bin/mptp_tsv_to_spart.py --tsv "$(OUT)/tmp/mptp.tsv" --dataset "$(DATASET)" --out "$@"
# ===== Top-level (core only for now) =====
all: $(LOGDIR)/run_config.txt $(OUT)/trees/ml.treefile $(OUT)/spart/mptp.spart ## Build core (IQ-TREE→mPTP)
# ===== ASAP → SPART =====
$(OUT)/spart/asap.spart: $(FASTA) | dirs ## ASAP partition
bin/run_asap.sh "$(ASAP)" "$<" "$@" "$(ASAP_DIST)" "$(ASAP_REPS)" "$(SEED)" "$(OUT)/tmp/asap"
.PHONY: fast
fast: ## Quick test profile (cheap settings)
$(MAKE) -B out/spart/asap.spart ASAP_DIST=K2P ASAP_REPS=100 SEED=42
$(MAKE) -B out/spart/mptp.spart MPTP_ITERS=100000 MPTP_BURNIN=10000 MPTP_THIN=100 SEED=42