[Bio] / Sprout / SearchHelper.pm Repository:
ViewVC logotype

Diff of /Sprout/SearchHelper.pm

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

revision 1.29, Sat Apr 14 21:41:25 2007 UTC revision 1.30, Thu Apr 19 00:05:51 2007 UTC
# Line 90  Line 90 
90    
91  =item extraPos  =item extraPos
92    
93  C<0> if the extra columns are to be at the beginning, else C<1>. The  Hash indicating which extra columns should be put at the end. Extra columns
94  default is zero; use the L</SetExtraPos> method to change this option.  not mentioned in this hash are put at the beginning. Use the L</SetExtraPos>
95    method to change this option.
96    
97  =back  =back
98    
# Line 325  Line 326 
326                    genomeList => undef,                    genomeList => undef,
327                    genomeParms => [],                    genomeParms => [],
328                    filtered => 0,                    filtered => 0,
329                    extraPos => 0,                    extraPos => {},
330                   };                   };
331      # Bless and return it.      # Bless and return it.
332      bless $retVal, $class;      bless $retVal, $class;
# Line 388  Line 389 
389    
390  =head3 SetExtraPos  =head3 SetExtraPos
391    
392  C<< $shelp->SetExtraPos($newValue); >>  C<< $shelp->SetExtraPos(@columnMap); >>
393    
394  Indicate whether the extra columns should be in the front (C<0>) or end (C<1>) columns of the results.  Indicate whether the extra columns should be in the front (C<0>) or end (C<1>) columns of the results.
395    
396  =over 4  =over 4
397    
398  =item newValue  =item columnMap
399    
400  C<1> if the extra columns should be displayed at the end, else C<0>.  A list of extra columns to display at the end.
401    
402  =back  =back
403    
404  =cut  =cut
405    
406  sub SetExtraPos {  sub SetExtraPos {
407      my ($self, $newValue) = @_;      # Get the parameters.
408      $self->{extraPos} = $newValue;      my ($self, @columnMap) = @_;
409        # Convert the column map to a hash.
410        my %map = map { $_ => 1 } @columnMap;
411        # Save a reference to it.
412        $self->{extraPos} = \%map;
413  }  }
414    
415  =head3 ID  =head3 ID
# Line 712  Line 717 
717          # Tell the user what's happening.          # Tell the user what's happening.
718          $self->PrintLine("Creating output columns.<br />");          $self->PrintLine("Creating output columns.<br />");
719          # Here we need to set up the column information. First we accumulate the extras,          # Here we need to set up the column information. First we accumulate the extras,
720          # sorted by column name.          # sorted by column name and separate by whether they go in the beginning or the
721          my @xtraNames = ();          # end.
722            my @xtraNamesFront = ();
723            my @xtraNamesEnd = ();
724            my $xtraPosMap = $self->{extraPos};
725          for my $col (sort keys %{$extraCols}) {          for my $col (sort keys %{$extraCols}) {
726              push @xtraNames, "X=$col";              if ($xtraPosMap->{$col}) {
727                    push @xtraNamesEnd, "X=$col";
728                } else {
729                    push @xtraNamesFront, "X=$col";
730                }
731          }          }
732          # Set up the column name array.          # Set up the column name array.
733          my @colNames = ();          my @colNames = ();
734          # If extras go at the beginning, put them in first.          # Put in the extra columns that go in the beginning.
735          if (! $self->{extraPos}) {          push @colNames, @xtraNamesFront;
             push @colNames, @xtraNames;  
         }  
736          # Add the default columns.          # Add the default columns.
737          push @colNames, $self->DefaultFeatureColumns();          push @colNames, $self->DefaultFeatureColumns();
738          # Add any additional columns requested by the feature filter.          # Add any additional columns requested by the feature filter.
739          push @colNames, FeatureQuery::AdditionalColumns($self);          push @colNames, FeatureQuery::AdditionalColumns($self);
740          # If extras go at the end, put them in here.          # If extras go at the end, put them in here.
741          if ($self->{extraPos}) {          push @colNames, @xtraNamesEnd;
             push @colNames, @xtraNames;  
         }  
742          Trace("Full column list determined.") if T(3);          Trace("Full column list determined.") if T(3);
743          # Save the full list.          # Save the full list.
744          $self->{cols} = \@colNames;          $self->{cols} = \@colNames;
# Line 1955  Line 1963 
1963    
1964  sub AdvancedClassList {  sub AdvancedClassList {
1965      my @retVal = map { $_ =~ /^SH(\w+)\.pm/; $1 } grep { $_ =~ /^SH/ } keys %INC;      my @retVal = map { $_ =~ /^SH(\w+)\.pm/; $1 } grep { $_ =~ /^SH/ } keys %INC;
1966      return @retVal;      return sort @retVal;
1967  }  }
1968    
1969  =head3 SelectionTree  =head3 SelectionTree
# Line 2862  Line 2870 
2870      return $retVal;      return $retVal;
2871  }  }
2872    
2873    =head3 TuningParameters
2874    
2875    C<< my $options = $shelp->TuningParameters(%parmHash); >>
2876    
2877    Retrieve tuning parameters from the CGI query object. The parameter is a hash that maps parameter names
2878    to their default values. The parameters and their values will be returned as a hash reference.
2879    
2880    =over 4
2881    
2882    =item parmHash
2883    
2884    Hash mapping parameter names to their default values.
2885    
2886    =item RETURN
2887    
2888    Returns a reference to a hash containing the parameter names mapped to their actual values.
2889    
2890    =back
2891    
2892    =cut
2893    
2894    sub TuningParameters {
2895        # Get the parameters.
2896        my ($self, %parmHash) = @_;
2897        # Declare the return variable.
2898        my $retVal = {};
2899        # Get the CGI Query Object.
2900        my $cgi = $self->Q();
2901        # Loop through the parameter names.
2902        for my $parm (keys %parmHash) {
2903            # Get the incoming value for this parameter.
2904            my $value = $cgi->param($parm);
2905            # Zero might be a valid value, so we do an is-defined check rather than an OR.
2906            if (defined($value)) {
2907                $retVal->{$parm} = $value;
2908            } else {
2909                $retVal->{$parm} = $parmHash{$parm};
2910            }
2911        }
2912        # Return the result.
2913        return $retVal;
2914    }
2915    
2916  =head2 Virtual Methods  =head2 Virtual Methods
2917    
2918  =head3 Form  =head3 Form

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3