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

Diff of /FigWebServices/protein.cgi

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

revision 1.97, Wed Mar 9 07:34:49 2005 UTC revision 1.98, Fri Mar 11 01:04:32 2005 UTC
# Line 950  Line 950 
950      my $maxN       = $SimParams->{ maxN };      my $maxN       = $SimParams->{ maxN };
951      my $maxP       = $SimParams->{ maxP };      my $maxP       = $SimParams->{ maxP };
952      my $max_expand = $SimParams->{ max_expand };      my $max_expand = $SimParams->{ max_expand };
953      my $just_fig   = $SimParams->{ just_fig };      my $select     = $SimParams->{ select };
954      my $show_env   = $SimParams->{ show_env };      my $show_env   = $SimParams->{ show_env };
955      my $hide_alias = $SimParams->{ hide_alias };      my $hide_alias = $SimParams->{ hide_alias };
956      my $group_by_genome = $SimParams->{ group_by_genome };      my $group_by_genome = $SimParams->{ group_by_genome };
957    
958        #  These are active, but the values are only used in sims()
959        # my $extra_opt = $SimParams->{ extra_opt };
960        # my $min_q_cov = $SimParams->{ min_q_cov };
961        # my $min_s_cov = $SimParams->{ min_s_cov };
962        # my $min_sim   = $SimParams->{ min_sim };
963        # my $sim_meas  = $SimParams->{ sim_meas };
964        # my $sort_by   = $SimParams->{ sort_by };
965    
966      #  None of these are currently active: -- GJO      #  None of these are currently active: -- GJO
967      my $extra_opt  = $SimParams->{ extra_opt };      # my $show_rep   = $SimParams->{ show_rep };
968      my $min_q_cov  = $SimParams->{ min_q_cov };      # my $max_sim    = $SimParams->{ max_sim };
969      my $min_s_cov  = $SimParams->{ min_s_cov };      # my $dyn_thrsh  = $SimParams->{ dyn_thrsh };
970      my $min_sim    = $SimParams->{ min_sim };      # my $save_dist  = $SimParams->{ save_dist };
971      my $sim_meas   = $SimParams->{ sim_meas };      # my $chk_which  = $SimParams->{ chk_which };
     my $show_rep   = $SimParams->{ show_rep };  
     my $max_sim    = $SimParams->{ max_sim };  
     my $dyn_thrsh  = $SimParams->{ dyn_thrsh };  
     my $save_dist  = $SimParams->{ save_dist };  
     my $chk_which  = $SimParams->{ chk_which };  
972    
973      #  There is currently no control to turn this on! -- GJO      #  There is currently no control to turn this on! -- GJO
974      my $expand_groups = $SimParams->{ expand_groups };      my $expand_groups = $SimParams->{ expand_groups };
975    
     my $select = $just_fig ? "fig" : "all";  
   
976      #  Move filtering of sims list out of display loop.  Avoids many problems,      #  Move filtering of sims list out of display loop.  Avoids many problems,
977      #  including display of table with no entries.  Anticipate more filters.      #  including display of table with no entries.  Anticipate more filters.
978      #  -- GJO      #  -- GJO
979      #      #
980      #  Adjust environmental filter to be 9999999, not 999999, which hid real      #  All the filtering is now done in get_raw_sims and expand_raw_sims. -- GJO
     #  genomes. -- GJO  
   
     my @sims = grep { $show_env || ( $_->id2 !~ /^fig\|9999999/ ) }  
                sims( $fig_or_sprout, $peg, $maxN, $maxP, $select, $max_expand, $group_by_genome );  
   
     #  Similarity filter  
