1 # Makefile for construction of databases that Jpred uses.
2 # The pdb make target has been over documented so as to provide
3 # explanation of the method behind the madness.
4 # All variables are defined at the top of the file, and then targets
5 # are defined afterwards
7 # Suffixes created by BLAST, ptm is also created, but I think this is
8 # a temporary file, so is mentioned explicitly in the clean target
9 BLAST_SUFFIX = .phr .pin .psd .psi .psq
11 # Specifically add path for some of the commands so we know we'll
13 PATH := $(PATH):/r0/www_servers/jpred/jpred_bin:/site/Linux/bin
15 # Define commands that occur multiple times
16 # The wget command means that you have to give the output location first,
19 FORMATDB = formatdb -o T -i
21 # Variables specific for PDB stuff
22 # URL to get the file from
23 PDB_URL = ftp://ftp.ebi.ac.uk/pub/databases/msd/pdb_aa.fasta
24 PDB_FILE = $(notdir $(PDB_URL))
25 # Target path to download to
27 # Files created by running formatdb on $(PDB_FASTA)
28 PDB_BLAST = $(addprefix $(PDB_FASTA), $(BLAST_SUFFIX))
29 # Directory to install the files into
30 #PDB_TARGET = /r0/www_servers/jpred/databases/pdb
31 PDB_TARGET = /tmp/jpred/databases/pdb
32 # The target paths of the files that are to be installed
33 PDB_INSTALL = $(addprefix $(PDB_TARGET)/, $(PDB_BLAST) $(PDB_FASTA))
35 # Variables specific for SWALL
36 SP_URL = ftp://ftp.ebi.ac.uk/pub/databases/sp_tr_nrdb/fasta/sprot.fas.gz
37 SP_FILE = $(notdir $(SP_URL))
38 TREMBL_URL = ftp://ftp.ebi.ac.uk/pub/databases/sp_tr_nrdb/fasta/trembl.fas.gz
39 TREMBL_FILE = $(notdir $(TREMBL_URL))
41 SWALL_FASTA = swall.fasta
42 SWALL_INDX = swall.jidx
43 SWALL_FILT = swall.filt
44 SWALL_BLAST = $(addprefix $(SWALL_FILT), $(BLAST_SUFFIX))
45 SWALL_TARGET = /tmp/jpred/cluster/packages/jpred_swall
46 SWALL_INSTALL = $(addprefix $(SWALL_TARGET)/, $(SWALL_BLAST) $(SWALL_FASTA) $(SWALL_FILT))
48 ######################################################################
51 ######################################################################
52 # PDB FASTA seqeunce database
54 # Heirarchy of dependancies (indentation denotes dependancy):
55 # /installation/dir/pdb.fasta{,.{phr,pin,psd,psi,psq}}
57 # pdb.fasta{.{phr,pin,psd,psi,psq}}
60 # pdb_wget creates pdb_aa.fasta
62 # This states that the PDB target depends upon the pdb_wget target and
63 # the files in the variable $(PDB_INSTALL), this is the group of formatdb
64 # index files and the original FASTA file used to create them in the
65 # installation directory
66 pdb.db: pdb_wget $(PDB_INSTALL)
68 # This installs the files into the final directory
69 $(PDB_INSTALL): $(PDB_BLAST)
70 mkdir -p $(PDB_TARGET)
71 install -m 644 $(PDB_BLAST) $(PDB_FASTA) $(PDB_TARGET)
73 # Do BLAST DB formating. This depends on a group of files, so if any of
74 # them are deleted/too old, then they're reformated.
75 $(PDB_BLAST): $(PDB_FASTA)
76 $(FORMATDB) $(PDB_FASTA)
78 $(PDB_FASTA): $(PDB_FILE)
79 cp $(PDB_FILE) $(PDB_FASTA)
81 # This is a phony rule that's always executed, in this case it's to check
82 # whether a newer version of the PDB FASTA file has been deposited on the
84 # It has to be a phony rule as if it's made a normal rule that depends
85 # on the file that's downloaded, its always considered upto date and the
86 # wget command isn't run.
89 $(WGET) $(PDB_FASTA) $(PDB_URL)
91 ######################################################################
93 swall.db: sp_wget trembl_wget $(SWALL_INSTALL)
95 $(SWALL_INSTALL): $(SWALL_BLAST) $(SWALL_FASTA) $(SWALL_FILT) $(SWALL_INDX)
96 mkdir -p $(SWALL_TARGET)
97 install -m 644 $(SWALL_BLAST) $(SWALL_FASTA) $(SWALL_FILT) $(SWALL_INDX) $(SWALL_TARGET)
99 $(SWALL_BLAST): $(SWALL_FILT)
100 $(FORMATDB) $(SWALL_FILT)
102 # This next line defines a temporary variable for the target
103 $(SWALL_FILT): TMP_FILE := $(shell tempfile -d /r0/scratch)
104 $(SWALL_FILT): $(SWALL_FASTA)
105 seg $(SWALL_FASTA) 12 2.2 2.5 -x > $(TMP_FILE)
106 ~/src/helixfilt/helixfilt $(TMP_FILE) > $(SWALL_FILT)
109 $(SWALL_INDX): $(SWALL_FASTA)
110 db_dbmindex $(SWALL_FASTA) $(SWALL_INDX)
112 $(SWALL_FASTA): $(SP_FILE) $(TREMBL_FILE)
113 gzip -c -d $(SP_FILE) > $(SWALL_FASTA)
114 gzip -c -d $(TREMBL_FILE) >> $(SWALL_FASTA)
118 $(TREMBL_FILE): trembl_wget
126 $(WGET) $(TREMBL_URL)
128 ######################################################################
130 -rm $(SWALL_FASTA) $(SWALL_INDX) $(SWALL_FILT) $(SWALL_BLAST)
131 -rm $(PDB_FASTA) $(PDB_BLAST)
132 -rm formatdb.log *.ptm
135 -rm $(PDB_FILE) $(SP_FILE) $(TREMBL_FILE)
138 -rm -r $(SWALL_TARGET)