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

Diff of /FigWebServices/subsys.cgi

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

revision 1.2, Thu Sep 9 02:31:00 2004 UTC revision 1.3, Sat Sep 11 13:23:47 2004 UTC
# Line 611  Line 611 
611      push(@$html,$cgi->checkbox(-name => 'ignore_alt', -value => 1, -checked => 0, -override => 1,-label => 'ignore alternatives'),$cgi->br);      push(@$html,$cgi->checkbox(-name => 'ignore_alt', -value => 1, -checked => 0, -override => 1,-label => 'ignore alternatives'),$cgi->br);
612      push(@$html,$cgi->checkbox(-name => 'show_clusters', -value => 1, -checked => 0, -override => 1,-label => 'show clusters'),$cgi->br);      push(@$html,$cgi->checkbox(-name => 'show_clusters', -value => 1, -checked => 0, -override => 1,-label => 'show clusters'),$cgi->br);
613      push(@$html,$cgi->checkbox(-name => 'show_missing', -value => 1, -checked => 0, -override => 1,-label => 'show missing'),$cgi->br);      push(@$html,$cgi->checkbox(-name => 'show_missing', -value => 1, -checked => 0, -override => 1,-label => 'show missing'),$cgi->br);
614    
615      push(@$html,$cgi->checkbox(-name => 'show_missing_including_matches', -value => 1, -checked => 0, -override => 1,-label => 'show missing with matches'),      push(@$html,$cgi->checkbox(-name => 'show_missing_including_matches', -value => 1, -checked => 0, -override => 1,-label => 'show missing with matches'),
616                  "    [To restrict to a single genome: ",                  "    [To restrict to a single genome: ",
617                  $cgi->textfield(-name => "just_genome", -size => 15),"]",                  $cgi->textfield(-name => "just_genome", -size => 15),"]",
618                  "    [To restrict to a single role: ",                  "    [To restrict to a single role: ",
619                  $cgi->textfield(-name => "just_role", -size => 15),"]",                  $cgi->textfield(-name => "just_role", -size => 15),"]",
620                  $cgi->br                  $cgi->br,$cgi->br
621          );          );
622    
623        push(@$html,$cgi->checkbox(-name => 'check_assignments', -value => 1, -checked => 0, -override => 1,-label => 'check assignments'),
624                    '  [',
625                    $cgi->checkbox(-name => 'strict_check', -value => 1, -checked => 0, -override => 1,-label => 'strict'),
626                    ']',
627                    "    [To restrict to a single genome: ",
628                    $cgi->textfield(-name => "just_genome_assignments", -size => 15),"]",
629                    "    [To restrict to a single role: ",
630                    $cgi->textfield(-name => "just_role_assignments", -size => 15),"]",
631                    $cgi->br.$cgi->br
632            );
633    
634      push(@$html,$cgi->checkbox(-name => 'refill', -value => 1, -checked => 0, -override => 1,-label => 'refill spreadsheet from scratch'),$cgi->br);      push(@$html,$cgi->checkbox(-name => 'refill', -value => 1, -checked => 0, -override => 1,-label => 'refill spreadsheet from scratch'),$cgi->br);
635      push(@$html,$cgi->checkbox(-name => 'show_dups', -value => 1, -checked => 0, -override => 1,-label => 'show duplicates'),$cgi->br);      push(@$html,$cgi->checkbox(-name => 'show_dups', -value => 1, -checked => 0, -override => 1,-label => 'show duplicates'),$cgi->br);
636      push(@$html,$cgi->checkbox(-name => 'check_problems', -value => 1, -checked => 0, -override => 1,-label => 'show PEGs in roles that do not match precisely'),$cgi->br);      push(@$html,$cgi->checkbox(-name => 'check_problems', -value => 1, -checked => 0, -override => 1,-label => 'show PEGs in roles that do not match precisely'),$cgi->br);
# Line 655  Line 668 
668          &format_missing_including_matches($fig,$cgi,$html,$subsystem);          &format_missing_including_matches($fig,$cgi,$html,$subsystem);
669      }      }
670    
671        if ($cgi->param('check_assignments'))
672        {
673            &format_check_assignments($fig,$cgi,$html,$subsystem);
674        }
675    
676      if ($cgi->param('show_dups'))      if ($cgi->param('show_dups'))
677      {      {
678          &format_dups($fig,$cgi,$html,$subsystem);          &format_dups($fig,$cgi,$html,$subsystem);
# Line 1512  Line 1530 
1530           $cgi->end_form);           $cgi->end_form);
1531  }  }
1532    
1533    sub format_check_assignments {
1534        my($fig,$cgi,$html,$subsystem) = @_;
1535        my($org,$role);
1536    
1537        my $user = $cgi->param('user');
1538    
1539        my $active_subsetC = ($cgi->param('active_subsetC') or $subsystem->get_active_subsetC );
1540        my $active_subsetR = ($cgi->param('active_subsetR') or $subsystem->get_active_subsetR );
1541    
1542        my @subsetC = $subsystem->get_subsetC($active_subsetC);
1543        my %activeC = map { $_ => 1 } @subsetC;
1544    
1545        my @subsetR = $subsystem->get_subsetR($active_subsetR);
1546    
1547        push(@$html,$cgi->h1('Potentially Bad Assignments:'));
1548    
1549        foreach $org (@subsetR)
1550        {
1551            next if (($_ = $cgi->param('just_genome_assignments')) && ($_ != $org));
1552            my @bad = ();
1553    
1554            foreach $role (@subsetC)
1555            {
1556                next if (($_ = $cgi->param('just_role_assignments')) && ($_ != ($subsystem->get_role_index($role) + 1)));
1557                push(@bad,&checked_assignments($cgi,$subsystem,$org,$role));
1558            }
1559    
1560            if (@bad > 0)
1561            {
1562                my $genus_species = &ext_genus_species($fig,$org);
1563                push(@$html,$cgi->h2("$org: $genus_species"),
1564                            $cgi->ul($cgi->li(\@bad)));
1565    
1566            }
1567        }
1568        push(@$html,$cgi->hr);
1569    }
1570    
1571    sub checked_assignments {
1572        my($cgi,$subsystem,$genome,$role) = @_;
1573        my($peg,$line1,$line2,@out,$curr,$auto);
1574    
1575        my(@bad) = ();
1576        my @pegs = $subsystem->get_pegs_from_cell($genome,$role);
1577        if (@pegs > 0)
1578        {
1579            my $tmp = "/tmp/tmp.pegs.$$";
1580            open(TMP,">$tmp") || die "could not open $tmp";
1581            foreach $peg (@pegs)
1582            {
1583                print TMP "$peg\n";
1584            }
1585            close(TMP);
1586            my $strict = $cgi->param('strict_check') ? "strict" : "";
1587            @out = `$FIG_Config::bin/check_peg_assignments $strict < $tmp 2> /dev/null`;
1588            unlink($tmp);
1589    
1590            while (($_ = shift @out) && ($_ =~ /^(fig\|\d+\.\d+\.peg\.\d+)/))
1591            {
1592                $peg = $1;
1593                if (($line1 = shift @out) && ($line1 =~ /^current:\s+(\S.*\S)/) && ($curr = $1) &&
1594                    ($line2 = shift @out) && ($line2 =~ /^auto:\s+(\S.*\S)/) && ($auto = $1))
1595                {
1596                    if (! $fig->same_func($curr,$auto))
1597                    {
1598                        my $link = &HTML::fid_link($cgi,$peg);
1599                        push(@bad,"$link<br>$line1<br>$line2<br><br>");
1600                    }
1601                }
1602            }
1603        }
1604        return @bad;
1605    }
1606    
1607  sub format_dups {  sub format_dups {
1608      my($fig,$cgi,$html,$subsystem) = @_;      my($fig,$cgi,$html,$subsystem) = @_;
1609    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3