5 generates a page with the list of individual
6 plant accessions (and their corresponding trait values)
7 falling within a phenotypic range in a population.
11 Isaak Y Tecle (iyt2@cornell.edu)
20 my $individuals_range_detail_page = CXGN
::Phenome
::IndividualsRangeDetailPage
->new();
22 package CXGN
::Phenome
::IndividualsRangeDetailPage
;
26 use CXGN
::Page
::FormattingHelpers qw
/info_section_html
35 use CXGN
::Phenome
::Population
;
36 use CXGN
::Phenome
::PopulationDbxref
;
37 use CXGN
::Tools
::WebImageCache
;
38 use CXGN
::People
::PageComment
;
39 use CXGN
::People
::Person
;
40 use CXGN
::Chado
::Publication
;
41 use CXGN
::Chado
::Pubauthor
;
45 BEGIN { local $SIG{__WARN__
} = sub {}; require GD
::Graph
::Map
}
46 use Statistics
::Descriptive
;
47 use CXGN
::Scrap
::AjaxPage
;
52 use base qw
/ CXGN::Page::Form::SimpleFormPage CXGN::Phenome::Main/;
56 my $self = $class->SUPER::new
(@_);
57 $self->set_script_name("indls_range_cvterm.pl");
66 $self->set_dbh(CXGN
::DB
::Connection
->new('phenome'));
67 my %args = $self->get_args();
68 my $population_id= $args{population_id
};
69 unless (!$population_id || $population_id =~m
/^\d+$/) { $self->get_page->message_page("No population exists for identifier $population_id"); }
70 $self->set_object_id($population_id);
71 $self->set_object(CXGN
::Phenome
::Population
->new($self->get_dbh(),$self->get_object_id()));
72 $self->set_primary_key("population_id");
73 $self->set_owners($self->get_object()->get_owners());
84 my %args = $self->get_args();
86 my $population = $self->get_object();
87 my $population_id = $self->get_object_id();
88 my $type_id = $args{type_id
};
90 my $pop_name = $population->get_name();
91 my $pop_link = qq |<a href
="/phenome/population.pl?population_id=$population_id">$pop_name</a
> |;
93 my $sp_person_id= $population->get_sp_person_id();
94 my $submitter = CXGN
::People
::Person
->new($self->get_dbh(), $population->get_sp_person_id());
95 my $submitter_name = $submitter->get_first_name()." ".$submitter->get_last_name();
96 my $submitter_link = qq |<a href
="/solpeople/personal-info.pl?sp_person_id=$sp_person_id">$submitter_name </a
> |;
99 my $login_user= $self->get_user();
100 my $login_user_id= $login_user->get_sp_person_id();
102 if ($self->get_action()=~/edit|store/ && ($login_user_id = $submitter || $self->get_user()->get_user_type() eq 'curator') ) {
103 $form = CXGN
::Page
::Form
::Editable
->new();
106 $form = CXGN
::Page
::Form
::Static
->new();
110 display_name
=>"Name:",
112 contents
=> $pop_link,
116 display_name
=>"Description: ",
117 field_name
=>"description",
119 getter
=>"get_description", setter
=>"set_description",
125 $form->add_label( display_name
=>"Uploaded by: ",
126 field_name
=>"submitter",
127 contents
=>$submitter_link,
129 $form->add_hidden( field_name
=>"population_id", contents
=>$args{population_id
});
132 field_name
=> "sp_person_id",
133 contents
=>$self->get_user()->get_sp_person_id(),
134 object
=> $population,
135 setter
=>"set_sp_person_id",
138 $form->add_hidden( field_name
=>"action", contents
=>"store" );
144 $self->set_form($form);
146 if ($self->get_action=~ /view|edit/) {
147 $self->get_form->from_database();
150 }elsif ($self->get_action=~ /store/) {
151 $self->get_form->from_request($self->get_args());
162 $self->get_page->add_style( text
=> <<EOS);
163 a.abstract_optional_show {
168 div.abstract_optional_show {
170 border: 1px solid #9F9FC7;
171 margin: 0.2em 1em 0.2em 1em;
172 padding: 0.2em 0.5em 0.2em 1em;
178 my %args = $self->get_args();
179 my $population = $self->get_object();
180 my $population_id = $self->get_object_id();
181 my $population_name = $population->get_name();
182 my $login_user= $self->get_user();
183 my $login_user_id= $login_user->get_sp_person_id();
184 my $login_user_type= $login_user->get_user_type();
187 $self->get_page()->header("SGN Population name: $population_name");
189 print page_title_html
("SGN population: $population_name \n");
191 my $population_html .= $self->get_form()->as_table_string();
198 my $cvterm_id = $args{cvterm_id
};
199 my $lower = $args{lower
};
200 my $upper = $args{upper
};
202 my ($indl_id, $indl_name, $value)= $population->indls_range_cvterm($cvterm_id, $lower, $upper);
203 my @indls_id = @
$indl_id;
204 my $indls_count = scalar @indls_id;
207 my $cvterm = CXGN
::Chado
::Cvterm
->new($self->get_dbh(), $args{cvterm_id
});
208 my $cvterm_name = $cvterm->get_cvterm_name();
209 $cvterm_id = $args{cvterm_id
};
210 my ($min, $max, $avg, $count)= $population->get_pop_data_summary($cvterm_id);
212 for (my $i=0; $i<@
$indl_name; $i++) {
214 push @phenotype, [map {$_} ( qq | <a href
="/phenome/individual.pl?individual_id=$indl_id->[$i]">$indl_name->[$i]</a
>|, $value->[$i]) ];
218 my ($phenotype_data, $data_view, $data_download);
220 my $cvterm_note = " <br><b>$indls_count plant accessions had
221 $cvterm_name values >$lower but <= $upper.
222 The population average, minimum, and maximum
223 values for the trait were $avg, $min, and $max,
224 respectively.</b> <br />";
227 $phenotype_data = columnar_table_html
(headings
=> [
239 $data_view = html_optional_show
("phenotype",
240 'View/hide phenotype data summary',
241 qq|<b
>$phenotype_data</b
>|,
242 1, #< show data by default
244 $data_download .= qq { <span
><a href
="/qtl/download/phenotype/$population_id"><b
>\
[download population raw data\
]</b></a></span
> };
247 my $page="../phenome/indls_range_cvterm.pl?cvterm_id=$cvterm_id&lower=$lower&upper=$upper&population_id=$population_id ";
248 $args{calling_page
} = $page;
252 my $url_pubmed = qq | http
://www
.ncbi
.nlm
.nih
.gov
/pubmed/|;
254 my @publications = $population->get_population_publications();
256 my $abstract_count = 0;
260 foreach my $pub (@publications) {
261 my ($title, $abstract, $authors, $journal, $pyear, $volume, $issue, $pages, $obsolete, $pub_id, $accession);
264 my @dbxref_objs = $pub->get_dbxrefs();
265 my $dbxref_obj = shift(@dbxref_objs);
267 $obsolete = $population->get_population_dbxref($dbxref_obj)->get_obsolete();
269 if ($obsolete eq 'f') {
270 $pub_id = $pub->get_pub_id();
271 $accession = $pub->get_accession();
272 $title = $pub->get_title();
273 $abstract = $pub->get_abstract();
274 $pyear = $pub->get_pyear();
275 $volume = $pub->get_volume();
276 $journal = $pub->get_series_name();
277 $pages = $pub->get_pages();
278 $issue = $pub->get_issue();
279 $accession = $dbxref_obj->get_accession();
280 my $pub_info = qq|<a href
="/publication/$pub_id/view" >PMID
:$accession</a
> |;
285 my @pubauthors_ids = $pub->get_pubauthors_ids($pub_id);
287 foreach my $pubauthor_id (@pubauthors_ids) {
288 my $pubauthor_obj = CXGN
::Chado
::Pubauthor
->new($self->get_dbh, $pubauthor_id);
289 my $last_name = $pubauthor_obj->get_surname();
290 my $first_names = $pubauthor_obj->get_givennames();
291 my @first_names = split (/,/, $first_names);
292 $first_names = shift (@first_names);
293 push @authors, ("$first_names" ." ". "$last_name");
294 $authors = join (", ", @authors);
301 $abstract_view = html_optional_show
("abstracts$abstract_count",
302 'Show/hide abstract',
303 qq|$abstract <b
> <i
>$authors.</i> $journal. $pyear. $volume($issue). $pages.</b
>|,
304 0, #< do not show by default
305 'abstract_optional_show', #< don't use the default button-like style
309 $pubmed .= qq|<div
><a href
="$url_pubmed$accession" target
="blank">$pub_info</a> $title $abstract_view </div
> |;
313 print info_section_html
(title
=> 'Population details',
314 contents
=> $population_html,
317 print info_section_html
(title
=> 'Phenotype Data',
318 contents
=>$cvterm_note . $data_view ." ".$data_download,
323 print info_section_html
(title
=> 'Literature annotation',
324 #subtitle => $pub_subtitle,
329 if ($population_name) {
330 my $page_comment_obj = CXGN
::People
::PageComment
->new($self->get_dbh(), "population", $population_id, $self->get_page()->{request
}->uri()."?".$self->get_page()->{request
}->args());
331 print $page_comment_obj->get_html();
336 $self->get_page()->footer();