5 basic_unigene_build_info.mas
6 Mason code to show basic data for unigene_build web_page.
18 <& '/transcript/unigene_build/basic_unigene_build_info.mas', schema => $schema, unigene_build => $unigene_build &>
20 where: $bcs, a DBIx::Class::Schema object with the classes of Bio::Chado::Schema
21 $schema, a DBIx::Class::Schema object with the classes of SGN::Schema
22 $unigene_build, an CXGN::Transcript::UnigeneBuild object
28 This mason script coordinate different mason component to create the unigene build page.
30 Its controller is: unigene_build.pl
36 Aureliano Bombarely (ab782@cornell.edu)
55 use CXGN::Transcript::UnigeneBuild;
56 use CXGN::Chado::Dbxref;
57 use CXGN::Page::FormattingHelpers qw/ info_section_html info_table_html columnar_table_html page_title_html html_break_string /;
59 my $basic_info_content;
60 my $unigene_build_name;
62 ## If there aren't any unigene_build that comes from unigene_build_detail.mas, it will return a error message.
64 if (defined $ARGS{'unigene_build'}->get_unigene_build_id) {
67 my $id = $unigene_build->get_unigene_build_id();
69 my $build_name = $unigene_build->get_organism_group_name();
70 my $build_nr = $unigene_build->get_build_nr();
71 $unigene_build_name = $build_name." ".$build_nr;
72 my $build_date = $unigene_build->get_build_date();
73 my $status = $unigene_build->get_status();
76 $status_html = '<font color="green"><b>CURRENT</b></font>';
77 } elsif ($status eq 'P') {
78 $status_html = '<font color="orange"><i>Previous to current</i></font>';
79 } elsif ($status eq 'D') {
80 $status_html = '<font color="red"><i>Deprecated</i></font>';
83 my @organism_html_list;
84 my $organism_group_id = $unigene_build->get_organism_group_id();
85 my $group_linkage_rs = $schema->resultset('GroupLinkage')
86 ->search({ group_id => $organism_group_id });
88 my @organism_ids = $group_linkage_rs->get_column('member_id')->all();
90 foreach my $organism_id (@organism_ids) {
92 if ($organism_id =~ m/^\d+$/) {
93 my @organism_rows = $bcs->resultset('Organism::Organism')
94 ->search({ sgn_organism_id => $organism_id });
96 foreach my $organism_row (@organism_rows) {
98 my $org_id = $organism_row->get_column('organism_id');
99 my $organism_name = $organism_row->get_column('species');
100 my $organism_link = '/chado/organism.pl?organism_id='.$organism_id;
101 my $organism_html = "<a href=$organism_link>$organism_name</a>";
102 if (defined $org_id) {
103 push @organism_html_list, $organism_html;
108 my $organism_html_list = join('<br>', @organism_html_list);
110 ## Get the number of unigene, contig and singlets using DBIx::Class (this should be replaced by the right object)
112 my $unigene_nr = $schema->resultset('Unigene')
113 ->search({ unigene_build_id => $id})
116 my $contig_nr = $schema->resultset('Unigene')
117 ->search({ unigene_build_id => $id, nr_members => {'>', 1} })
120 my $singlet_nr = $schema->resultset('Unigene')
121 ->search({ unigene_build_id => $id, nr_members => {'=', 1} })
124 my $member_nr = $schema->resultset('Unigene')
125 ->search({ unigene_build_id => $id }, {join => 'unigene_members'})
128 ## Create the HTML table
130 $basic_info_content = <<HTML;
133 <tr> <td> <b>Unigene Build ID: </b> </td> <td> $id </td></tr>
134 <tr> <td> <b>Unigene Build Name: </b> </td> <td> $unigene_build_name </td></tr>
135 <tr> <td> <b>Date: </b> </td> <td> $build_date </td></tr>
136 <tr> <td> <b>Status: </b> </td> <td> $status_html </td></tr>
137 <tr> <td> <b>Organism: </b> </td> <td> $organism_html_list </td></tr>
138 <tr> <td> <b>Number of Unigenes: </b> </td> <td> $unigene_nr </td></tr>
139 <tr> <td> <b>Number of Contigs: </b> </td> <td> $contig_nr </td></tr>
140 <tr> <td> <b>Number of Singlets: </b> </td> <td> $singlet_nr </td></tr>
141 <tr> <td> <b>Members Assembled:</b> </td> <td> $member_nr </td></tr>
150 $basic_info_content = "<big>There aren't any unigene build data for the specified parameters.</big>";
154 if (defined $unigene_build_name) {
155 $basic_info_html = "<center><big><b>Unigene Build: $unigene_build_name</b></big></center><br>";
157 $basic_info_html .= info_section_html( title => "Unigene Build Basic Information", contents => $basic_info_content );
161 <% $basic_info_html %>