981    
982      if ( defined( $min_sim ) && ( $min_sim > 0 ) && ( $sim_meas eq 'id' ) ) {      my @sims = sims( $fig_or_sprout,
983          @sims = grep { $_->iden >= $min_sim } @sims;                       $peg,
984      }                       $maxN,
985                         $maxP,
986      #  Query sequence coverage filter                       $select,
987                         $max_expand,
988      if ( defined( $min_q_cov ) && ( $min_q_cov > 0 ) ) {                       $group_by_genome,
989          my $thresh = 0.01 * $min_q_cov;                       $SimParams
990          @sims = grep { ( abs( $_->e1 - $_->b1 ) + 1 ) >= ( $thresh * $_->ln1 ) } @sims;                     );
     }  
   
     #  Subject sequence coverage filter  
   
     if ( defined( $min_s_cov ) && ( $min_s_cov > 0 ) ) {  
         my $thresh = 0.01 * $min_s_cov;  
         @sims = grep { ( abs( $_->e2 - $_->b2 ) + 1 ) >= ( $thresh * $_->ln2 ) } @sims;  
     }  
991    
992      if ( @sims ) {      if ( @sims ) {
993          push( @$html, $cgi->hr );          push( @$html, $cgi->hr );
# Line 1109  Line 1097 
1097          # RAE Add the check all/uncheck all boxes.          # RAE Add the check all/uncheck all boxes.
1098          push (@$html, $cgi->br, &HTML::java_buttons("fid_checked", "checked"), $cgi->br);          push (@$html, $cgi->br, &HTML::java_buttons("fid_checked", "checked"), $cgi->br);
1099    
   
1100          #          #
1101          # Total rewrite of sim table code: cleaner program flow; omitting          # Total rewrite of sim table code: cleaner program flow; omitting
1102          # empty columns; colorizing region-of-similarity cells -- GJO          # empty columns; colorizing region-of-similarity cells -- GJO
# Line 1363  Line 1350 
1350      my $maxN       = defined( $cgi->param('maxN') )       ? $cgi->param('maxN')       : 50;      my $maxN       = defined( $cgi->param('maxN') )       ? $cgi->param('maxN')       : 50;
1351      my $max_expand = defined( $cgi->param('max_expand') ) ? $cgi->param('max_expand') :  5;      my $max_expand = defined( $cgi->param('max_expand') ) ? $cgi->param('max_expand') :  5;
1352      my $maxP       = defined( $cgi->param('maxP') )       ? $cgi->param('maxP')       :  1.0e-5;      my $maxP       = defined( $cgi->param('maxP') )       ? $cgi->param('maxP')       :  1.0e-5;
1353      my $just_fig   = $cgi->param('just_fig')   || 0;      my $select     = $cgi->param('select')               || 'all';
1354      my $show_env   = $cgi->param('show_env')   || 0;      my $show_env   = $cgi->param('show_env')   || 0;
1355      my $hide_alias = $cgi->param('hide_alias') || 0;      my $hide_alias = $cgi->param('hide_alias') || 0;
1356      my $group_by_genome = $cgi->param('group_by_genome') || 0;      my $group_by_genome = $cgi->param('group_by_genome') || 0;
# Line 1390  Line 1377 
1377      my $min_q_cov = $extra_opt && defined( $cgi->param('min_q_cov') ) ? $cgi->param('min_q_cov') : 0;      my $min_q_cov = $extra_opt && defined( $cgi->param('min_q_cov') ) ? $cgi->param('min_q_cov') : 0;
1378      my $min_s_cov = $extra_opt && defined( $cgi->param('min_s_cov') ) ? $cgi->param('min_s_cov') : 0;      my $min_s_cov = $extra_opt && defined( $cgi->param('min_s_cov') ) ? $cgi->param('min_s_cov') : 0;
1379      my $sim_meas  = $extra_opt && defined( $cgi->param('sim_meas') )  ? $cgi->param('sim_meas')  : 'id';      my $sim_meas  = $extra_opt && defined( $cgi->param('sim_meas') )  ? $cgi->param('sim_meas')  : 'id';
1380        my $sort_by   = $extra_opt && defined( $cgi->param('sort_by') )   ? $cgi->param('sort_by')   : 'bits';
1381    
1382      #  New parameters.  Not yet implimented.      #  New parameters.  Not yet implimented.
1383      #  The defaults for representative sequences might be tuned:      #  The defaults for representative sequences might be tuned:
# Line 1416  Line 1404 
1404    
1405      #  Sanity checks on fixed vocabulary parameter values:      #  Sanity checks on fixed vocabulary parameter values:
1406    
1407      $sim_meas  = 'id'   unless $sim_meas   eq 'pos' || $sim_meas  eq 'bpp';      $select    = 'all'  unless $select     eq 'fig' || $select eq 'fig_pref';
1408        $sim_meas  = 'id'   unless $sim_meas   eq 'bpp';
1409      $chk_which = 'none' unless $chk_which  eq 'all' || $chk_which eq 'rep';      $chk_which = 'none' unless $chk_which  eq 'all' || $chk_which eq 'rep';
1410    
1411      #  Checkmarks for input tags      #  Checkmarks for input tags
1412    
1413      my $chk_just_fig   = chked_if( $just_fig );      my $chk_select_all  = select_if( $select eq 'all' );
1414        my $chk_select_figp = select_if( $select eq 'fig_pref' );
1415        my $chk_select_fig  = select_if( $select eq 'fig' );
1416      my $chk_show_env   = chked_if( $show_env );      my $chk_show_env   = chked_if( $show_env );
1417      my $chk_hide_alias = chked_if( $hide_alias );      my $chk_hide_alias = chked_if( $hide_alias );
1418      my $chk_group_by_genome = chked_if( $group_by_genome );      my $chk_group_by_genome = chked_if( $group_by_genome );
1419        my $chk_sort_by_id   = select_if( $sort_by eq 'id' );
1420        my $chk_sort_by_bits = select_if( $sort_by eq 'bits' );
1421        my $chk_sort_by_bpp  = select_if( $sort_by eq 'bpp' );
1422    
1423      #  Features unique to the long form:      #  Features unique to the long form:
1424    
# Line 1435  Line 1429 
1429    
1430          push @$html, <<"End_Short_Form";          push @$html, <<"End_Short_Form";
1431    
1432    <A href=\"Html/similarities_options.html\">Help with SEED similarities options</A>
1433  <FORM Action=\"protein.cgi#Similarities\">  <FORM Action=\"protein.cgi#Similarities\">
1434      <input type=hidden name=prot      value=\"$peg\">      <input type=hidden name=prot      value=\"$peg\">
1435      <input type=hidden name=sims      value=1>      <input type=hidden name=sims      value=1>
# Line 1446  Line 1441 
1441      Max sims:<input type=text name=maxN size=5 value=$maxN>      Max sims:<input type=text name=maxN size=5 value=$maxN>
1442      Max expand:<input type=text name=max_expand size=5 value=$max_expand>      Max expand:<input type=text name=max_expand size=5 value=$max_expand>
1443      Max E-val:<input type=text name=maxP size=8 value=$maxP>      Max E-val:<input type=text name=maxP size=8 value=$maxP>
1444      Just FIG IDs:<input type=checkbox name=just_fig value=1 $chk_just_fig>      <select name=select>
1445            <option value=all      $chk_select_all>Show all databases</option>
1446            <option value=fig_pref $chk_select_figp>FIG IDs preferred</option>
1447            <option value=fig      $chk_select_fig>Just FIG IDs</option>
1448        </select>
1449      Show Env. samples:<input type=checkbox name=show_env value=1 $chk_show_env>      Show Env. samples:<input type=checkbox name=show_env value=1 $chk_show_env>
1450      Hide aliases:<input type=checkbox name=hide_alias value=1 $chk_hide_alias>      Hide aliases:<input type=checkbox name=hide_alias value=1 $chk_hide_alias><br />
1451    
1452        Sort by
1453        <select name=sort_by>
1454            <option value=bits $chk_sort_by_id>score</option>
1455            <option value=id   $chk_sort_by_id>percent identity</option>
1456            <option value=bpp  $chk_sort_by_bpp>score per position</option>
1457        </select>
1458      Group by genome:<input type=checkbox name=group_by_genome value=1 $chk_group_by_genome><br />      Group by genome:<input type=checkbox name=group_by_genome value=1 $chk_group_by_genome><br />
1459  </FORM>  </FORM>
1460  End_Short_Form  End_Short_Form
# Line 1479  Line 1485 
1485          #  Checkmarks for input tags          #  Checkmarks for input tags
1486    
1487          my $chk_sim_meas_id  = select_if( $sim_meas eq 'id' );          my $chk_sim_meas_id  = select_if( $sim_meas eq 'id' );
         my $chk_sim_meas_pos = select_if( $sim_meas eq 'pos' );  
1488          my $chk_sim_meas_bpp = select_if( $sim_meas eq 'bpp' );          my $chk_sim_meas_bpp = select_if( $sim_meas eq 'bpp' );
1489          my $chk_show_rep     = chked_if( $show_rep );          my $chk_show_rep     = chked_if( $show_rep );
1490          my $chk_dyn_thrsh    = chked_if( $dyn_thrsh );          my $chk_dyn_thrsh    = chked_if( $dyn_thrsh );
# Line 1492  Line 1497 
1497          #  Default options          #  Default options
1498    
1499          push @$html, <<"End_Default_Options";          push @$html, <<"End_Default_Options";
1500    
1501    <A href=\"Html/similarities_options.html\">Help with SEED similarities options</A>
1502  <FORM Action=\"protein.cgi#Similarities\">  <FORM Action=\"protein.cgi#Similarities\">
1503      <input type=hidden name=prot      value=\"$peg\">      <input type=hidden name=prot      value=\"$peg\">
1504      <input type=hidden name=sims      value=1>      <input type=hidden name=sims      value=1>
# Line 1502  Line 1509 
1509      Max sims:<input type=text name=maxN size=5 value=$maxN>      Max sims:<input type=text name=maxN size=5 value=$maxN>
1510      Max expand:<input type=text name=max_expand size=5 value=$max_expand>      Max expand:<input type=text name=max_expand size=5 value=$max_expand>
1511      Max E-val:<input type=text name=maxP size=8 value=$maxP>      Max E-val:<input type=text name=maxP size=8 value=$maxP>
1512      Just FIG IDs:<input type=checkbox name=just_fig value=1 $chk_just_fig>      <select name=select>
1513            <option value=all      $chk_select_all>Show all databases</option>
1514            <option value=fig_pref $chk_select_figp>FIG IDs preferred</option>
1515            <option value=fig      $chk_select_fig>Just FIG IDs</option>
1516        </select>
1517      Show Env. samples:<input type=checkbox name=show_env value=1 $chk_show_env>      Show Env. samples:<input type=checkbox name=show_env value=1 $chk_show_env>
1518      Hide aliases:<input type=checkbox name=hide_alias value=1 $chk_hide_alias>      Hide aliases:<input type=checkbox name=hide_alias value=1 $chk_hide_alias><br />
1519    
1520        Sort by
1521        <select name=sort_by>
1522            <option value=bits $chk_sort_by_id>score</option>
1523            <option value=id   $chk_sort_by_id>percent identity</option>
1524            <option value=bpp  $chk_sort_by_bpp>score per position</option>
1525        </select>
1526      Group by genome:<input type=checkbox name=group_by_genome value=1 $chk_group_by_genome><br />      Group by genome:<input type=checkbox name=group_by_genome value=1 $chk_group_by_genome><br />
1527  End_Default_Options  End_Default_Options
1528    
# Line 1514  Line 1532 
1532      <input type=hidden name=extra_opt value=\"$extra_opt\">      <input type=hidden name=extra_opt value=\"$extra_opt\">
1533    
1534      Min similarity:<input type=text name=min_sim size=5 value=$min_sim>      Min similarity:<input type=text name=min_sim size=5 value=$min_sim>
1535      as defined by      defined by
1536      <select name=sim_meas>      <select name=sim_meas>
1537          <option value=id  $chk_sim_meas_id>identities</option>          <option value=id  $chk_sim_meas_id>identities (0-100%)</option>
1538          <!--  Hide unimplimented options          <option value=bpp $chk_sim_meas_bpp>score per position (0-2 bits)</option>
         <option value=pos $chk_sim_meas_pos>\"positives\"</option>  
         <option value=bpp $chk_sim_meas_bpp>bit score per position</option>  
         -->  
1539      </select>      </select>
1540      Min query coverage:<input type=text name=min_q_cov size=5 value=$min_q_cov>      Min query cover (%):<input type=text name=min_q_cov size=5 value=$min_q_cov>
1541      Min subject coverage:<input type=text name=min_s_cov size=5 value=$min_s_cov><br />      Min subject cover (%):<input type=text name=min_s_cov size=5 value=$min_s_cov><br />
1542    
1543      <!--  Hide unimplimented options      <!--  Hide unimplimented options
1544      <TABLE Cols=2>      <TABLE Cols=2>
# Line 1566  Line 1581 
1581      { maxN          => $maxN,      { maxN          => $maxN,
1582        maxP          => $maxP,        maxP          => $maxP,
1583        max_expand    => $max_expand,        max_expand    => $max_expand,
1584        just_fig      => $just_fig,        select        => $select,
1585        show_env      => $show_env,        show_env      => $show_env,
1586        hide_alias    => $hide_alias,        hide_alias    => $hide_alias,
1587        group_by_genome => $group_by_genome,        group_by_genome => $group_by_genome,
# Line 1576  Line 1591 
1591        min_q_cov     => $min_q_cov,        min_q_cov     => $min_q_cov,
1592        min_s_cov     => $min_s_cov,        min_s_cov     => $min_s_cov,
1593        sim_meas      => $sim_meas,        sim_meas      => $sim_meas,
1594          sort_by       => $sort_by,
1595        show_rep      => $show_rep,        show_rep      => $show_rep,
1596        max_sim       => $max_sim,        max_sim       => $max_sim,
1597        dyn_thrsh     => $dyn_thrsh,        dyn_thrsh     => $dyn_thrsh,
# Line 2610  Line 2626 
2626      return $fig_or_sprout->subsystems_for_peg($peg);      return $fig_or_sprout->subsystems_for_peg($peg);
2627  }  }
2628    
2629    
2630  sub sims {  sub sims {
2631      my($fig_or_sprout,$peg,$max,$cutoff,$select,$expand,$group_by_genome) = @_;      my( $fig_or_sprout, $peg, $max, $cutoff, $select, $expand, $group_by_genome, $filters ) = @_;
2632      my(@tmp,$id,$genome,@genomes,%sims,$sim);      my(@tmp,$id,$genome,@genomes,%sims,$sim);
2633    
2634      @tmp = $fig_or_sprout->sims($peg,$max,$cutoff,$select,$expand);      @tmp = $fig_or_sprout->sims( $peg, $max, $cutoff, $select, $expand, $filters );
2635      if (! $group_by_genome)  { return @tmp };      if (! $group_by_genome)  { return @tmp };
2636    
2637        #  Collect all sims from genome with the first occurance of the genome:
2638    
2639      foreach $sim (@tmp)      foreach $sim (@tmp)
2640      {      {
2641          $id = $sim->id2;          $id = $sim->id2;
2642          if ($id =~ /^fig\|(\d+\.\d+)\.peg\.\d+/)          $genome = ($id =~ /^fig\|(\d+\.\d+)\.peg\.\d+/) ? $1 : $id;
2643          {          if (! defined( $sims{ $genome } ) ) { push @genomes, $genome }
2644              $genome = $1;          push @{ $sims{ $genome } }, $sim;
         }  
         else  
         {  
             $genome = $id;  
         }  
         if (! defined($sims{$genome}))  
         {  
             push(@genomes,$genome);  
         }  
         push(@{$sims{$genome}},$sim);  
2645      }      }
2646      return map { @{$sims{$_}} } @genomes;      return map { @{$sims{$_}} } @genomes;
2647  }  }
2648    
2649    
2650  sub in_family {  sub in_family {
2651      my($fig_or_sprout,$id) = @_;      my($fig_or_sprout,$id) = @_;
2652    

Legend:
Removed from v.1.97  
changed lines
  Added in v.1.98

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3