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

Diff of /Sprout/SHSigGenes.pm

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

revision 1.1, Tue Sep 26 13:46:03 2006 UTC revision 1.3, Fri Sep 29 15:10:05 2006 UTC
# Line 80  Line 80 
80      # there is the selector for the given genome, the commonality and cutoff values,      # there is the selector for the given genome, the commonality and cutoff values,
81      # and the submit button. Our first task, then, is to get the genome selection      # and the submit button. Our first task, then, is to get the genome selection
82      # menus.      # menus.
83      my $givenMenu   = $self->NmpdrGenomeMenu('given', { size => 1 }, [$cgi->param('genome')]);      my $givenMenu   = $self->NmpdrGenomeMenu('given', 0, [$cgi->param('genome')]);
84      my $targetMenu  = $self->NmpdrGenomeMenu('target', { size => 10, multiple => 'multiple' },      my $targetMenu  = $self->NmpdrGenomeMenu('target', 'multiple', [$cgi->param('target')]);
85                                               [$cgi->param('target')]);      my $excludeMenu = $self->NmpdrGenomeMenu('exclusion', 'multiple', [$cgi->param('exclusion')]);
     my $excludeMenu = $self->NmpdrGenomeMenu('exclusion', { size => 10, multiple => 'multiple' },  
                                              [$cgi->param('exclusion')]);  
86      # Get the default values to use for the commonality and cutoff controls.      # Get the default values to use for the commonality and cutoff controls.
87      my $commonality = $cgi->param('commonality') || "0.8";      my $commonality = $cgi->param('commonality') || "0.8";
88      my $cutoff = $cgi->param('cutoff') || "1e-10";      my $cutoff = $cgi->param('cutoff') || "1e-10";
# Line 100  Line 98 
98                                                    -value => $cutoff,                                                    -value => $cutoff,
99                                                    -size => 5)));                                                    -size => 5)));
100      push @rows, $self->SubmitRow();      push @rows, $self->SubmitRow();
101      # The next rows have the three genome menus.      # The next rows have the given genome and a feature filter.
102      push @rows, $cgi->Tr($cgi->td({valign => "top"}, "Given Genome"),      push @rows, $cgi->Tr($cgi->td({valign => "top"}, "Given Genome"),
103                           $cgi->td({colspan => 2}, $givenMenu));                           $cgi->td({colspan => 2}, $givenMenu));
104        push @rows, $self->FeatureFilterRows();
105        # Now show the target and exclusion menus.
106      push @rows, $cgi->Tr($cgi->td({valign => "top"}, "Target Genomes (Set 1)"),      push @rows, $cgi->Tr($cgi->td({valign => "top"}, "Target Genomes (Set 1)"),
107                           $cgi->td({colspan => 2}, $targetMenu));                           $cgi->td({colspan => 2}, $targetMenu));
108      push @rows, $cgi->Tr($cgi->td({valign => "top"}, "Exclusion Genomes (Set 2)"),      push @rows, $cgi->Tr($cgi->td({valign => "top"}, "Exclusion Genomes (Set 2)"),
# Line 132  Line 132 
132      # Get the sprout and CGI query objects.      # Get the sprout and CGI query objects.
133      my $cgi = $self->Q();      my $cgi = $self->Q();
134      my $sprout = $self->DB();      my $sprout = $self->DB();
135      # Declare the return variable.      # Declare the return variable. If it remains undefined, the caller will
136        # assume there was an error.
137      my $retVal;      my $retVal;
138        # Validate the numeric parameters.
139        my $commonality = $cgi->param('commonality');
140        my $cutoff = $cgi->param('cutoff');
141        if ($commonality !~ /^\s*\d(\.\d+)?\s*$/) {
142            $self->SetMessage("Commonality value appears invalid, too big, negative, or not a number.");
143        } elsif ($commonality <= 0 || $commonality > 1) {
144            $self->SetMessage("Commonality cannot be 0 and cannot be greater than 1.");
145        } elsif ($cutoff !~ /^\s*\d(.\d+)?(e\-\d+)?\s*$/) {
146            $self->SetMessage("Cutoff must be an exponential number (e.g. \"1e-20\" or \"2.5e-11\".");
147        } elsif ($cutoff > 1) {
148            $self->SetMessage("Cutoff cannot be greater than 1.");
149        } else {
150            # Now we need to gather and validate the genome sets.
151            my ($givenGenomeID) = $self->GetGenomes('given');
152            my %targetGenomes = map { $_ => 1 } $self->GetGenomes('target');
153            my %exclusionGenomes = map { $_ => 1 } $self->GetGenomes('exclusion');
154            # Insure the given genome is not in the exclusion set.
155            if ($exclusionGenomes{$givenGenomeID}) {
156                $self->SetMessage("The given genome ($givenGenomeID) cannot be in the exclusion set.");
157            } else {
158                # Insure the given genome is in the target set.
159                $targetGenomes{$givenGenomeID} = 1
160            }
161            # Denote we have not yet found any genomes.
162            $retVal = 0;
163      # TODO: find stuff      # TODO: find stuff
164        }
165      # Return the result count.      # Return the result count.
166      return $retVal;      return $retVal;
167  }  }
# Line 155  Line 180 
180      # Get the parameters.      # Get the parameters.
181      my ($self) = @_;      my ($self) = @_;
182      # Return the result.      # Return the result.
183      return "Search for features that common to a group of organisms or that discriminate between two groups of organisms.";      return "Search for features that are common to a group of organisms or that discriminate between two groups of organisms.";
184  }  }
185    
186  1;  1;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3