Merge pull request #5123 from solgenomics/topic/wishlist
[sgn.git] / mason / transcript / unigene / gene_family_info.mas
blobe8235ce0b2981982337528b12e5d0c9cc3b51e6f
1 <%doc>
3 =head1 NAME 
4  
5  gene_family.mas
6  Mason component to show gene family data associated to an unigene
8 =cut
10 =head1 VERSION 
12 0.1
14 =cut 
16 =head1 SYNOPSIS 
18 <& '/transcript/unigene/gene_family_info.mas', unigene => $unigene &>
20  where $unigene is CXGN::Transcript::Unigene object 
22 =cut 
24 =head1 DESCRIPTION
26  Another piece of mason code get the unigene data (gene family info) from the database and show it 
27  as table web_page; 
28  This code was taken from unigene.pl (originally added by Chenwei, 08/2005, slightly refactored, Lukas 9/2007)
30 =cut
32 =head 1 AUTHOR
34  Aureliano Bombarely (ab782@cornell.edu)
36 =cut  
38 </%doc>
41 <%args>
42 $unigene
43 </%args>
46 <%perl>
48 use strict;
49 use warnings;
51 use CXGN::Page::FormattingHelpers  qw/ info_section_html info_table_html columnar_table_html page_title_html html_break_string /;
53 my ($library_content, $library_html, @library_table);
56 ## Get the object
57 my $id =  $unigene->get_unigene_id();
59 ## If there aren't any unigene that comes from unigene_detail.mas, it will not do anything because the error message is given for the
60 ## basic_detail.mas script
62 my $gene_family_html_content;
64 if (defined $id) {
66     my @families = $unigene->get_families();
68     my $gene_family_content;
69     my @family_info;
70     if (scalar(@families) > 0) {
71         for my $family (@families) {
72             my ($fam_id, $ivalue, $annotation, $count) = @{$family};
73         if ($annotation) {
74             $annotation =~ s/;/<br>/g;
75             $annotation =~ s/,/<br>/g;
76             $annotation =~ s/Molecular Function/ - Molecular Function/g;
77             $annotation =~ s/Cellular Component/ - Cellular Component/g;
78             $annotation =~ s/Biological Process/ - Biological Process/g;
79         }
80             my $family_link = '<a href="family.pl?family_id='.$fam_id.'">'.$fam_id."</a>";
81             push @family_info, [$ivalue, $family_link, $annotation, $count];
82         }
83         $gene_family_content = columnar_table_html( headings => ['Family Build <br>(I value*)','Family ID', 'Annotation**','# Members'],
84                                                     data     => \@family_info,
85                                                     __align => ['c', 'c', 'l', 'c'],
86                                                    );
88         $gene_family_content .= '<br> *i value: controls inflation, a process to dissipate family clusters. ';
89         $gene_family_content .= 'At high i value, genes tend to be separated into different families.<br>';
90         $gene_family_content .= '**Annotation: the most common InterPro annotation(s) of the Arabidopsis members in the family.<br>';
92     }
94     my $gf_count = scalar(@families);
95     $gene_family_html_content = info_section_html( title        => "Gene Family (" . $gf_count . ")", 
96                                                    contents     => $gene_family_content,
97                                                    collapsible  => 1,
98                                                    collapsed    => 1, );
102 </%perl>
104 <% $gene_family_html_content %>