File: runmkfm.sh

package info (click to toggle)
genometools 1.6.1%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 50,412 kB
  • sloc: ansic: 271,241; ruby: 30,339; python: 4,880; sh: 3,193; makefile: 1,194; perl: 219; pascal: 159; haskell: 37; sed: 5
file content (111 lines) | stat: -rwxr-xr-x 2,024 bytes parent folder | download | duplicates (9)
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
#!/bin/sh

set -x

if [ $# -lt 5 ]
then
  echo "Usage: $0 <gt-bin> <bothdirections> <idir> <fmindex> <file1> [file2 file3 ..]"
  exit 1
fi

gtbin=$1
bothdirections=$2
idir=$3
fmindex=${idir}/$4
shift
shift
shift
shift
rfiles=$*

cerr()
{
  $*
  if [ $? -ne 0 ]
  then
    echo "failure: $*"
    exit 1
  fi
}

suffixerator()
{
  cerr "${gtbin} suffixerator -algbds 3 43 120 $*"
}

makesuftab()
{
  if [ $1 = 'rev' ]
  then
    suffixerator -dna -bwt -lcp -tis -suf -pl -dir rev -indexname ${idir}/$2.rev -db $3
  else
    suffixerator -dna -lcp -tis -suf -pl -dir cpl -indexname ${idir}/$2.cpl -db $3
  fi
}

plain() 
{
  cerr "${gtbin} suffixerator -plain -des no -ssp no -sds no -tis -indexname $1 -smap $1.al1 -db $1.bwt"
}

mkfmindex() 
{
  indexname=$1
  shift
  iiargs=$*
  cerr "${gtbin} mkfmindex -size small -fmout ${indexname} -ii ${iiargs}"
}

needsrebuild=0

needconstruction1()
{
  if [ ! -f ${idir}/$2 ] ||
     [ $1 -nt ${idir}/$2 ]
  then
    $3
    needsrebuild=1
  else
    echo "# ${idir}/$2 is up to date"
  fi
}

mkdir -p ${idir}

indexlist=""
for rfile in ${rfiles}
do
  indexname=`basename ${rfile}`
  needconstruction1 ${rfile} \
                    "${indexname}.rev.prj" \
                    "makesuftab rev ${indexname} ${rfile}"
  indexlist="${indexlist} ${idir}/${indexname}.rev"
  if [ $bothdirections -eq 1 ]
  then
    needconstruction1 ${rfile} \
                      "${indexname}.cpl.prj" \
                      "makesuftab cpl ${indexname} ${rfile}"
    indexlist="${indexlist} ${idir}/${indexname}.cpl"
  fi
done

if [ $needsrebuild -eq 1 ] ||
   [ ! -f ${fmindex}.fma ] ||
   [ ! -f ${fmindex}.fmd ] ||
   [ ! -f ${fmindex}.bwt ]
then
  mkfmindex ${fmindex} ${indexlist}
  needsrebuild=1
else
  echo "# ${fmindex}.fma is up to date"
  echo "# ${fmindex}.fmd is up to date"
  echo "# ${fmindex}.bwt is up to date"
fi

if [ $needsrebuild -eq 1 ]
then
  needconstruction1 ${fmindex}.bwt ${fmindex}.esq "plain ${fmindex}"
  needsrebuild=1
else
  echo "# ${fmindex}.esq is up to date"
fi