8 use CXGN
::Page
::WebForm
;
10 use CXGN
::Phenome
::Locus
;
11 use CXGN
::Page
::FormattingHelpers qw
/info_section_html
18 #use base qw /CXGN::Page::WebForm/;
19 my $dbh= CXGN
::DB
::Connection
->new('phenome');
20 my $logged_sp_person_id = CXGN
::Login
->new($dbh)->verify_session();
22 my $page = CXGN
::Page
->new("Recently annotated loci","Naama");
23 #$page->jsan_use("Dynarch.Calendar");
24 $page->jsan_use("CXGN.Calendar");
27 #$page->jsan_use("CXGN.Calendar", "CXGN.Phenome.Locus");
30 my $form = CXGN
::Page
::WebForm
->new();
32 $form->set_data(date
=>'');
33 $form->template(<<HTML);
34 <input type="text" name="date" id="cal_target" />
35 <input type="submit" id="submit_button" value="Submit" />
38 print '<form action="" method="get">',
39 '<h3 align="center">Find recently annotated loci</h3>',
43 '</form>'; #now print the auto-filled-in form
44 my $cal=get_calendar
();
47 ######Javascript calendar: this stuff is not working. I guess the Calendar object is not called correctly.#####
50 <script language="javascript" type="text/javascript" >
54 c.showFlatCalendar('');
55 c.showCalendar('cal_target', '%m/%d/%Y', '24', '1');
62 my %params= $page->cgi_params();
63 $form->from_request( \
%params );
65 my $date = $params{date
};
68 if ($date) { print_results
($dbh, $date) } ;
76 <a href
="javascript:Calendar.showCalendar('cal_id')">[Calendar
]</a
><br
>
78 <div id
='popUpCal' style
="display: none">
92 my %locus_edits = CXGN
::Phenome
::Locus
::get_recent_annotated_loci
($dbh, $date);
95 #locus updates and creates section
99 foreach my $locus(@
{$locus_edits{loci
} }) {
100 my $locus_id = $locus->get_locus_id();
101 my $locus_name=$locus->get_common_name() . " " . $locus->get_locus_name();
102 my $updated_by= $locus->get_updated_by() || ($locus->get_owners())[0];
103 my $person= get_person_info
($dbh, $updated_by);
104 my $udate = $locus->get_modification_date();
106 if (!$udate ) { #&& $locus->get_create_date() > $date) {
108 $udate = $locus->get_create_date() ;
110 if ($locus->get_obsolete() eq 't') { $action= 'Obsoleted'; }
111 push @locus_updates, [map {$_} (qq|<a href
="locus_display.pl?locus_id=$locus_id">$locus_name</a
>|, $person,$udate, $action)];
113 my $updated_loci= columnar_table_html
(headings
=> ['Locus name',
117 data
=>\
@locus_updates, __align
=>'llc') if @locus_updates;
120 print info_section_html
(title
=> "Updated loci (" . scalar(@locus_updates) . ")",
121 contents
=>$updated_loci,
131 foreach my $alias(@
{$locus_edits{aliases
} } ) {
132 my $locus_id=$alias->get_locus_id();
133 my $locus_name=$alias->get_common_name() ." " . $alias->get_locus_name();
134 my $alias_name= $alias->get_locus_alias();
135 my $alias_person_id= $alias->get_sp_person_id();
136 my $udate= $alias->get_modification_date() || $alias->get_create_date();
137 my $alias_obsoleted = $alias->get_obsolete();
139 my $person= get_person_info
($dbh, $alias_person_id);
140 if ($alias_obsoleted eq 't' ) { $action= 'Obsoleted'; }
141 push @alias_updates, [map {$_} (qq|<a href
="locus_display.pl?locus_id=$locus_id">$locus_name</a
>|, $alias_name, $person, $udate, $action)];
145 if (@alias_updates) { $aliases= columnar_table_html
(headings
=> ['Locus name',
150 data
=>\
@alias_updates, __align
=>'llc'); }
152 print info_section_html
(title
=> "Locus synonyms (" . scalar(@alias_updates) . ")",
153 contents
=> $aliases ,
163 foreach my $allele(@
{$locus_edits{alleles
} } ) {
164 my $allele_id=$allele->get_allele_id();
165 my $locus_name=$allele->get_locus()->get_common_name() ." " . $allele->get_locus_name();
166 my $allele_name= $allele->get_allele_name();
167 my $allele_symbol=$allele->get_allele_symbol();
168 my $allele_owner= $allele->get_sp_person_id();
169 my $udate= $allele->get_modification_date() ;
170 my $allele_obsoleted = $allele->get_obsolete();
173 $udate=$allele->get_create_date();
176 my $person= get_person_info
($dbh, $allele_owner);
177 if ($allele_obsoleted eq 't' ) { $action= 'Obsoleted'; }
178 push @allele_updates, [map {$_} ($locus_name, qq|<a href
="allele.pl?allele_id=$allele_id">$allele_symbol</a
>|, $person, $udate, $action)];
182 if (@allele_updates) {
183 $alleles= columnar_table_html
(headings
=> ['Locus name',
188 data
=>\
@allele_updates, __align
=>'llc');}
191 print info_section_html
(title
=> "Alleles (" . scalar(@allele_updates) . ")",
192 contents
=> $alleles ,
202 foreach my $ld(@
{$locus_edits{locus_dbxrefs
} } ) {
203 my $locus_id=$ld->get_locus_id();
204 my $locus=CXGN
::Phenome
::Locus
->new($dbh, $locus_id);
205 my $dbxref=CXGN
::Chado
::Dbxref
->new($dbh, $ld->get_dbxref_id());
206 my $annotation= get_annotation
($dbxref);
207 my $locus_symbol=$locus->get_common_name() ." " . $locus->get_locus_symbol();
208 my $ld_owner= $ld->get_sp_person_id();
209 my $udate= $ld->get_modification_date() ;
210 my $ld_obsoleted = $ld->get_obsolete();
213 $udate=$ld->get_create_date();
216 my $person= get_person_info
($dbh, $ld_owner);
217 if ($ld_obsoleted eq 't' ) { $action= 'Obsoleted'; }
218 push @ld_updates, [map {$_} (qq|<a href
="locus_display.pl?locus_id=$locus_id">$locus_symbol</a
>|, $annotation, $person, $udate, $action)];
223 $lds= columnar_table_html
(headings
=> ['Locus',
228 data
=>\
@ld_updates, __align
=>'llc');}
231 print info_section_html
(title
=> "Locus Annotations (" . scalar(@ld_updates) . ")",
244 foreach my $list(@
{$locus_edits{locus_images
} } ) {
245 #[$locus, $image, $person_id, $cdate, $mdate, $obsolete];
246 my $locus=$list->[0];
247 my $image_id=$list->[1];
248 # my $image_id=$image->get_image_id();
249 # my $image_name= $image->get_name() || "image: $image_id";
250 my $locus_id=$locus->get_locus_id();
251 my $locus_symbol=$locus->get_common_name() ." " . $locus->get_locus_symbol();
252 my $owner= $list->[2];
253 my $person= get_person_info
($dbh, $owner);
255 my $udate= $list->[4];
261 my $obsoleted = $list->[5];
262 if ($obsoleted eq 't' ) { $action= 'Obsoleted'; }
263 push @locus_images, [map {$_} (qq|<a href
="locus_display.pl?locus_id=$locus_id">$locus_symbol</a>|, qq|<a href="/image
/index.pl?image_id=$image_id">image: $image_id</a>|, $person, $udate, $action)];
268 $lis= columnar_table_html
(headings
=> ['Locus',
273 data
=>\
@locus_images, __align
=>'llc');}
276 print info_section_html
(title
=> "Locus images (" . scalar(@locus_images) . ")",
288 foreach my $list(@
{$locus_edits{individuals
} } ) {
290 my $allele=$list->[1];
291 my $ind_id=$ind->get_individual_id();
292 my $ind_name= $ind->get_name() ;
293 my $locus_name=$allele->get_locus()->get_common_name() ." " . $allele->get_locus_name();
294 my $locus_id=$allele->get_locus_id();
295 my $owner= $list->[2];
296 my $person= get_person_info
($dbh, $owner);
298 my $udate= $list->[4];
304 my $obsoleted = $list->[5];
305 if ($obsoleted eq 't' ) { $action= 'Obsoleted'; }
306 push @individuals, [map {$_} (qq|<a href
="locus_display.pl?locus_id=$locus_id">$locus_name</a>|, qq|<a href="individual.pl?individual_id=$ind_id">$ind_name</a>|, $person, $udate, $action)];
311 $ias= columnar_table_html
(headings
=> ['Locus',
316 data
=>\
@individuals, __align
=>'llc');}
319 print info_section_html
(title
=> "Locus accessions (" . scalar(@individuals) . ")",
331 foreach my $list(@
{$locus_edits{locus_unigenes
} } ) {
332 my $unigene=$list->[0];
333 my $locus=$list->[1];
334 my $unigene_id='SGN-U' . $unigene->get_unigene_id();
335 my $locus_name=$locus->get_common_name() ." " . $locus->get_locus_name();
336 my $locus_id=$locus->get_locus_id();
337 my $owner= $list->[2];
338 my $person= get_person_info
($dbh, $owner);
340 my $udate= $list->[4];
346 my $obsoleted = $list->[5];
347 if ($obsoleted eq 't' ) { $action= 'Obsoleted'; }
348 push @locus_unigenes, [map {$_} (qq|<a href
="locus_display.pl?locus_id=$locus_id">$locus_name</a>|, qq|<a href="/search
/unigene.pl?unigene_id=$unigene_id">$unigene_id</a>|, $person, $udate, $action)];
352 if (@locus_unigenes) {
353 $uls= columnar_table_html
(headings
=> ['Locus',
358 data
=>\
@locus_unigenes, __align
=>'llc');}
361 print info_section_html
(title
=> "Locus-unigenes (" . scalar(@locus_unigenes) . ")",
374 foreach my $lm(@
{$locus_edits{locus_markers
} } ) {
375 my $locus_id=$lm->get_locus_id();
376 my $locus=CXGN
::Phenome
::Locus
->new($dbh, $locus_id);
377 my $marker_id= $lm->get_marker_id();
378 my $marker=CXGN
::Marker
->new($dbh, $lm->get_marker_id());
379 my $marker_name=$marker->name_that_marker();
380 my $locus_symbol=$locus->get_common_name() ." " . $locus->get_locus_symbol();
381 my $lm_owner= $lm->get_sp_person_id();
382 my $udate= $lm->get_modification_date() ;
383 my $lm_obsoleted = $lm->get_obsolete();
386 $udate=$lm->get_create_date();
389 my $person= get_person_info
($dbh, $lm_owner);
390 if ($lm_obsoleted eq 't' ) { $action= 'Obsoleted'; }
391 push @lm_updates, [map {$_} (qq|<a href
="locus_display.pl?locus_id=$locus_id">$locus_symbol</a>|, qq|<a href="/markers
/marker_info.pl?marker_id=$marker_id">$marker_name</a>|, $person, $udate, $action)];
396 $lms= columnar_table_html
(headings
=> ['Locus',
401 data
=>\
@lm_updates, __align
=>'llc');}
404 print info_section_html
(title
=> "Locus markers (" . scalar(@lm_updates) . ")",
414 sub get_person_info
{
416 my $sp_person_id=shift;
417 my $user = CXGN
::People
::Person
-> new
($dbh, $sp_person_id);
418 my $username=$user->get_first_name()." ".$user->get_last_name();
419 my $person= qq| <a href
="../solpeople/personal_info.pl?sp_person_id=$sp_person_id">$username</a
> | ;
425 my $acc=$dbxref->get_full_accession();
426 my $accession= $dbxref->get_accession();
427 my $db=$dbxref->get_db_name();
428 if ($db eq 'SGN_ref') {
429 $accession= $dbxref->get_publication()->get_pub_id();
431 my $url=$dbxref->get_urlprefix() . $dbxref->get_url() . $accession;
432 return qq |<a href
="$url">$acc</a
>|;