rangi: improve some of the comments
[rangi.git] / mkrangi.sh
blob75937d00ac6affcfa4e5738d565081b92e2be367
1 # create RANGI input files for protein interaction networks
2 if [ $# != 5 ]
3 then
4 echo "Create RANGI input files for protein interaction networks"
5 echo
6 echo "Usage: mkrangi.sh NET FASN FASP CMPL PRE"
7 echo
8 echo " NET: the network interaction file"
9 echo " FASN: network fasta file"
10 echo " FASP: pattern fasta file"
11 echo " CMPL: pattern complexes (queries)"
12 echo " PRE: output file prefix"
13 echo
14 echo "Output files will be written to PRE.i.rangi, where i is"
15 echo "replaced with the line number of the query in CMPL. Note"
16 echo "that you need the blast program."
17 echo
18 echo "The necessary files can be obtained from:"
19 echo "http://igm.univ-mlv.fr/AlgoB/gramofone/"
20 exit
23 # parameters
24 NET="$1"
25 FASN="$2"
26 FASP="$3"
27 CMPL="$4"
28 PRE="$5"
30 # temporary files
31 FASP2=${FASP}_
32 QBL=${NET}_
34 cat $CMPL | cut -f 2 | tr ' ' '\n' | sed '/^\s\+$/d' | sort | uniq | ./fastafilt $FASP >$FASP2
35 formatdb -p T -i $FASN
36 formatdb -p T -i $FASP2
37 blastall -p blastp -i $FASP2 -d $FASN | ./bl2exp >$QBL
39 id=0
40 cat $CMPL | cut -f 2 | while read k
42 id=$(( $id + 1 ))
43 DAT="$PRE.$id.rangi"
44 DATG="$PRE.$id.dot"
45 ./conv -q $QBL $k <$NET >$DAT
46 ./conv -g -q $QBL $k <$NET >$DATG
47 done
49 rm $FASP2 $QBL