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

Annotation of /Sprout/TargetCriterionSmallTable.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :    
3 :     #
4 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
5 :     # for Interpretations of Genomes. All Rights Reserved.
6 :     #
7 :     # This file is part of the SEED Toolkit.
8 :     #
9 :     # The SEED Toolkit is free software. You can redistribute
10 :     # it and/or modify it under the terms of the SEED Toolkit
11 :     # Public License.
12 :     #
13 :     # You should have received a copy of the SEED Toolkit Public License
14 :     # along with this program; if not write to the University of Chicago
15 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
16 :     # Genomes at veronika@thefig.info or download a copy from
17 :     # http://www.theseed.org/LICENSE.TXT.
18 :     #
19 :    
20 :     package TargetCriterionSmallTable;
21 :    
22 :     use strict;
23 :     use Tracer;
24 :     use Sprout;
25 :     use base qw(TargetCriterionCodeMatch);
26 :    
27 :     =head1 Small Table Target Search Criterion Object
28 :    
29 :     =head2 Introduction
30 :    
31 :     This is a search criterion object for filtering via a connection to a small
32 :     table of values. This is a subclass of the [[TargetCriterionCodeMatchPm]] class
33 :     for the case where the code table must be computed at runtime.
34 :    
35 :     =head3 new
36 :    
37 :     my $tc = TargetCriterionSmallTable->new($rhelp, $name, $label, $hint, $field => @path);
38 :    
39 :     Construct a new TargetCriterionSmallTable object. The following parameters are
40 :     expected.
41 :    
42 :     =over 4
43 :    
44 :     =item rhelp
45 :    
46 :     [[ResultHelperPm]] object for the active search.
47 :    
48 :     =item name
49 :    
50 :     Identifying name of this criterion.
51 :    
52 :     =item label
53 :    
54 :     Label to display in the type dropdown.
55 :    
56 :     =item hint
57 :    
58 :     String to use as a tooltip for the hint button.
59 :    
60 :     =item field
61 :    
62 :     Name of the relevant database field.
63 :    
64 :     =item path
65 :    
66 :     List of entities and relationships forming a path from the C<Genome> or C<Feature> table
67 :     to the table containing the database field.
68 :    
69 :     =back
70 :    
71 :     =cut
72 :    
73 :     sub new {
74 :     # Get the parameters.
75 :     my ($class, $rhelp, $name, $label, $hint, $field, @path) = @_;
76 :     # Rip the small table off the path.
77 :     my $table = pop @path;
78 :     # Compute the possible values. Note that we throw away "unknown".
79 :     my $sprout = $rhelp->DB();
80 :     my %selectionData = map { $_ => $_ } grep { $_ && $_ ne 'unknown' } $sprout->GetFlat($table, "", [], 'id');
81 :     # Construct the underlying object.
82 :     my $retVal = TargetCriterionCodeMatch::new($class, $rhelp, $name, $label, $hint,
83 :     \%selectionData, $field, @path);
84 :     # Return the object.
85 :     return $retVal;
86 :     }
87 :    
88 :    
89 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3