1 package SGN
::View
::Trial
;
9 trial_detail_design_view
13 sub trial_detail_design_view
{
14 my $design_ref = shift;
15 my %design = %{$design_ref};
16 my $design_result_html;
18 $design_result_html .= '<table border="1">';
19 $design_result_html .= qq{<tr
><th
>Plot Name
</th><th>Accession Name</th
><th
>Check Name
</th><th>Row number</th
><th
>Col number
</th><th>Block Number</th
><th
>Block Row Number
</th><th>Block Col Number</th
><th
>Rep Number
</th></tr
>};
21 foreach my $key (sort { $a <=> $b} keys %design) {
22 $design_result_html .= "<tr>";
23 if ($design{$key}->{plot_name
}) {
24 $design_result_html .= "<td>".$design{$key}->{plot_name
}."</td>";
26 $design_result_html .= "<td></td>";
28 if ($design{key
}->{accession_name
}) {
29 $design_result_html .= "<td>".$design{$key}->{accession_name
}."</td>";
31 $design_result_html .= "<td></td>";
33 if ($design{key
}->{check_name
}) {
34 $design_result_html .= "<td>".$design{$key}->{check_name
}."</td>";
36 $design_result_html .= "<td></td>";
38 if ($design{key
}->{row_number
}) {
39 $design_result_html .= "<td>".$design{$key}->{row_number
}."</td>";
41 $design_result_html .= "<td></td>";
43 if ($design{key
}->{col_number
}) {
44 $design_result_html .= "<td>".$design{$key}->{col_number
}."</td>";
46 $design_result_html .= "<td></td>";
48 if ($design{key
}->{block_number
}) {
49 $design_result_html .= "<td>".$design{$key}->{block_number
}."</td>";
51 $design_result_html .= "<td></td>";
53 if ($design{key
}->{block_row_number
}) {
54 $design_result_html .= "<td>".$design{$key}->{block_row_number
}."</td>";
56 $design_result_html .= "<td></td>";
58 if ($design{key
}->{block_col_number
}) {
59 $design_result_html .= "<td>".$design{$key}->{block_col_number
}."</td>";
61 $design_result_html .= "<td></td>";
63 if ($design{key
}->{rep_number
}) {
64 $design_result_html .= "<td>".$design{$key}->{rep_number
}."</td>";
66 $design_result_html .= "<td></td>";
68 $design_result_html .= "</tr>";
70 $design_result_html .= "</table>";
71 return "$design_result_html";
76 sub design_layout_view
{
77 my $design_ref = shift;
78 my $design_info_ref = shift;
79 my $design_type = shift;
80 my %design = %{$design_ref};
81 my %design_info = %{$design_info_ref};
82 my $design_result_html;
84 $design_result_html .= '<table border="1">';
85 if ($design_type eq 'greenhouse') {
86 $design_result_html .= qq{<tr
><th
>Plant Name
</th><th>Accession Name</th
></tr
>};
88 foreach my $key (sort { $a <=> $b} keys %design) {
89 my $plant_name = $design{$key}->{plant_name
} || '';
90 my $stock_name = $design{$key}->{stock_name
} || '';
92 $design_result_html .= "<tr><td>".$plant_name."</td><td>".$stock_name."</td></tr>";
95 $design_result_html .= qq{<tr
><th
>Plot Name
</th><th>Accession Name</th
><th
>Check Name
</th><th>Row number</th
><th
>Col number
</th><th>Block Number</th
><th
>Block Row Number
</th><th>Block Col Number</th
><th
>Rep Number
</th></tr
>};
97 foreach my $key (sort { $a <=> $b} keys %design) {
98 my $plot_name = $design{$key}->{plot_name
} || '';
99 my $stock_name = $design{$key}->{stock_name
} || '';
100 my $check_name = $design{$key}->{check_name
} || '';
101 my $row_number = $design{$key}->{row_number
} || '';
102 my $col_number = $design{$key}->{col_number
} || '';
103 my $block_number = $design{$key}->{block_number
} || '';
104 my $block_row_number = $design{$key}->{block_row_number
} || '';
105 my $block_col_number = $design{$key}->{block_col_number
} || '';
106 my $rep_number = $design{$key}->{rep_number
} || '';
108 $design_result_html .= "<tr><td>".$plot_name."</td><td>".$stock_name."</td><td>".$check_name."</td><td>".$row_number."</td><td>".$col_number."</td><td>".$block_number."</td><td>".$block_row_number."</td><td>".$block_col_number."</td><td>".$rep_number."</td></tr>";
112 $design_result_html .= "</table>";
113 return "$design_result_html";
116 sub design_info_view
{
117 my $design_ref = shift;
118 my $design_info_ref = shift;
119 my %design = %{$design_ref};
120 my %design_info = %{$design_info_ref};
123 my $design_info_html;
124 my $design_description;
127 $design_info_html .= "<dl>";
129 if ($design_info{'design_type'}) {
130 $design_description = $design_info{'design_type'};
131 if ($design_info{'design_type'} eq "CRD") {
132 $design_description = "Completely Randomized Design";
134 if ($design_info{'design_type'} eq "RCBD") {
135 $design_description = "Randomized Complete Block Design";
137 if ($design_info{'design_type'} eq "Alpha") {
138 $design_description = "Alpha Lattice Incomplete Block Design";
140 if ($design_info{'design_type'} eq "Augmented") {
141 $design_description = "Augmented Incomplete Block Design";
143 if ($design_info{'design_type'} eq "MAD") {
144 $design_description = "Modified Augmented Design";
146 if ($design_info{'design_type'} eq "greenhouse") {
147 $design_description = "Greenhouse Design";
149 # if ($design_info{'design_type'} eq "MADII") {
150 # $design_description = "Modified Augmented Design II";
152 # if ($design_info{'design_type'} eq "MADIII") {
153 # $design_description = "Modified Augmented Design III";
155 # if ($design_info{'design_type'} eq "MADIV") {
156 # $design_description = "Modified Augmented Design IV";
158 $design_info_html .= "<dt>Design type</dt><dd>".$design_description."</dd>";
160 if ($design_info{'number_of_stocks'}) {
161 $design_info_html .= "<dt>Number of accessions</dt><dd>".$design_info{'number_of_stocks'}."</dd>";
163 if ($design_info{'number_of_controls'}) {
164 $design_info_html .= "<dt>Number of controls</dt><dd>".$design_info{'number_of_controls'}."</dd>";
167 foreach my $key (sort { $a <=> $b} keys %design) {
168 my $current_block_number = $design{$key}->{block_number
};
169 my $current_rep_number;
170 if ($current_block_number) {
171 if ($block_hash{$current_block_number}) {
172 $block_hash{$current_block_number} += 1;
174 $block_hash{$current_block_number} = 1;
177 if ($design{$key}->{rep_number
}) {
178 $current_rep_number = $design{$key}->{rep_number
};
179 if ($rep_hash{$current_rep_number}) {
180 $rep_hash{$current_rep_number} += 1;
182 $rep_hash{$current_rep_number} = 1;
188 $design_info_html .= "<dt>Number of blocks</dt><dd>".scalar(keys %block_hash)."</dd>";
189 $design_info_html .= "<dt>Number of accessions per block</dt><dd>";
190 foreach my $key (sort { $a <=> $b} keys %block_hash) {
191 $design_info_html .= "Block ".$key.": ".$block_hash{$key}." accessions <br>";
193 $design_info_html .= "</dt>";
198 $design_info_html .= "<dt>Number of reps</dt><dd>".scalar(keys %rep_hash)."</dd>";
201 $design_info_html .= "</dl>";
203 return $design_info_html;