-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
147 lines (125 loc) · 4.92 KB
/
Makefile
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
CC = gcc
CFLAGS = -Wall -O2 -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function
DFLAGS = -g -Wall
HTSLIB_DIR = ./htslib
HTSLIB = $(HTSLIB_DIR)/libhts.a
LIB = $(HTSLIB) -lm -lz -lpthread
INCLUDE = -I $(HTSLIB_DIR)
BIN_DIR = ./bin
SRC_DIR = ./src
SOURCE = $(wildcard ${SRC_DIR}/*.c)
OBJS = $(SOURCE:.c=.o)
BIN = $(BIN_DIR)/lr2rmats
SORT = sort_gtf.sh
GTF2GP = gtfToGenePred
GP2BED = genePredToBed
GDB_DEBUG = $(BIN_DIR)/gdb_lr2rmats
DMARCRO = -D __DEBUG__
# dependencies
MINIMAP2 = minimap2
STAR = STAR
SNAKEMAKE = snakemake
PSUTIL = psutil
SAMTOOLS = samtools
BEDTOOLS = bedtools
MINIMAP2_VERSION = 2.5
STAR_VERSION = 2.5.3a
SAMTOOLS_VERSION = 1.6
BEDTOOLS_VERSION = 2.27.1
.c.o:
$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@
all: $(HTSLIB) $(BIN) $(GTF2GP) $(GP2BED) $(SNAKEMAKE) $(SAMTOOLS) $(BEDTOOLS) $(MINIMAP2) $(STAR)
lr2rmats_merge2names: $(HTSLIB) $(BIN) $(GTF2GP) $(GP2BED)
lr2rmats: $(HTSLIB) $(BIN) $(GTF2GP) $(GP2BED)
gdb_lr2rmats: $(SOURCE) $(GDB_DEBUG)
dependencies: $(SNAKEMAKE) $(SAMTOOLS) $(MINIMAP2) $(STAR) $(BEDTOOLS)
$(SNAKEMAKE):
if [ ! -d $(BIN_DIR) ]; then mkdir $(BIN_DIR); fi
if [ -z ${shell which ${SNAKEMAKE}} ]; then \
python3 -m pip install --user $(SNAKEMAKE) $(PSUTIL); \
else echo "$(SNAKEMAKE) is already installed."; \
fi
$(SAMTOOLS):
if [ -z ${shell which ${SAMTOOLS}} ]; then \
if [ ! -d $(BIN_DIR) ]; then mkdir $(BIN_DIR); fi; \
if [ ! -f ${BIN_DIR}/${SAMTOOLS} ]; then \
wget https://github.com/samtools/samtools/releases/download/${SAMTOOLS_VERSION}/samtools-${SAMTOOLS_VERSION}.tar.bz2; \
tar -jxvf samtools-${SAMTOOLS_VERSION}.tar.bz2; \
cd ./samtools-${SAMTOOLS_VERSION}/htslib-${SAMTOOLS_VERSION}/ && ./configure --disable-bz2 --disable-lzma; make; \
cd ..; ./configure --with-htslib=./htslib-${SAMTOOLS_VERSION}; make; \
cp ${SAMTOOLS} ../${BIN_DIR}; cd .. ; \
rm -rf samtools-${SAMTOOLS_VERSION}.tar.bz2 ./samtools-${SAMTOOLS_VERSION}; \
else echo "$(SAMTOOLS) is already installed."; \
fi; \
else echo "$(SAMTOOLS) is already installed."; \
fi
$(BEDTOOLS):
if [ -z ${shell which ${BEDTOOLS}} ]; then \
if [ ! -d $(BIN_DIR) ]; then mkdir $(BIN_DIR); fi; \
if [ ! -f ${BIN_DIR}/${BEDTOOLS} ]; then \
wget https://github.com/arq5x/bedtools2/releases/download/v${BEDTOOLS_VERSION}/bedtools-${BEDTOOLS_VERSION}.tar.gz; \
tar -zxvf bedtools-${BEDTOOLS_VERSION}.tar.gz; \
cd bedtools2; make; \
cp ${BEDTOOLS} ../${BIN_DIR}; cd .. ; \
rm -rf bedtools-${BEDTOOLS_VERSION}.tar.gz ./bedtools-${BEDTOOLS_VERSION}; \
else echo "$(BEDTOOLS) is already installed."; \
fi; \
else echo "$(BEDTOOLS) is already installed."; \
fi
$(MINIMAP2):
if [ -z ${shell which ${MINIMAP2}} ]; then \
if [ ! -d $(BIN_DIR) ]; then mkdir $(BIN_DIR); fi; \
if [ ! -f ${BIN_DIR}/${MINIMAP2} ]; then \
wget https://github.com/lh3/minimap2/releases/download/v${MINIMAP2_VERSION}/minimap2-${MINIMAP2_VERSION}_x64-linux.tar.bz2; \
tar -xjf minimap2-${MINIMAP2_VERSION}_x64-linux.tar.bz2 || exit 255; \
cp ./minimap2-${MINIMAP2_VERSION}_x64-linux/minimap2 ${BIN_DIR}; \
rm -rf minimap2-${MINIMAP2_VERSION}_x64-linux.tar.bz2 ./minimap2-${MINIMAP2_VERSION}_x64-linux; \
else echo "$(MINIMAP2) is already installed."; \
fi; \
else echo "$(MINIMAP2) is already installed."; \
fi
$(STAR):
if [ -z ${shell which ${STAR}} ]; then \
if [ ! -d $(BIN_DIR) ]; then mkdir $(BIN_DIR); fi; \
if [ ! -f ${BIN_DIR}/${STAR} ]; then \
wget https://github.com/alexdobin/STAR/archive/${STAR_VERSION}.tar.gz; \
tar -xzf ${STAR_VERSION}.tar.gz || exit 255; \
cp ./STAR-${STAR_VERSION}/bin/Linux_x86_64/STAR ${BIN_DIR}; \
rm -rf ${STAR_VERSION}.tar.gz ./STAR-${STAR_VERSION}; \
else echo "$(STAR) is already installed."; \
fi; \
else echo "$(STAR) is already installed."; \
fi
$(GTF2GP):
if [ -z ${shell which ${GTF2GP}} ]; then \
if [ ! -d $(BIN_DIR) ]; then mkdir $(BIN_DIR); fi; \
if [ ! -f ${BIN_DIR}/${GTF2GP} ]; then \
wget http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/${GTF2GP}; \
mv ./$(GTF2GP) ${BIN_DIR}; \
else echo "$(GTF2GP) is already installed."; \
fi; \
else echo "$(GTF2GP) is already installed."; \
fi
$(GP2BED):
if [ -z ${shell which ${GP2BED}} ]; then \
if [ ! -d $(BIN_DIR) ]; then mkdir $(BIN_DIR); fi; \
if [ ! -f ${BIN_DIR}/${GP2BED} ]; then \
wget http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/${GP2BED}; \
mv ./$(GP2BED) ${BIN_DIR}; \
else echo "$(GP2BED) is already installed."; \
fi; \
else echo "$(GP2BED) is already installed."; \
fi
$(HTSLIB):
cd $(HTSLIB_DIR); make;
$(BIN): $(OBJS)
if [ ! -d $(BIN_DIR) ]; then mkdir $(BIN_DIR); fi
$(CC) $(OBJS) -o $@ $(LIB)
cp $(SRC_DIR)/$(SORT) $(BIN_DIR) 2> /dev/null
$(GDB_DEBUG):
if [ ! -d $(BIN_DIR) ]; then mkdir $(BIN_DIR); fi
$(CC) $(DFLAGS) $(SOURCE) $(DMARCRO) $(INCLUDE) -o $@ $(LIB)
clean:
rm -f $(SRC_DIR)/*.o $(BIN_DIR)/$(BIN) $(BIN_DIR)/$(SORT)
clean_debug:
rm -f $(SRC_DIR)/*.o $(GDB_DEBUG) $(RGDB_DEBUG) $(NOR_DEBUG)