5 /stock/index.mas - a page for displaying stock details (e.g. accession, population, etc.)
15 a hashref with all the parameters needed for printing the stock page!
20 $stockref->{uniquename}
21 $stockref->{curator} (boolean)
22 $stockref->{submitter} (boolean)
23 $stockref->{is_owner} (boolean)
24 $stockref->{props} (hash of arrayrefs of stockprops. Keys = prop name, value = prop value)
26 locus_autocomplete_uri
32 Naama Menda <nm249@cornell.edu>
42 $locus_autocomplete_uri => ''
49 use Bio::Chado::Schema;
50 use CXGN::Chado::Stock;
51 use CXGN::Page::FormattingHelpers qw / html_optional_show info_table_html /;
52 use CXGN::People::Person;
54 my $stock = $stockref->{stock};
55 my $stock_id = $stockref->{stock_id};
56 my $action = $stockref->{action} || 'view';
57 my $person_id = $stockref->{sp_person_id};
58 my $curator = $stockref->{curator};
59 my $submitter = $stockref->{submitter};
60 my $sequencer = $stockref->{sequencer};
62 my $schema = $stockref->{schema};
63 my $dbh = $stockref->{dbh};
65 my $stockprop_cv = $schema->resultset("Cv::Cv")->search( {
66 'me.name' => 'stock_property'} );
70 my $type = $stock->get_object_row()->type();
71 $type_name = $type->name() if $type;
74 my $is_owner = $stockref->{is_owner};
76 my $this_page = "/stock/view/id/$stock_id";
78 my $add_image_link = qq|<a href="/image/add?type_id=$stock_id&action=new&type=stock&refering_page=/stock/view/id/$stock_id">[Add new image]</a>|;
79 my $image_ids = $stockref->{props}->{'sgn image_id'} || [] ;
80 my $stockprops = $stockref->{props};
82 my $metadata = ['variety', 'donor', 'donor institute', 'country', 'state' , 'adaptation' , 'notes'];
84 my $pedigree= ['pedigree', 'male parent', 'female parent'];
85 my $experiment = ['experiment','year', 'location', 'replicate'];
86 my $resources = ['solcap number' , 'synonym'];
88 my $alleles = $stockref->{props}->{'sgn allele_id'} || [] ;
89 my $allele_div = "stock_alleles";
90 my $new_locus_link ;#= qq|<a href="<">[associate new locus]</a> |;
93 my $owners = $stockref->{owners};
95 foreach my $o_id (@$owners) {
96 my $person = CXGN::People::Person->new($dbh, $o_id);
97 my $first_name = $person->get_first_name;
98 my $last_name = $person->get_last_name;
99 $editor_link .= qq|<a href="/solpeople/personal-info.pl?sp_person_id=$o_id">$first_name $last_name</a> |;
102 my $dbxrefs = $stockref->{dbxrefs};
103 my $new_pub_link = $curator || $submitter || $sequencer ? qq|<a href="/chado/add_publication.pl?type=stock&type_id=$stock_id&refering_page=$this_page&action=new"> [Associate publication] </a>| : qq|<span class=\"ghosted\">[Associate publication]</span>| ;
105 my $pubmeds = $dbxrefs->{PMID} || [];
106 my $pub_count = scalar( @$pubmeds );
108 # sp, po, go , PMID, EUSOL, tgrc
111 <script language="javascript" type="text/javascript">
113 var stockPage = new CXGN.Phenome.Stock.StockPage();
114 stockPage.setStockId( <% $stock_id %> );
118 <& /util/import_javascript.mas, classes => ["jquery", "thickbox", "CXGN.Page.FormattingHelpers", "CXGN.Phenome.Stock.StockPage"] &>
121 <& /page/page_title.mas, title=> ucfirst($type_name) . ": " . $stock->get_uniquename() . "\n" &>
124 <&| /page/info_section.mas, title=>"Stock details" , subtitle => "<a href=/stock/search/>Back to stock search</a>" &>
126 <& /page/form.mas, object_type=>'stock', object_id=>"$stock_id", form_name=> 'stock_form', server_side_script => '/phenome/stock/stock_ajax_form.pl', form_div_name=>'stock_details', js_object_name=> 'stockForm', page_url => '/stock/view/id' , alternate_new_button => '<a href ="/stock/view/new">[New]</a>' &>
128 <div><b>Stock editors: </b> <% $editor_link %></div>
131 <&| /page/info_section.mas, title => "Synonyms" , is_subsection => 1 &>
132 <& /stock/stockprops.mas, props=> $stockprops , subset=> $resources &>
135 <&| /page/info_section.mas, title => "Pedigree data" , collapsible=> 1, is_subsection => 1 &>
136 <& /stock/stockprops.mas, props=> $stockprops, subset=> $pedigree &>
140 <&| /page/info_section.mas, title => "Additional information" , collapsible=> 1, is_subsection => 1 &>
141 <& /stock/stockprops.mas, props=> $stockprops, subset=> $metadata &>
148 <&| /page/info_section.mas, title => "Associated loci" , subtitle => $new_locus_link, collapsible=> 1 &>
149 <div id = "$allele_div">
150 <& /phenome/linked_alleles.mas, alleles=> $alleles , dbh=> $dbh, div=> $allele_div &>
153 <& /phenome/associate_locus.mas, object_id => $stock_id , type => "stock", locus_add_uri=> $locus_add_uri, locus_autocomplete_uri => $ locus_autocomplete_uri &>
157 <&| /page/info_section.mas, title => "Experimental data" , collapsible=> 1, is_subsection => 0 &>
158 <& /stock/stockprops.mas, props=> $stockprops, subset=> $experiment &>
162 <&| /page/info_section.mas, title=>"Stock history", collapsible=>1, collapsed=>1 &>
169 <&| /page/info_section.mas, title=>"Related stocks" , collapsible=>1, collapsed=>0 &>
170 <& /stock/related_stocks.mas, stock => $stock->get_object_row &>
177 <&| /page/info_section.mas, title=>"images (" . scalar(@$image_ids) . ")", subtitle => "$add_image_link", collapsible=>1, collapsed=>1 &>
178 <& /image/print_images.mas , images=>$image_ids , dbh=>$dbh &>
183 <&| /page/info_section.mas, title=>"Literature annotation ($pub_count)" , subtitle=>$new_pub_link, id=>"publications" , collapsible=>1, collapsed=>1 &>
186 % foreach my $pub_id ( @ { $dbxrefs->{PMID} } ) {
187 % #if the dbxref is not obsolete
188 % my $pub = CXGN::Chado::Publication->new($dbh, $pub_id );
189 <& /chado/publication.mas, pub=>$pub, count=>$pub_count++, db=>'PMID', accession=>$pub->get_accession() &>
195 <&| /page/info_section.mas, title=>"Ontology annotation" &>
199 <&| /page/info_section.mas, title=>"Phenotype data " &>
203 <&| /page/info_section.mas, title=>"Genotype data " &>
208 <&| /page/info_section.mas, title=>"dbxrefs" &>
209 % foreach my $d (keys %$dbxrefs) {
210 % foreach my $item ( @{ $dbxrefs->{$d} } ) {
211 % print "$d: " . $item . "\n" ;
219 <& /page/comments.mas, object_type=>'stock', object_id=>$stock_id, referer=>$this_page &>