5 basic_experiment_info.mas
6 Mason component to show the basic information for experimental design web page.
18 Mason component to show the basic information for experiment web page.
20 - Mason root page = experiment_detail.mas
21 - Perl controller = experiment.pl
23 The use of CXGN::People::Person require of dbi connection not linked
24 with the schema object
31 Aureliano Bombarely (ab782@cornell.edu)
48 use CXGN::GEM::Schema;
49 use CXGN::Chado::Dbxref;
50 use CXGN::GEM::Hybridization;
51 use CXGN::People::Person;
52 use CXGN::Page::FormattingHelpers qw/ info_section_html info_table_html columnar_table_html page_title_html html_break_string /;
54 my $basic_info_content;
57 my $default_message = '<i><font color="gray">data not available</font></i>';
59 ## If there aren't any experiment_row that comes from experimental_design_detail.mas, it will return a message.
61 if (defined $experiment->get_experiment_id()) {
63 ## Get the schema object
64 my $schema = $experiment->get_schema();
66 my $experiment_name = $experiment->get_experiment_name();
67 $exp_accession = $experiment_name;
69 my $replicates_nr = $experiment->get_replicates_nr();
70 my $colour_nr = $experiment->get_colour_nr();
71 my $description = $experiment->get_description();
73 ## Get the data for experimental design and targets
75 my $expdesign = $experiment->get_experimental_design();
76 my $expdesign_id = $expdesign->get_experimental_design_id();
77 my $expdesign_name = $expdesign->get_experimental_design_name();
78 my $expdesign_link = '/gem/experimental_design.pl?id='.$expdesign_id;
79 my $expdesign_html = "<a href=$expdesign_link>$expdesign_name</a>";
81 ## Get the external links
83 my @exp_dbxref_list_id = $experiment->get_dbxref_list();
84 my @exp_dbxref_html_list = ();
86 foreach my $exp_dbxref_id (@exp_dbxref_list_id) {
87 my ($exp_dbxref_row) = $schema->resultset('General::Dbxref')
88 ->search({ dbxref_id => $exp_dbxref_id });
90 if (defined $exp_dbxref_row) {
91 my ($exp_db_row) = $schema->resultset('General::Db')
92 ->search({ db_id => $exp_dbxref_row->get_column('db_id') });
94 my $exp_dbxref_link = $exp_db_row->get_column('urlprefix') .
95 $exp_db_row->get_column('url') .
96 $exp_dbxref_row->get_column('accession');
98 my $exp_dbxref_html = $exp_db_row->get_column('name') .
99 ": <a href=$exp_dbxref_link>" .
100 $exp_dbxref_row->get_column('accession')."</a>";
102 push @exp_dbxref_html_list, $exp_dbxref_html;
106 my $exp_dbxref_html_list = join('<br>', @exp_dbxref_html_list) || $default_message;
108 ## Get the sample_element_dbxref (GO and PO terms)
109 ## It remove the redundancy using a hash
112 my %external_links_html;
114 my @target_html_list;
115 my @target_list = $experiment->get_target_list();
116 foreach my $target (@target_list) {
117 my $target_id = $target->get_target_id();
118 my $target_name = $target->get_target_name();
119 my $target_link = '/gem/target.pl?id='.$target_id;
120 my $target_html = "<a href=$target_link>$target_name</a>";
121 push @target_html_list, $target_html;
123 ## It will take the ontology list too
125 my %target_elements = $target->get_target_elements();
127 foreach my $target_el_name (sort keys %target_elements) {
128 my %target_el_data = %{ $target_elements{$target_el_name} };
129 my $sample_id = $target_el_data{'sample_id'};
130 my $sample = CXGN::Biosource::Sample->new($schema, $sample_id);
132 my %dbxref_related = $sample->get_dbxref_related();
134 foreach my $dbxref_id (keys %dbxref_related) {
136 if (defined $dbxref_related{$dbxref_id} ) {
138 my %dbxref_rel_data = %{ $dbxref_related{$dbxref_id} };
140 if (defined $dbxref_rel_data{'cvterm.name'}) {
142 my $onto_accession = $dbxref_rel_data{'db.name'} . ":" . $dbxref_rel_data{'dbxref.accession'};
143 my $onto_descr = $dbxref_rel_data{'cvterm.name'};
144 my $onto_link = '/cvterm/'.$dbxref_rel_data{'cvterm.cvterm_id'}.'/view';
145 my $onto_line = "<a href=$onto_link>$onto_accession</a> ($onto_descr)<br>";
146 unless (defined $onto_html{$onto_line}) {
147 $onto_html{$onto_line} = 1;
151 my $external_accession = $dbxref_rel_data{'db.name'} . ": " . $dbxref_rel_data{'dbxref.accession'};
152 my $external_link = $dbxref_rel_data{'db.urlprefix'} . $dbxref_rel_data{'db.url'} . $dbxref_rel_data{'dbxref.accession'};
153 my $external_line = "<a href=$external_link>$external_accession</a><br>";
154 unless (defined $external_links_html{$external_line}) {
155 $external_links_html{$external_line} = 1;
166 my $onto_list = join(' ', sort keys %onto_html) || $default_message;
168 ## It will not print the dbxref links for a sample
169 ## my $external_links_list = join(' ', keys %external_links_html) || $default_message;
171 my $target_html_list = join('<br>', @target_html_list) || $default_message;
173 ## Get information of the contact
174 my $person_id = $experiment->get_contact_id();
175 my ($complete_name, $contact_email);
176 if (defined $person_id) {
178 my $person = CXGN::People::Person->new($dbh, $person_id);
180 my $salutation = $person->get_salutation() || 'Dr.';
181 my $first_name = $person->get_first_name();
182 my $last_name = $person->get_last_name();
183 $contact_email = $person->get_contact_email || $default_message;
184 if (defined $salutation && defined $first_name && defined $last_name) {
185 $complete_name = "$salutation $first_name $last_name";
187 $complete_name = $default_message;
190 $complete_name = $default_message;
191 $contact_email = $default_message;
194 ## Create the HTML table
196 $basic_info_content = <<HTML;
199 <tr> <td width="25%"> <b>Experiment name:</b> </td> <td> $experiment_name </td></tr>
200 <tr> <td width="25%"> <b>Description:</b> </td> <td> $description </td></tr>
201 <tr> <td width="25%"> <b>Colours:</b> </td> <td> $colour_nr </td></tr>
202 <tr> <td width="25%"> <b>Replicates:</b> </td> <td> $replicates_nr </td></tr>
203 <tr> <td width="25%"> <b>Experiment external links:</b> </td> <td> $exp_dbxref_html_list </td></tr>
204 <tr> <td width="25%"> <b>Experimental design:</b> </td> <td> $expdesign_html </td></tr>
205 <tr> <td width="25%"> <b>Targets:</b> </td> <td> $target_html_list </td></tr>
206 <tr> <td width="25%"> <b>Ontologies:</b> </td> <td> $onto_list </td></tr>
207 <tr> <td width="25%"> <b>Contact info:</b> </td> <td> <b>Name:</b> $complete_name </td></tr>
208 <tr> <td width=""> </td> <td> <b>E-mail:</b> $contact_email </td></tr>
214 $basic_info_content = "<h1>No experiment data for the specified parameters.</h1>";
218 if (defined $exp_accession) {
219 $basic_info_html = "<center><big><b>Expression Experiment: $exp_accession</b></big></center><br>";
222 $basic_info_html .= info_section_html( title => "Experiment Basic Information", contents => $basic_info_content );
226 <% $basic_info_html %>
229 /util/import_javascript.mas,
230 classes => 'CXGN.Effects'