-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile-mage
46 lines (32 loc) · 1.46 KB
/
Makefile-mage
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
SPLIT=1
NREP=3
SET=1
PERC=0.01
#S1_P0.01_N10.tsv
DATANAME=S$(SET)_P$(PERC)_N$(NREP)
DF_WIDE=tests/benchmark_data/$(DATANAME).tsv
DF_LONG=tests/benchmark_data/$(DATANAME)_l.tsv
SPLITDIR=tests/splits_$(DATANAME)
STANDIR=tests/stanfc_$(DATANAME)
DF_LONG_SPLIT=$(SPLITDIR)/$(DATANAME)_l-$(SPLIT).tsv
STANOUTPUT=$(STANDIR)/$(DATANAME)_l-$(SPLIT).stan.txt
init:
mkdir -p $(SPLITDIR)
mkdir -p $(STANDIR)
$(DF_LONG):
Rscript src/model/wide_to_long.R $(DF_WIDE) 2>/dev/null > $(DF_LONG)
$(DF_LONG_SPLIT): $(DF_LONG)
Rscript src/model/wide_to_long_gene_splitter.R $(DF_LONG) $(SPLIT) > $(DF_LONG_SPLIT)
mage $(STANOUTPUT): $(DF_LONG_SPLIT)
Rscript src/model/run_model.R src/model/model_onefactor.stan $(DF_LONG_SPLIT) $(STANOUTPUT)
once $(STANDIR)/$(DATANAME)_l-$(SPLIT).stan.txt: init
make -f Makefile-mage NREP=$(NREP) SPLIT=$(SPLIT) mage
all: $(STANDIR)/$(DATANAME)_l-$(SPLIT).stan.txt
@seq 2 $(shell cat $(DF_WIDE) | sed '1d' | wc -l) | parallel -j$(shell nproc) 'make -f Makefile-mage SPLIT={} NREP=$(NREP) mage'
merge: all
grep -H . $(STANDIR)/* | awk 'NR % 2 == 0' | tr ':' '\t' | perl -pe 's/$(DATANAME)_l-//; s/\.stan\.txt//; s/tests\/stanfc_$(DATANAME)\///' | sort -k1,1n > tests/merged_$(DATANAME).polished.txt
merge_indep:
grep -H . $(STANDIR)/* | awk 'NR % 2 == 0' | tr ':' '\t' | perl -pe 's/$(DATANAME)_l-//; s/\.stan\.txt//; s/tests\/stanfc_$(DATANAME)\///' | sort -k1,1n > tests/merged_$(DATANAME).polished.txt
monitor:
@watch 'ls $(STANDIR) | wc -l'
.PHONY: init