modified seedlot upload from cross file
[sgn.git] / cgi-bin / phenotype / index.pl
blob67e52ea9323d83e68cf644bf14214e34868e9215
1 #!/usr/bin/perl -w
3 #Main Page for Phenotypic Database
5 use strict;
6 use CXGN::Page;
7 use CXGN::DB::PhenoPopulation;
8 use CGI;
10 #get parameters from form on previous page
11 use CatalystX::GlobalContext qw( $c );
12 my %params = %{$c->req->params};
13 my $pop_id = $params{pop_id};
15 my $page = CXGN::Page->new('phenotype', 'Adri');
17 print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 transitional//EN\" \"http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd\">";
19 $page->header("Search the Phenotype Database");
21 #-------------------------------------------------
22 my @populations = CXGN::DB::PhenoPopulation::get_all_populations;
23 my $current_pop_id;
24 my $current_pop_name;
26 #population selected
27 if ($pop_id) {
28 $current_pop_id = $pop_id;
29 $current_pop_name = CXGN::DB::PhenoPopulation::get_pop_name_from_pop_id($pop_id);
32 #no population selected, first one in DB is used as default
33 else {
34 $current_pop_id = $populations[0][0];
35 $current_pop_name = $populations[0][1];
38 my @genotypes = CXGN::DB::PhenoPopulation::get_all_gen_from_pop_id($current_pop_id);
39 my @gen_ids;
40 for my $i (0..$#genotypes) {
41 push @gen_ids, $genotypes[$i][0];
43 my @prop_info_by_organ = CXGN::DB::PhenoPopulation::get_all_prop_info_by_organ_from_pop_id($current_pop_id);
45 print <<EOF
47 <table summary="" width="100%" cellpadding="0" cellspacing="10" border="0">
49 <tr><td valign="top">
50 <table summary="" width="100%" cellpadding="0" cellspacing="0" border="0">
52 <tr><td>
53 <center>
54 <h3><u>Welcome to the Phenotype Database</u></h3>
55 <p>From this page, you can search the phenotype databse for data and images of all plants from all populations.</p>
56 <p>There are two ways to find specific data and images: searching by genotype and phenotype.</p>
57 </center>
58 </td></tr>
60 <tr><td><img src="/documents/img/dot_clear.gif" width="1" alt="" height="10" /></td></tr>
61 <tr><td colspan="1" bgcolor="#cccccc"><img src="/documents/img/dot_clear.gif" alt="" width="1" height="1" /></td></tr>
62 <tr><td><img src="/documents/img/dot_clear.gif" width="1" height="10" alt="" /></td></tr>
64 <tr><td>
65 <center><h3><u>Search the Phenotype Database</u></h3></center>
67 <center>
68 <table summary="" width="100%" cellpadding="0" cellspacing="0" border="0">
70 <tr><td>
71 <!--populations-->
72 <form action="#" method="get">
73 <table summary="">
74 <tr><td valign="top">
76 EOF
79 print "<b><u>selected POPULATION:</u> $current_pop_name</b>";
81 print <<EOF
82 </td></tr>
83 <tr><td><p>Below is the list of population(s) currently in the database. Select a population and click the button to search images and data in another population.</p></td></tr>
84 <tr><td valign="top" align="left">
85 All Populations:
86 <select name="pop_id">
87 EOF
90 for (0..$#populations) {
91 print "<option value = \"$populations[$_][0]\">$populations[$_][1]</option>";
94 print <<EOF
95 </select>
96 </td>
97 <td valign="top" align="right">
98 <input type="submit" value="Change Population" />
99 </td></tr>
100 </table>
101 </form>
102 </td></tr>
104 <!--genotypes-->
106 <tr><td>
107 <form action="/phenotype/display_plants_from_genotype.pl" method="get">
108 <table summary="">
109 <tr><td>
110 <b><u>Search By GENOTYPES</u></b>
111 </td></tr>
112 <tr><td><p>Below is a list of all <b>genotypes</b> in the selected population above -
113 selecting a genotype will take you to a page of plants with the selected genotype. This new page will have links to all images and data of these plants:</p></td></tr>
114 <tr><td valign="top" align="left">
119 print "Genotypes in <b>$current_pop_name</b>:";
120 print "<select name=\"gen_id\">";
121 for my $i (0..$#genotypes) {
122 print "<option value = \"$genotypes[$i][0]\"> $genotypes[$i][1]</option>";
124 print "</select>";
125 print "<input type=\"hidden\" name=\"pop_id\" value=\"$current_pop_id\" />";
126 print "<input type=\"hidden\" name=\"pop_name\" value=\"$current_pop_name\" />";
128 print <<EOF
129 </td>
130 <td valign="top" align="right">
131 <input type="submit" value="get Plants by Genotype" />
132 </td></tr>
133 </table>
134 </form>
135 </td></tr>
137 <!--properties-->
138 <tr><td>
139 <form action="/phenotype/display_plants_from_property.pl" method="get">
140 <table summary=""><tr><td>
141 <b><u>Search By PROPERTIES</u></b> (<a href="display_prop_list.pl">Property Descriptions</a>)
142 </td></tr>
143 <tr><td>
147 print "<p>Below is a list of all <b>properties</b> measured in the selected population above -
148 selecting a property will take you to a page of plants with the selected property measured. This new page will have links to each plant's sample data and images:</p>";
150 print "</td></tr>";
151 print "<tr><td width=\"100%\" valign=\"top\" align=\"left\">";
153 print "Properties in <b>$current_pop_name</b>:";
154 print "<select name=\"prop_id\">";
156 for (0..$#prop_info_by_organ) {
157 my $i = $_;
158 $prop_info_by_organ[$i] or next;
159 my $organ_name = $prop_info_by_organ[$i][0][2];
160 print "<optgroup label=\"$organ_name\">";
161 for (0..$#{$prop_info_by_organ[$i]}) {
162 my $j = $_;
163 my $prop_id = $prop_info_by_organ[$i][$j][0];
164 my $prop_name = $prop_info_by_organ[$i][$j][1];
165 print "<option value = \"$prop_id\">$prop_name</option>\n";
167 print "</optgroup>";
170 print "</select>";
171 print "<input type=\"hidden\" name=\"pop_id\" value=\"$current_pop_id\" />";
172 print "<input type=\"hidden\" name=\"pop_name\" value=\"$current_pop_name\" />";
174 print <<EOF
176 </td>
177 <td width="100%" valign="top" align="right">
178 <input type="submit" value="get Plants by Property" />
179 </td></tr></table>
180 </form>
181 </td></tr>
183 </table>
184 </center>
185 </td>
186 </tr>
188 </table>
189 </td></tr>
191 <tr><td><img src="/documents/img/dot_clear.gif" width="1" height="10" alt="" /></td></tr>
192 <tr><td bgcolor="#cccccc"><img src="/documents/img/dot_clear.gif" width="1" height="1" alt="" /></td></tr>
193 <tr><td><img src="/documents/img/dot_clear.gif" width="1" height="10" alt="" /></td></tr>
195 <!--terminology-->
196 <tr><td>
197 <center><h3><u>Terminology</u></h3></center>
199 <table summary="" width="100%" cellpadding="0" cellspacing="0" border="0">
200 <tr><td>
202 <dl>
203 <dt><b>Population</b></dt>
204 <dd>all the organisms that constitute a specific group or occur in a specified location.</dd>
205 <dt><br /><b>Genotype</b></dt>
206 <dd>a group of organisms sharing a specific genetic constitution.</dd>
207 <dt><br /><b>Property/Phenotype</b></dt>
208 <dd>the observable physical or biochemical characteristics of an organism, as determined by both genetic makeup and environmental influences.</dd>
209 </dl>
211 </td></tr>
212 </table>
214 </td></tr>
216 </table>
220 #--------------------------
221 $page->footer();