Makefile 2.94 KB
Newer Older
Marco Chierici's avatar
Marco Chierici committed
1
2
3
4
5
#!/usr/bin/make -f
# Makefile for running the INF pipeline
# Author: Marco Chierici <chierici@fbk.eu>
# Date: 2017-05-12
#
alessiamarcolini's avatar
alessiamarcolini committed
6
.PHONY: init
Marco Chierici's avatar
Marco Chierici committed
7
8
9
10
11
12
13
14
15
16
17
18

SHELL := /bin/bash

# input variables
# shown are examples, override on command line
FILE ?= data/AG1-G_MAV-G_498_LIT_ALL_tr.txt
LABEL ?= data/label_498_ALL-EFS_tr.lab
DATA1 ?= data/AG1-G_498_LIT_ALL_tr.txt
DATA2 ?= data/MAV-G_498_LIT_ALL_tr.txt
ENDPOINT ?= ALL-EFS
# added MF 20170710
THREADS ?= 4
19
OUTBASE ?= /path/to/out_tmp
Marco Chierici's avatar
Marco Chierici committed
20

Nicole Bussola's avatar
Nicole Bussola committed
21
BINDIR := .
Marco Chierici's avatar
Marco Chierici committed
22
23
24
25
26
27
28
OUTDIR := $(OUTBASE)/$(ENDPOINT)

# derived variables
OUTPREFIX = $(notdir $(basename $(FILE)))
LEVEL1 = $(word 1,$(subst _, ,$(OUTPREFIX)))
LEVEL2 = $(word 2,$(subst _, ,$(OUTPREFIX)))

alessiamarcolini's avatar
alessiamarcolini committed
29
30
31
32
33
init:
	@mkdir -p $(OUTDIR)/rSNFi
	@mkdir -p $(OUTDIR)/rSNF

all: init $(OUTDIR)/rSNFi/$(OUTPREFIX)_MCC_scores.txt $(OUTDIR)/rSNF/$(OUTPREFIX)_MCC_scores.txt $(OUTDIR)/juxt/$(OUTPREFIX)_MCC_scores.txt
Marco Chierici's avatar
Marco Chierici committed
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
69
70
71
72
73


$(OUTDIR)/juxt/$(OUTPREFIX)_RandomForest_KBest.log: $(FILE) $(LABEL)
	python $(BINDIR)/sklearn_rf_training_fixrank.py $(word 1,$^) $(word 2,$^) $(OUTDIR)/juxt --ranking KBest


$(OUTDIR)/juxt/$(OUTPREFIX)_MCC_scores.txt: $(OUTDIR)/juxt/$(OUTPREFIX)_RandomForest_KBest.log $(subst _tr,_ts,$(FILE)) $(subst _tr,_ts,$(LABEL))
	python $(BINDIR)/sklearn_rf_validation_writeperf.py $(word 1,$^) $(word 2,$^) $(OUTDIR)/juxt --tslab $(word 3,$^)


$(OUTDIR)/rSNF/INF_$(OUTPREFIX).txt: $(DATA1) $(DATA2) $(LABEL)
	Rscript $(BINDIR)/snf_integration.R --d1 $(word 1,$^) --d2 $(word 2,$^) --lab $(word 3,$^) \
		--scriptDir $(BINDIR)/SNFtools/ --clust spectral --threads "$(THREADS)" \
		--outf $@


$(OUTDIR)/rSNF/$(OUTPREFIX)_RandomForest_rankList.log: $(FILE) $(LABEL) $(OUTDIR)/rSNF/INF_$(OUTPREFIX).txt
	python $(BINDIR)/sklearn_rf_training_fixrank.py $(word 1,$^) $(word 2,$^) $(OUTDIR)/rSNF \
		--ranking rankList --rankFeats $(word 3,$^)


$(OUTDIR)/rSNF/$(OUTPREFIX)_MCC_scores.txt: $(OUTDIR)/rSNF/$(OUTPREFIX)_RandomForest_rankList.log $(subst _tr,_ts,$(FILE)) $(subst _tr,_ts,$(LABEL))
	python $(BINDIR)/sklearn_rf_validation_writeperf.py $(word 1,$^) $(word 2,$^) $(OUTDIR)/rSNF --tslab $(word 3,$^)


$(OUTDIR)/rSNFi/intersection_$(OUTPREFIX).txt: $(OUTDIR)/juxt/$(OUTPREFIX)_RandomForest_KBest.log $(OUTDIR)/rSNF/$(OUTPREFIX)_RandomForest_rankList.log
	python $(BINDIR)/intersect_biomarkers.py $(word 1,$^) $(word 2,$^) $(OUTDIR)/rSNFi/venn_$(OUTPREFIX).png $@ --title1 "$(LEVEL1)" --title2 "$(LEVEL2)"


$(OUTDIR)/rSNFi/$(OUTPREFIX).txt: $(FILE) $(OUTDIR)/rSNFi/intersection_$(OUTPREFIX).txt
	python $(BINDIR)/extract_topfeats_onecol.py $(word 1,$^) $(word 2,$^) $@


$(OUTDIR)/rSNFi/$(OUTPREFIX)_RandomForest_KBest.log: $(OUTDIR)/rSNFi/$(OUTPREFIX).txt $(LABEL)
	python $(BINDIR)/sklearn_rf_training_fixrank.py $(word 1,$^) $(word 2,$^) $(OUTDIR)/rSNFi --ranking KBest


$(OUTDIR)/rSNFi/$(OUTPREFIX)_MCC_scores.txt: $(OUTDIR)/rSNFi/$(OUTPREFIX)_RandomForest_KBest.log $(subst _tr,_ts,$(FILE)) $(subst _tr,_ts,$(LABEL))
	python $(BINDIR)/sklearn_rf_validation_writeperf.py $(word 1,$^) $(word 2,$^) $(OUTDIR)/rSNFi --tslab $(word 3,$^)