[Bio] / FigWebServices / check_variants.cgi Repository:
ViewVC logotype

Diff of /FigWebServices/check_variants.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5, Wed Oct 10 18:25:43 2007 UTC revision 1.6, Thu Oct 11 20:15:00 2007 UTC
# Line 113  Line 113 
113      my $encoding = [[],0];   # Encoding is a 2-tuple [Memory,NxtAvail]      my $encoding = [[],0];   # Encoding is a 2-tuple [Memory,NxtAvail]
114      my $abbrev_to_loc = {};      my $abbrev_to_loc = {};
115    
116      my @roles = &load_roles($encoding,$abbrev_to_loc,\@rolesI);      my @roles = &load_roles($cgi,$html,$encoding,$abbrev_to_loc,\@rolesI);
117      &load_definitions($encoding,$abbrev_to_loc,\@definitionsI);      if (@roles < 1)
118      my @rules = &parse_rules($encoding,$abbrev_to_loc,\@rulesI);      {
119            push(@$html,$cgi->h1("Roles are invalid"));
120        }
121        else
122        {
123            my $rc = &load_definitions($cgi,$html,$encoding,$abbrev_to_loc,\@definitionsI);
124            if (! $rc)
125            {
126                push(@$html,$cgi->h1("Definitions are invalid"));
127            }
128            else
129            {
130                my @rules = &parse_rules($cgi,$html,$encoding,$abbrev_to_loc,\@rulesI);
131                if (@rules < 1)
132                {
133                    push(@$html,$cgi->h1("Rules are invalid"));
134                }
135                else
136                {
137      my $n = @rules;      my $n = @rules;
138      push(@$html,$cgi->h2("successfully parsed $n rules"));      push(@$html,$cgi->h2("successfully parsed $n rules"));
139      my $role_to_pegs = {};      my $role_to_pegs = {};
# Line 160  Line 178 
178          push(@$html,&HTML::make_table($col_headers_mismatch,$tab_mismatch,"Genomes With Mismatching Variant Codes"));          push(@$html,&HTML::make_table($col_headers_mismatch,$tab_mismatch,"Genomes With Mismatching Variant Codes"));
179      }      }
180  }  }
181            }
182        }
183    }
184  &HTML::show_page($cgi,$html);  &HTML::show_page($cgi,$html);
185    
186    
# Line 187  Line 208 
208  }  }
209    
210  sub load_roles {  sub load_roles {
211      my($encoding,$abbrev_to_loc,$rolesI) = @_;      my($cgi,$html,$encoding,$abbrev_to_loc,$rolesI) = @_;
212    
213      my @roles = ();      my @roles = ();
214      foreach $_ (@$rolesI)      foreach $_ (@$rolesI)
# Line 199  Line 220 
220              $abbrev_to_loc->{$abbrev} = $loc;              $abbrev_to_loc->{$abbrev} = $loc;
221              push(@roles,$role);              push(@roles,$role);
222          }          }
223            elsif ($_ =~ /\S/)
224            {
225                push(@$html,$cgi->h1("Invalid Role: $_"));
226            }
227      }      }
228      return @roles;      return @roles;
229  }  }
# Line 213  Line 238 
238  }  }
239    
240  sub load_definitions {  sub load_definitions {
241      my($encoding,$abbrev_to_loc,$defI) = @_;      my($cgi,$html,$encoding,$abbrev_to_loc,$defI) = @_;
242    
243        my $rc = 1;
244      foreach my $def (@$defI)      foreach my $def (@$defI)
245      {      {
246          if ($def =~ /^(\S+)\s+(\S.*\S)/)          if ($def =~ /^(\S+)\s+(\S.*\S)/)
# Line 223  Line 249 
249              my $loc = &parse_bool($bool,$encoding,$abbrev_to_loc);              my $loc = &parse_bool($bool,$encoding,$abbrev_to_loc);
250              $abbrev_to_loc->{$abbrev} = $loc;              $abbrev_to_loc->{$abbrev} = $loc;
251          }          }
252            elsif ($def =~ /\S/)
253            {
254                push(@$html,$cgi->h1("Invalid Definition: $def"));
255            }
256      }      }
257  }  }
258    
259  sub parse_rules {  sub parse_rules {
260      my($encoding,$abbrev_to_loc,$rulesI) = @_;      my($cgi,$html,$encoding,$abbrev_to_loc,$rulesI) = @_;
261    
262      my @rules = ();      my @rules = ();
263      foreach $_ (@$rulesI)      foreach $_ (@$rulesI)
# Line 239  Line 269 
269          {          {
270              push(@rules,[$variant_code,[$encoding->[0],$loc]]);              push(@rules,[$variant_code,[$encoding->[0],$loc]]);
271          }          }
272            elsif ($_ =~ /\S/)
273            {
274                push(@$html,$cgi->h1("Invalid rule: $_"));
275            }
276      }      }
277      return @rules;      return @rules;
278  }  }
# Line 291  Line 325 
325              &add_to_encoding($encoding,["of",$n,[@args]]);              &add_to_encoding($encoding,["of",$n,[@args]]);
326              $got = 1;              $got = 1;
327          }          }
328            last if (! $got);
         if (! $got)  
         {  
             confess "failed to parse \'$input\'\nGot to \'$s\'";  
         }  
329      }      }
330      return ($s =~ /^\s*<(\d+)>\s*$/) ? $1 : undef;      return ($s =~ /^\s*<(\d+)>\s*$/) ? $1 : undef;
331  }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3