3 # quick, very dirty little script so that we can put all the
4 # information for building a residue book set (except the original
5 # partitioning) in one spec file.
9 # >res0_128_128 interleaved
10 # haux res0_96_128aux.vqd 0,4,2
11 # :1 res0_128_128_1.vqd, 4, nonseq cull, 0 +- 1
12 # +1a, 4, nonseq, 0 +- .25 .5
13 # :2 res0_128_128_2.vqd, 4, nonseq, 0 +- 1(.7) 2
14 # :3 res0_128_128_3.vqd, 4, nonseq, 0 +- 1(.7) 3 5
15 # :4 res0_128_128_4.vqd, 2, nonseq, 0 +- 1(.7) 3 5 8 11
16 # :5 res0_128_128_5.vqd, 1, nonseq, 0 +- 1 3 5 8 11 14 17 20 24 28 31 35 39
19 die "Could not open $ARGV[0]: $!" unless open (F,$ARGV[0]);
31 if($line=~m/\S+/ && !($line=~m/^\#/) ){
34 die "Couldn't shell command.\n\tcommand:$command\n"
41 if($line=~m/^>(\S+)\s+(\S*)/){
48 # haux res0_96_128aux.vqd 0,4,2
50 # build a huffman book (no mapping)
51 my($name,$datafile,$arg)=split(' ',$1);
53 my $command="huffbuild $datafile $arg";
54 print ">>> $command\n";
55 die "Couldn't build huffbook.\n\tcommand:$command\n"
60 # :1 res0_128_128_1.vqd, 4, nonseq, 0 +- 1
62 my($namedata,$dim,$seqp,$vals)=split(',',$1);
63 my($name,$datafile)=split(' ',$namedata);
69 foreach my$val (split(' ',$vals)){
70 if($val=~/\-?\+?\d+/){
73 # got an explicit threshhint?
74 if($val=~/([0-9\.]+)\(([^\)]+)/){
82 $thlist.="," if(defined($thlist));
90 $thlist.="," if(defined($thlist));
99 die "Couldn't open temp file temp$$.vql: $!" unless
100 open(G,">temp$$.vql");
101 print G "$count $dim 0 ";
103 print G "0\n$list\n";
105 print G "1\n$list\n";
109 my $command="latticebuild temp$$.vql > $globalname$name.vqh";
110 print ">>> $command\n";
111 die "Couldn't build latticebook.\n\tcommand:$command\n"
114 my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
115 print ">>> $command\n";
116 die "Couldn't pre-hint latticebook.\n\tcommand:$command\n"
119 if($interleave=~/non/){
126 my $command="$restune temp$$.vqh $datafile 1 > $globalname$name.vqh";
127 print ">>> $command\n";
128 die "Couldn't tune latticebook.\n\tcommand:$command\n"
131 my $command="$restune temp$$.vqh $datafile > $globalname$name.vqh";
132 print ">>> $command\n";
133 die "Couldn't tune latticebook.\n\tcommand:$command\n"
137 my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
138 print ">>> $command\n";
139 die "Couldn't post-hint latticebook.\n\tcommand:$command\n"
142 my $command="mv temp$$.vqh $globalname$name.vqh";
143 print ">>> $command\n";
144 die "Couldn't rename latticebook.\n\tcommand:$command\n"
147 # run the training data through book to cascade
148 if($interleave=~/non/){
149 $vqcascade="vqcascade";
151 $vqcascade="vqcascade -i";
154 my $command="$vqcascade +$globalname$name.vqh $datafile > temp$$.vqd";
155 print ">>> $command\n";
156 die "Couldn't cascade latticebook.\n\tcommand:$command\n"
160 my $command="rm temp$$.vql";
161 print ">>> $command\n";
162 die "Couldn't remove temp files.\n\tcommand:$command\n"
167 # +a 4, nonseq, 0 +- 1
168 if($line=~m/^\+(.*)/){
169 my($name,$dim,$seqp,$vals)=split(',',$1);
176 foreach my$val (split(' ',$vals)){
177 if($val=~/\-?\+?\d+/){
180 # got an explicit threshhint?
181 if($val=~/([0-9\.]+)\(([^\)]+)/){
189 $thlist.="," if(defined($thlist));
194 if($plusminus=~/\+/){
197 $thlist.="," if(defined($thlist));
206 die "Couldn't open temp file temp$$.vql: $!" unless
207 open(G,">temp$$.vql");
208 print G "$count $dim 0 ";
210 print G "0\n$list\n";
212 print G "1\n$list\n";
216 my $command="latticebuild temp$$.vql > $globalname$name.vqh";
217 print ">>> $command\n";
218 die "Couldn't build latticebook.\n\tcommand:$command\n"
221 my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
222 print ">>> $command\n";
223 die "Couldn't pre-hint latticebook.\n\tcommand:$command\n"
226 if($interleave=~/non/){
233 my $command="$restune temp$$.vqh temp$$.vqd 1 > $globalname$name.vqh";
234 print ">>> $command\n";
235 die "Couldn't tune latticebook.\n\tcommand:$command\n"
238 my $command="$restune temp$$.vqh temp$$.vqd > $globalname$name.vqh";
239 print ">>> $command\n";
240 die "Couldn't tune latticebook.\n\tcommand:$command\n"
244 my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
245 print ">>> $command\n";
246 die "Couldn't post-hint latticebook.\n\tcommand:$command\n"
249 my $command="mv temp$$.vqh $globalname$name.vqh";
250 print ">>> $command\n";
251 die "Couldn't rename latticebook.\n\tcommand:$command\n"
254 # run the training data through book to cascade
255 if($interleave=~/non/){
256 $vqcascade="vqcascade";
258 $vqcascade="vqcascade -i";
261 my $command="$vqcascade +$globalname$name.vqh temp$$.vqd > tempa$$.vqd";
262 print ">>> $command\n";
263 die "Couldn't cascade latticebook.\n\tcommand:$command\n"
267 my $command="rm temp$$.vql";
268 print ">>> $command\n";
269 die "Couldn't remove temp files.\n\tcommand:$command\n"
272 my $command="mv tempa$$.vqd temp$$.vqd";
273 print ">>> $command\n";
274 die "Couldn't rename temp file.\n\tcommand:$command\n"
281 $command="rm temp$$.vqd";
282 print ">>> $command\n";
283 die "Couldn't remove temp files.\n\tcommand:$command\n"