5 basic_template_info.mas
6 Mason component to show the basic information for template web page.
18 Mason component to show the basic information for template web page.
20 - Mason root page = template_detail.mas
21 - Perl controller = template.pl
27 Aureliano Bombarely (ab782@cornell.edu)
44 use CXGN::GEM::Schema;
45 use CXGN::Chado::Dbxref;
46 use CXGN::Page::FormattingHelpers qw/ info_section_html info_table_html columnar_table_html page_title_html html_break_string /;
48 my $basic_info_content;
49 my $element_info_content;
50 my $template_accession;
52 my $default_message = '<span class="ghosted">data not available</span>';
54 ## If there aren't any template that comes from template_detail.mas, it will return a message.
56 if (defined $template->get_template_id() ) {
58 ## Get the template object
60 my $template_name = $template->get_template_name();
61 $template_accession = $template_name;
63 my $template_type = $template->get_template_type();
65 ## Get the schema object
67 my $schema = $template->get_schema();
69 ## Get the platform link:
71 my $platform = $template->get_platform();
73 my $platform_id = $platform->get_platform_id();
74 my $platform_name = $platform->get_platform_name();
75 my $platform_link = '/gem/platform.pl?id='.$platform_id;
76 my $platform_html = "<a href=$platform_link>$platform_name</a><br>";
80 my @dbirefs = $template->get_dbiref_obj_list();
81 my @dbiref_html_list = ();
83 foreach my $dbiref (@dbirefs) {
84 my $accession = $dbiref->get_accession();
85 my @dbipath = $dbiref->get_dbipath_obj()
88 my $dbipath = join('.', @dbipath);
90 ## Define dbiref_html as accession and change depending of the dbiref type
92 my $dbiref_html = $accession;
94 if ($dbipath eq 'sgn.unigene.unigene_id') {
95 unless ($accession =~ m/SGN-U/) {
96 $dbiref_html = '<a href=/search/unigene.pl?unigene_id=SGN-U' . $accession . '>SGN-U' . $accession . '</a>';
99 $dbiref_html = '<a href=/search/unigene.pl?unigene_id=' . $accession . '>' . $accession . '</a>';
102 elsif ($dbipath eq 'sgn.est.est_id') {
103 unless ($accession =~ m/SGN-E/) {
104 $dbiref_html = '<a href=/search/est.pl?est_id=SGN-E' . $accession . '>SGN-E' . $accession . '</a>';
107 $dbiref_html = '<a href=/search/est.pl?est_id=SGN-U' . $accession . '>SGN-E' . $accession . '</a>';
110 push @dbiref_html_list, $dbiref_html;
112 my $dbiref_html_list = join('<br>', @dbiref_html_list) || $default_message;
115 ## Get the external links
117 my @dbxref_list_id = $template->get_dbxref_list();
118 my @dbxref_html_list = ();
120 foreach my $dbxref_id (@dbxref_list_id) {
121 my ($dbxref_row) = $schema->resultset('General::Dbxref')
122 ->search({ dbxref_id => $dbxref_id });
124 if (defined $dbxref_row) {
125 my ($db_row) = $schema->resultset('General::Db')
126 ->search({ db_id => $dbxref_row->get_column('db_id') });
128 my $db_name = $db_row->get_column('name');
130 ## Filter the db names
131 if ($db_name =~ m/DB:GenBank_Accession/i ) {
132 $db_name = 'GenBank';
135 my $dbxref_link = $db_row->get_column('urlprefix') . $db_row->get_column('url') . $dbxref_row->get_column('accession');
136 my $dbxref_html = $db_name . ": <a href=$dbxref_link>".$dbxref_row->get_column('accession')."</a>";
137 push @dbxref_html_list, $dbxref_html;
141 my $dbxref_html_list = join('<br>', @dbxref_html_list) || $default_message;
143 ## Create the HTML table
145 $basic_info_content = <<HTML;
148 <tr> <td width="25%"> <b>Template name:</b> </td> <td> $template_name </td></tr>
149 <tr> <td width="25%"> <b>Template type:</b> </td> <td> $template_type </td></tr>
150 <tr> <td width="25%"> <b>Platform:</b> </td> <td> $platform_html</td></tr>
151 <tr> <td width="25%"> <b>Internal db links:</b> </td> <td> $dbiref_html_list</td></tr>
152 <tr> <td width="25%"> <b>External db links:</b> </td> <td> $dbxref_html_list</td></tr>
161 $basic_info_content = "<big>There aren't any template data for the specified parameters.</big>";
165 if (defined $template_accession) {
166 $basic_info_html = "<center><big><b>Expression Template: $template_accession</b></big></center><br>";
168 $basic_info_html .= info_section_html( title => "Template Basic Information", contents => $basic_info_content );
173 <% $basic_info_html %>
176 /util/import_javascript.mas,
177 classes => 'CXGN.Effects'