-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_db.Makefile
69 lines (58 loc) · 3.43 KB
/
setup_db.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
# -*- indent-tabs-mode:t; -*-
# Make parameters
SHELL := bash
.SHELLFLAGS = -o pipefail -c
.PHONY: all download index
BASE_URL := https://urgi.versailles.inra.fr/download/iwgsc/Survey_sequence/
TARGET_DIR := ./global/blast_db/
IWGSC_FILES := 1AL_v2-ab-k71-contigs.fa.longerthan_200.fa.gz \
1AS-ab-k71-contigs.fa.longerthan_200.fa.gz \
1BL-ab-k71-contigs.fa.longerthan_200.fa.gz \
1BS-ab-k71-contigs.fa.longerthan_200.fa.gz \
1DL-ab-k95-contigs.fa.longerthan_200.fa.gz \
1DS-ab-k71-contigs.fa.longerthan_200.fa.gz \
2AL-ab-k71-contigs.fa.longerthan_200.fa.gz \
2AS-ab-k71-contigs.fa.longerthan_200.fa.gz \
2BL-ab-k71-contigs.fa.longerthan_200.fa.gz \
2BS-ab-k71-contigs.fa.longerthan_200.fa.gz \
2DL-ab-k71-contigs.fa.longerthan_200.fa.gz \
2DS-ab-k71-contigs.fa.longerthan_200.fa.gz \
3AL-ab-k71-contigs.fa.longerthan_200.fa.gz \
3AS-ab-k71-contigs.fa.longerthan_200.fa.gz \
3B-ab-k71-contigs.fa.longerthan_200.fa.gz \
3DL-ab-k71-contigs.fa.longerthan_200.fa.gz \
3DS-ab-k95-contigs.fa.longerthan_200.fa.gz \
4AL_v2-ab-k71-contigs.fa.longerthan_200.fa.gz \
4AS_v2-ab-k71-contigs.fa.longerthan_200.fa.gz \
4BL-ab-k71-contigs.fa.longerthan_200.fa.gz \
4BS-ab-k71-contigs.fa.longerthan_200.fa.gz \
4DL_v3-ab-k71-contigs.fa.longerthan_200.fa.gz \
4DS-ab-k71-contigs.fa.longerthan_200.fa.gz \
5AL-ab-k95-contigs.fa.longerthan_200.fa.gz \
5AS-ab-k95-contigs.fa.longerthan_200.fa.gz \
5BL-ab-k71-contigs.fa.longerthan_200.fa.gz \
5BS-ab-k71-contigs.fa.longerthan_200.fa.gz \
5DL-ab-k71-contigs.fa.longerthan_200.fa.gz \
5DS-ab-k71-contigs.fa.longerthan_200.fa.gz \
6AL-ab-k71-contigs.fa.longerthan_200.fa.gz \
6AS-ab-k71-contigs.fa.longerthan_200.fa.gz \
6BL-ab-k71-contigs.fa.longerthan_200.fa.gz \
6BS-ab-k71-contigs.fa.longerthan_200.fa.gz \
6DL-ab-k71-contigs.fa.longerthan_200.fa.gz \
6DS-ab-k71-contigs.fa.longerthan_200.fa.gz \
7AL-ab-k71-contigs.fa.longerthan_200.fa.gz \
7AS-ab-k71-contigs.fa.longerthan_200.fa.gz \
7BL-ab-k71-contigs.fa.longerthan_200.fa.gz \
7BS-ab-k71-contigs.fa.longerthan_200.fa.gz \
7DL-ab-k71-contigs.fa.longerthan_200.fa.gz
BLAST_EXT := .nhr .nin .nog .nsd .nsi .nsq
BLAST_DB_FILES := $(foreach file,$(IWGSC_FILES),$(addprefix $(TARGET_DIR)$(file),$(BLAST_EXT)))
all: index
download: $(addprefix $(TARGET_DIR),$(IWGSC_FILES))
index: $(foreach file,$(IWGSC_FILES),$(addprefix $(TARGET_DIR)$(file),$(BLAST_EXT))) $(TARGET_DIR)IWGSC_SS.nal
$(TARGET_DIR)IWGSC_SS.nal: $(foreach file,$(IWGSC_FILES),$(addprefix $(TARGET_DIR)$(file),$(BLAST_EXT)))
blastdb_aliastool -dblist "$(sort $(basename $^))" -dbtype nucl -out "$(basename $@)" -title "IWGSC Chromosomal Survey Sequences"
%.gz.nhr %.gz.nin %.gz.nog %.gz.nsd %.gz.nsi %.gz.nsq : %.gz
gunzip -c $< | makeblastdb -in - -dbtype nucl -title "$(notdir $<)" -parse_seqids -out "$<"
%.gz :
file="$(notdir $@)" && chr_arm="$${file//[-_]*}" && curl "$(BASE_URL)$(notdir $@)" | gunzip | sed "s/^>\($${chr_arm}_\)\?/>$${chr_arm}_/" | gzip --fast > "$@"