1 ######################################################################
3 # Displays a static user submitted trait detail page.
5 ######################################################################
7 my $trait_detail_page=CXGN
::Phenome
::TraitDetailPage
->new();
9 package CXGN
::Phenome
::TraitDetailPage
;
11 use base qw
/CXGN::Page::Form::SimpleFormPage/;
16 use CXGN
::Page
::FormattingHelpers qw
/info_section_html
23 use CXGN
::Phenome
::UserTrait
;
24 use CXGN
::People
::PageComment
;
30 my $self= $class->SUPER::new
(@_);
36 $self->set_dbh(CXGN
::DB
::Connection
->new('phenome'));
37 my %args= $self->get_args();
40 if (exists($args{trait
}) && defined($args{trait
})) {
41 my $ut = CXGN
::Phenome
::UserTrait
::->new_with_name($self->get_dbh(), $args{trait
});
42 $user_trait_id = $ut->get_user_trait_id();
45 $user_trait_id= $args{trait_id
};
47 unless (!$user_trait_id || $user_trait_id =~m
/^\d+$/) { $self->get_page->message_page("No term exists for identifier $user_trait_id"); }
48 $self->set_object_id($user_trait_id);
49 $self->set_object(CXGN
::Phenome
::UserTrait
->new($self->get_dbh, $self->get_object_id));
51 $self->set_primary_key("user_trait_id");
59 my %args = $self->get_args();
62 my $ut=$self->get_object();
63 my $ut_id=$self->get_object_id();
64 my $ut_name=$ut->get_name();
66 my $definition = $ut->get_definition() ;
67 my $page="/phenome/trait.pl?trait_id=$ut_id";
68 my $action= $args{action
} || "";
69 if (!$ut_id) { $self->get_page->message_page("No term exists for this identifier") } ;
71 $self->get_page->header("SGN: $ut_name " );
72 print page_title_html
("$ut_name\n");
74 my $trait_html= "<br />" .$self->get_form()->as_table_string()."<br />";
78 print info_section_html
(title
=> 'Trait details',
79 contents
=> $trait_html,
82 my @pops = $ut->get_all_populations_trait();
85 foreach my $pop (@pops) {
86 my $pop_id = $pop->get_population_id();
87 my $pop_name = $pop->get_name();
89 $pop_list .= qq |<a href
="../phenome/population_indls.pl?population_id=$pop_id&cvterm_id=$ut_id">$pop_name</a> <br />|;
92 my $pop_count = scalar(@pops);
94 $pop_count .= " " . 'populations';
97 print info_section_html
(title
=> "Phenotype data/QTLs ($pop_count)",
98 contents
=> $pop_list,
104 ####add page comments
106 my $page_comment_obj = CXGN
::People
::PageComment
->new($self->get_dbh(), "trait", $ut_id, $self->get_page()->{request
}->uri()."?".$self->get_page()->{request
}->args());
107 print $page_comment_obj->get_html();
111 $self->get_page()->footer();
118 my $ut=$self->get_object();
120 my %args=$self->get_args();
122 my $ut_name=$ut->get_name();
124 my $definition = $ut->get_definition() ;
126 $self->get_form()->add_label(
127 display_name
=>"Term name",
128 field_name
=>"term_name",
129 contents
=> $ut_name,
131 $self->get_form()->add_label(
132 display_name
=>"Definition",
133 field_name
=>"definition",
134 contents
=> $definition,
138 if ($self->get_action=~ /view/) {
140 $self->get_form->from_database();
145 #########################################################