12 use CXGN::Sunshine::Browser;
13 use CXGN::Page::FormattingHelpers qw / html_optional_show info_table_html /;
18 my $user_type = $user ? $user->get_user_type : '';
19 my $person_id = $user ? $user->get_sp_person_id : 0;
21 my $this_page = "/phenome/locus_display.pl?locus_id=$locus_id";
22 my $locus_xml = $locus_id ? qq |<a href = "generic_gene_page.pl?locus_id=$locus_id">Download GMOD XML</a>|
23 : qq |<span class="ghosted">Download GMOD XML</span>|;
25 qq |<a href="/phenome/editors_note.pl">Note to Editors</a>|;
27 qq|<a href="http://docs.google.com/View?docid=ddhncntn_0cz2wj6">Annotation guidelines</a>|;
29 my $common_name = $locus->get_common_name();
30 my @owners = $locus->get_owners();
31 my $owner_objects= $locus->get_owners(1);
33 my $locus_name = $locus->get_locus_name();
35 if ( $locus_name && ( $user_type eq 'curator' || $person_id && grep { $_ == $person_id } @owners ) ) { $owner = 1; }
36 my $registry = $locus->get_associated_registry();
38 my @synonyms = $locus->get_locus_aliases('f','f');
39 my @figures = $locus->get_figure_ids();
42 !(grep { /^$user_type$/ } ('curator', 'submitter', 'sequencer') ) ?
43 "<span class= \"ghosted\">[Add notes, figures or images]</span> "
44 : " <a href=\"/image/add?type_id=$locus_id&type=locus&action=new&refering_page=$this_page\">[ Add notes, figures or images]</a>" ;
47 !(grep { /^$user_type$/ } ('curator', 'submitter', 'sequencer') ) ?
48 '<span class= "ghosted">[Associate accession]</span> '
49 : '<a href="javascript:Tools.toggleContent(\'associateIndividualForm\', \'locus_accessions\')">[Associate accession]</a> ';
51 my @accessions = $locus->get_individuals();
53 my @alleles = $locus->get_alleles(); #array of allele objects
56 !(grep { /^$user_type$/ } ('curator', 'submitter', 'sequencer') ) ?
57 '<span class="ghosted">[Add new Allele]</span>'
58 : "<a href=\"/phenome/allele.pl?locus_id=$locus_id&action=new\">[Add new allele]</a>";
62 !(grep { /^$user_type$/ } ('curator', 'submitter', 'sequencer') ) ?
63 '<span class="ghosted">[Associate new locus]</span>'
64 : '<a href="javascript:Tools.toggleContent(\'associateLocusForm\', \'locus2locus\');Tools.getOrganisms()">[Associate new locus]</a> ';
66 my $collapsed = $locus->count_associated_loci() ? 1 : 0 ;
68 my $network_sub = $collapsed ?
69 "View <b>$locus_name</b> relationships in the stand-alone <a href=\"/tools/networkbrowser/?type=locus&name=$locus_id\">network browser</a>" : '';
71 #get list of current unigenes
72 my @unigenes= $locus->get_unigenes({ current=>1});
75 my $new_unigene_link =
76 !(grep { /^$user_type$/ } ('curator', 'submitter', 'sequencer') ) ?
77 '<span class= "ghosted">[Associate new unigene]</span> '
78 : '<a href="javascript:Tools.toggleContent(\'associateUnigeneForm\', \'unigenes\' )">[Associate new unigene]</a>';
81 my %dbxrefs = $locus->get_all_dbxrefs();
84 foreach ( @{ $dbxrefs{'tgrc'} } ) {
85 if ( $_->[1] eq '0' ) {
86 my $url = $_->[0]->get_urlprefix() . $_->[0]->get_url();
87 my $accession = $_->[0]->get_accession();
89 qq|<br>$locus_name is a <a href="$url$accession" target="blank">TGRC gene</a><br />|;
93 my @sorted_pubs = defined @{ $dbxrefs{PMID} } ? sort { $a->[0]->get_accession() <=> $b->[0]->get_accession() } @{ $dbxrefs{PMID} } : () ;
95 my @sgn_ref = defined ( @{ $dbxrefs{SGN_ref} } ) ? @{ $dbxrefs{SGN_ref} } : () ;
97 @sorted_pubs = ( @sorted_pubs, @sgn_ref );
98 my $pub_count = scalar (@sorted_pubs) ;
100 my $pub_subtitle = !(grep { /^$user_type$/ } ('curator', 'submitter', 'sequencer') ) ? qq|<span class=\"ghosted\">[Associate publication]</span>|
101 : qq|<a href="/chado/add_publication.pl?type=locus&type_id=$locus_id&refering_page=$this_page&action=new"> [Associate publication] </a>|;
104 qq | <a href="javascript:void(0)"onclick="window.open('locus_pub_rank.pl?locus_id=$locus_id','publication_list','width=600,height=400,status=1,location=1,scrollbars=1')">[Matching publications]</a> |;
106 my ($genbank, $gb_count);
107 foreach my $g ( @{ $dbxrefs{'DB:GenBank_GI'} } ) {
108 if ( $g->[1] eq '0' ) {
109 my $url = $g->[0]->get_urlprefix() . $g->[0]->get_url();
111 $locus->CXGN::Chado::Feature::get_feature_name_by_gi( $g->[0]->get_accession() );
112 my $description = $g->[0]->get_description();
114 qq|<a href="$url$gb_accession" target="blank">$gb_accession</a> $description<br />|;
118 my $seq_count = $gb_count + scalar(@unigenes);
120 my $ont_count = $locus->count_ontology_annotations();
122 my $ontology_subtitle = !(grep { /^$user_type$/ } ('curator', 'submitter', 'sequencer') ) ? qq |<span class = "ghosted"> [Add ontology annotations]</span> |
123 : qq|<a href="javascript:Tools.toggleContent('associateOntologyForm', 'locus_ontology')">[Add ontology annotations]</a> |;
128 <& /util/import_javascript.mas, classes => ["Prototype", "jquery", "thickbox", "CXGN.Page.FormattingHelpers", "CXGN.Phenome.Locus", "CXGN.Phenome.Tools", "CXGN.Phenome.Locus.LocusPage", "CXGN.Sunshine.NetworkBrowser"] &>
131 <& /locus/initialize.mas, locus_id => $locus_id &>
133 <& /page/page_title.mas, title=> "$common_name locus ".$locus->get_locus_name &>
135 <&| /page/info_section.mas, title=>"Locus details" , subtitle => "$locus_xml | $editor_note | $guide_html" &>
137 <& /page/form.mas, object_type=>'locus', object_id=>"$locus_id", form_name=> 'locus_form', server_side_script => '/jsforms/locus_ajax_form.pl', form_div_name=>'locus_details', js_object_name=> 'locusForm', page_url => '/phenome/locus_display.pl' &>
142 <& /locus/registry.mas , person_id=>"$person_id", locus_id=>"$locus_id" , owner=>"$owner", registry=>"$registry" &>
143 <& /locus/synonym.mas , locus_id=>"$locus_id" , synonyms=>\@synonyms &>
147 <& /locus/locus_editor.mas, owners=>$owner_objects &>
148 <a href="claim_locus_ownership.pl?locus_id=<% $locus_id %>&action=confirm"> [Request editor privileges]</a><br /><br />
149 <& /locus/edits_info.mas, locus=>$locus &>
154 <& /locus/map_location.mas, person_id=>"$person_id", locus=>$locus &>
155 </td></tr></table></td></tr>
160 <&| /page/info_section.mas, title=>"Locus history", collapsible=>1, collapsed=>1 &>
161 <& /locus/history.mas, locus=>$locus &>
165 % if ( $locus_name && ($user_type eq 'curator')) {
166 <&| /page/info_section.mas, title=>"Curator tools", collapsible=>1, collapsed=>1 &>
167 <& /locus/merge_locus.mas , locus_id=>"$locus_id" , common_name=>"$common_name" &>
168 <& /phenome/assign_owner.mas , object_id=>"$locus_id" , object_type=>"locus" &>
173 <&| /page/info_section.mas, title=>"Notes and figures (" . scalar(@figures) . ")", subtitle => "$figure_subtitle", collapsible=>1, collapsed=>1 &>
174 <& /phenome/print_images.mas , images=>\@figures , dbh=>$dbh &>
178 <&| /page/info_section.mas, title=>"Accessions and images (" . scalar(@accessions) . ")", subtitle => "$ind_subtitle", id=>"locus_accessions", collapsible=>1, collapsed=>1 &>
179 <& /phenome/associate_accession_form.mas , locus_id=>$locus_id, person_id=>$person_id &>
180 <& /phenome/associated_accessions.mas , accessions=>\@accessions, dbh=>$dbh &>
184 <&| /page/info_section.mas, title=>"Alleles (" . scalar(@alleles) . ")", subtitle => "$allele_subtitle", collapsible=>1, collapsed=>1 &>
186 <& /phenome/allele.mas, alleles=>\@alleles, user=>$user &>
191 <&| /page/info_section.mas, title=>"Associated loci (" . $locus->count_associated_loci() . ")", subtitle => "$al_subtitle", id=>"locus2locus", collapsible=>1, collapsed=>1 &>
193 <& /locus/associate_locus.mas, locus_id=>$locus_id &>
194 <& /locus/network.mas &>
198 <&| /page/info_section.mas, title=>"Associated loci - graphical view", subtitle=>$network_sub, collapsible=>1, collapsed=>$collapsed &>
200 % print CXGN::Sunshine::Browser::include_on_page( 'locus', $locus_id ) if $network_sub ;
205 <&| /page/info_section.mas,
206 title => "SolCyc links",
211 <& /locus/solcyc.mas , locus_id=>$locus_id &>
216 <&| /page/info_section.mas, title=>"Sequence annotations ($seq_count)" , collapsible=>1, collapsed=>1 &>
218 <&| /page/info_section.mas, title => "Gene model matches",
224 <& /locus/locus_gene_model_matches.mas, locus => $locus, xrefs => $xrefs &>
229 <&| /page/info_section.mas, title => "SGN Unigenes",
231 subtitle => $new_unigene_link,
236 <& /locus/associate_unigene.mas, locus_id=>$locus_id &>
237 <& /locus/locus_unigenes.mas &>
240 <&| /page/info_section.mas, title => "GenBank accessions",
242 <a href="/chado/add_feature.pl?type=locus;type_id=$locus_id;refering_page=$this_page;action=new">[Associate new genbank sequence]</a>
251 <&| /page/info_section.mas,
252 title => "Other genome matches",
258 <& /locus/locus_genomic_annotations.mas, locus => $locus &>
264 <&| /page/info_section.mas, title=>"Literature annotations ($pub_count)" , subtitle=>$pub_subtitle, id=>"publications" , collapsible=>1, collapsed=>1 &>
267 % foreach my $d ( @sorted_pubs ) {
268 % if ( $d->[1] eq '0') { #if the dbxref is not obsolete
269 % my $pub = CXGN::Chado::Publication->new($dbh, $d->[0]->get_publication()->get_pub_id() );
270 <& /chado/publication.mas, pub=>$pub, count=>$pub_count++, db=>$d->[0]->get_db_name(), accession=>$d->[0]->get_accession() &>
277 <& /locus/ontology.mas,
278 title => "Ontology annotations ($ont_count)" ,
279 subtitle => $ontology_subtitle,
281 locus_id => $locus_id,
284 <&| /page/info_section.mas,
285 title => 'Related views',
289 <& /sitefeatures/mixed/xref_set/link.mas,
290 xrefs => [ grep { $_->feature->feature_name ne 'gbrowse2' } @$xrefs ],
295 <& /page/comments.mas, object_type=>'locus', object_id=>$locus_id, referer=>$this_page &>