4 A tiny mini script to display a group of traits/cvterms
5 that start with a given letter
9 Isaak Y Tecle (iyt2@cornell.edu)
15 use List
::MoreUtils qw
/uniq/;
20 use CXGN
::Page
::FormattingHelpers
qw(
27 use CXGN
::DB
::Connection
;
28 use CXGN
::Chado
::Cvterm
;
29 use CXGN
::Search
::CannedForms
;
31 my $page = CXGN
::Page
->new( "SGN QTL/Traits", "Isaak" );
34 my $index = $page->get_arguments("index");
36 my $dbh = CXGN
::DB
::Connection
->new();
37 my $qtl_tools = CXGN
::Phenome
::Qtl
::Tools
->new();
38 my ( $all_traits, $all_trait_d ) = $qtl_tools->all_traits_with_qtl_data();
39 my @all_traits = @
{$all_traits};
40 @all_traits = uniq
(@all_traits);
42 sort { $a <=> $b } @all_traits;
45 foreach my $trait (@all_traits)
47 if ( $trait =~ /^$index/i )
49 push @index_traits, $trait;
58 foreach my $trait (@index_traits)
60 my $cvterm = CXGN
::Chado
::Cvterm
::get_cvterm_by_name
( $dbh, $trait );
61 my $cvterm_id = $cvterm->get_cvterm_id();
67 qq |<a href
=/chado/cvterm
.pl?cvterm_id
=$cvterm_id>$trait</a
> |
73 my $t = CXGN
::Phenome
::UserTrait
->new_with_name( $dbh, $trait );
74 my $trait_id = $t->get_user_trait_id();
78 qq |<a href
=/phenome/trait
.pl?trait_id
=$trait_id>$trait</a
> |
88 print page_title_html
('List Traits with QTLs');
90 print info_section_html
(
91 title
=> encode_entities
( qq|Traits beginning with
"$index"| ),
92 contents
=> columnar_table_html
(
93 data
=> \
@traits_list,
101 my $search = CXGN
::Search
::CannedForms
::qtl_search_form
();
103 print info_section_html
(
104 title
=> 'Search QTLs by trait names',