Reset checked status when switching between lists
[sgn.git] / mason / stock / index.mas
blob582d00ee81886744c2afdc52299e18df328c711b
1 <%doc>
3 =head1 NAME
5 /stock/index.mas - a page for displaying stock details (e.g. accession, population, etc.)
7 =head1 DESCRIPTION
9 parameters:
11 =over 1
13 =item $stockref
15 a hashref with all the parameters needed for printing the stock page!
17  $stockref->{stock_id}
18  $stockref->{stock}
19  $stockref->{schema}
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)
25  $stockref->{has_pedigree} (boolean)
26  $stockref->{has_descendants} (boolean)
27  locus_add_uri
28  locus_autocomplete_uri => '/ajax/locus/autocomplete/'
29  cvterm_add_uri
30  cvterm_autocomplete_uri => '/ajax/cvterm/autocomplete/'
31  barcode_tempdir
32  barcode_tempuri
33  organism_autocomplete_uri => '/ajax/organism/autocomplete/'
35 =back
37 =head1 AUTHOR
39 Naama Menda <nm249@cornell.edu>
41 =cut
43 </%doc>
45 <%args>
46 $stock_row
47 $stockref => undef
48 $locus_add_uri => ''
49 $locus_autocomplete_uri => undef
50 $cvterm_add_uri => ''
51 $cvterm_autocomplete_uri => undef
52 $barcode_tempdir => undef
53 $barcode_tempuri => undef
54 $identifier_prefix => 'SGN'
55 $organism_autocomplete_uri => '/ajax/organism/autocomplete/'
56 </%args>
59 <%perl>
61 use Bio::Chado::Schema;
62 use CXGN::Chado::Stock;
63 use CXGN::Page::FormattingHelpers qw / html_optional_show info_table_html /;
64 use CXGN::People::Person;
65 use CXGN::Chado::Publication;
66 use CXGN::Cview::Map::SGN::Genotype;
67 use CXGN::Cview::MapOverviews;
69 my $trial_stock_type => undef;
70 my $stock = $stockref->{stock};
71 my $stock_id = $stockref->{stock_id};
72 my $action = $stockref->{action} || 'view';
73 my $person_id = $stockref->{person_id};
74 my $curator = $stockref->{curator};
75 my $submitter = $stockref->{submitter};
76 my $sequencer = $stockref->{sequencer};
77 my $pubs = $stockref->{pubs};
78 my $has_pedigree = $stockref->{has_pedigree};
79 my $has_descendants = $stockref->{has_descendants};
80 my $trait_ontology_db_name = $stockref->{trait_ontology_db_name};
81 my $editable_stock_props_string = $stockref->{editable_stock_props};
82 my $schema = $stockref->{schema};
83 my $dbh = $stockref->{dbh};
85 my @editable_stock_props = split "," , $editable_stock_props_string;
88 my ($type_name, $uniquename);
89 my $type = $stock_row ? $stock_row->type : undef;
90 $type_name  = $type->name() if $type;
91 $uniquename = $stock->get_uniquename if $type;
93 my @editable_vector_props;
95 if($type_name eq 'vector_construct'){
96   my $editable_vector_props_string = $stockref->{editable_vector_props};
97   @editable_vector_props = split "," , $editable_vector_props_string;
100 #################
101 my $is_owner = $stockref->{is_owner};
103 my $this_page = "/stock/$stock_id/view";
105 my $image_ids =  $stockref->{image_ids} || [] ;
106 my $related_image_ids =  $stockref->{related_image_ids} || [] ;
107 my $stockprops = $stockref->{props};
110 #my $pedigree= ['pedigree', 'male parent', 'female parent'];
111 # get pedigree of stock
112 #my $stock_pedigree = $stockref->{stock_pedigree};
113 #my $stock_descendants = $stockref->{stock_descendants};
115 my $allele_div = "stock_alleles";
116 my $new_locus_link = !$person_id ? qq|<a href="/user/login">[log-in to associate new locus]</a> | : '' ;
118 #owner
119 my $owners = $stockref->{editor_info};
120 my $owner_ids = $stockref->{owners};
121 my $owners_html = '';
122 my %unique_owners;
123 foreach my $o_id (@$owner_ids) {
124     $unique_owners{$o_id}++;
126 my @owner_ids = keys %unique_owners;
127 foreach my $o_id (@owner_ids){
128   my $person = CXGN::People::Person->new($dbh, $o_id);
129   my $first_name = $person->get_first_name;
130   my $last_name = $person->get_last_name;
131   $owners_html .= qq|<a href="/solpeople/personal-info.pl?sp_person_id=$o_id">$first_name $last_name</a> |;
133 my $editor_link_table = "<table class='table table-bordered'><thead><tr><th>Editor</th><th>Timestamp</th><th>Modification Note</th></tr></thead><tbody>";
134 foreach my $o_id (@$owners) {
135   my $person = CXGN::People::Person->new($dbh, $o_id->[0]);
136   my $first_name = $person->get_first_name;
137   my $last_name = $person->get_last_name;
138   $editor_link_table .= qq|<tr><td><a href="/solpeople/personal-info.pl?sp_person_id=$o_id->[0]">$first_name $last_name</a></td><td>$o_id->[1]</td><td>$o_id->[2]</td></tr>|;
140 $editor_link_table .= "</tbody></table>";
141 $editor_link_table = "<br/>".$owners_html."<br/><br/>".$editor_link_table;
143 #phenotypes measured directly on this stock
144 my $direct_phenotypes = $stockref->{direct_phenotypes} || undef;
146 # get all phenotypes of subjects
147 my $members_phenotypes = $stockref->{members_phenotypes};
148 my $p_download_link = '<a class="btn btn-sm btn-default" style="margin:3px" target="_blank" href = "/breeders/trials/phenotype/download?format=csv&timestamp=1&dataLevel=all&'.$type_name.'_list=['.$stock_id.']&search_type=complete&">Download All Phenotypes</a>';
150 ############################
151 my $map_html = $stockref->{map_html};
152 my $map;
153 if ($stock_id) {
154   $map = CXGN::Cview::Map::SGN::Genotype->new($dbh, $stock_id);
155   if ($map->get_chromosome_count > 1 ) {
156     my $overview = CXGN::Cview::MapOverviews::Generic->new($map,
157                                                            {
158                                                             dbh=> $dbh,
159                                                             basepath => $stockref->{cview_basepath},
160                                                             tempfiles_subdir => $stockref->{cview_tmp_dir } });
161     if ($overview) {
162       $overview->render_map();
163       $map_html .= $overview->get_image_html();
164     }
165   }
167 #########################################
168 my $has_qtl_data = $stockref->{has_qtl_data};
171 my $new_pub_link = $curator || $submitter || $sequencer  ?   qq|<a class="btn btn-sm btn-default" style="margin:3px" href="/chado/add_publication.pl?type=stock&amp;type_id=$stock_id&amp;refering_page=$this_page&amp;action=new">Associate publication</a>| : qq|<span class=\"btn btn-sm btn-default ghosted\" style="margin:3px" disabled>Associate publication</span>| ;
173 ## EUSOL, tgrc (stock_dbxref)
174 my $dbxrefs = $stockref->{dbxrefs};
175 my %source_dbs;
176 foreach my $db_name ( keys %$dbxrefs ) {
177   foreach my $dbxref ( @{ $dbxrefs->{$db_name} } ) {
178     my $url = $dbxref->db->urlprefix . $dbxref->db->url;
179     $url .= $dbxref->accession if $url =~ m/\?$|\=$/ ;
180     $source_dbs{$url} = $db_name . ": " . $dbxref->accession if $url;
181   }
184 my $ontology_subtitle = $curator || $submitter || $sequencer  ?
185   qq|<a class="btn btn-sm btn-default" style="margin:3px" href="javascript:Tools.toggleContent('associate_cvterm_form', 'stock_ontology')">Add ontology annotations</a> | :
186   qq |<span class = "btn btn-default btn-sm ghosted" style="margin:3px" disabled>Add ontology annotations</span> |;
188 my $add_phenotype_link =  $curator || $submitter || $sequencer  ? qq| <a href="javascript:Tools.toggleContent('add_phenotype_form', 'stock_phenotype')" >[Add phenotype]</a> | :   qq |<span class = "ghosted"> [Add phenotype]</span> |;
190 my $edit_privs = $curator || $submitter || $sequencer;
192 my $jbrowse_path = $c->config->{jbrowse_path};
193 my @path_parts = split('/', $jbrowse_path);
194 my $basepath = $path_parts[1];
195 my $test_url = "/" . $basepath . "/jbrowse.conf";
196 my $jbrowse_url = $jbrowse_path . "%2Faccessions%2F" . $stock_id . "&tracks=DNA%2CGene%20exons%2C" . $uniquename . "_2015_V6_imputed&highlight=";
199 my $released_variety_link = '<button class="btn btn-default btn-sm" style="margin:3px" id="released_variety_link" disabled>Add released variety name</button>';
201 if ($person_id && ($submitter || $curator || $sequencer)) { $released_variety_link = qq | <button class="btn btn-default btn-sm" style="margin:3px" id="released_variety_link" >Add released variety name</button> |; }
203 </%perl>
205 <& /util/import_css.mas, paths => ['/documents/inc/datatables/jquery.dataTables.css'] &>
207 <& /util/import_javascript.mas,
208    classes => ["jquery", "jqueryui", "thickbox", "CXGN.Page.FormattingHelpers", "jquery.cookie", "CXGN.Stock", "d3.d3v4Min" ],
209   entries => ["sequenced_accessions"]
212 <script language="javascript">
213 function jqueryStuff() {
214    jQuery(function() {
215      jQuery("#species_name").autocomplete({
216         source: '/organism/autocomplete'
217      });
218   });
220 </script>
223 <& /page/page_title.mas, title=> join( ': ', grep $_, ucfirst($type_name), $uniquename ) || 'Create a new stock' &>
226 <&| /page/info_section.mas, title=>"Stock details" , collapsible=>1, collapsed=>0, subtitle => "<button class='btn btn-sm btn-default' style='margin:3px' name='stock_new_qtl_link'>New QTL population</button> <button class='btn btn-sm btn-default' style='margin:3px' name='stock_go_to_stock_search'>Back to stock search</button>"  &>
228     <div class="panel panel-default">
229         <div class="panel-body">
231             <div class="row">
232                 <div class="col-sm-6">
234                     <& /page/form.mas,
235                         object_type=>'stock',
236                         object_id=>"$stock_id",
237                         form_name=> 'stock_form',
238                         server_side_script => '/phenome/stock/stock_ajax_form.pl',
239                         form_div_name=>'stock_details',
240                         js_object_name=> 'stockForm',
241                         page_url => "/stock/$stock_id/view/" ,
242                         #alternate_new_button => '<a class="btn btn-sm btn-default" href ="/stock/0/new">New</a>'
243                         alternate_new_button => '',,
244                         alternate_ghosted_new_button => '',
245                         alternate_delete_button => '',
246                         alternate_ghosted_delete_button => ''
247                     &>
250                 </div>
251                 <div class="col-sm-6">
252                     <br /><br />
253                     <& /util/barcode.mas, identifier => "$identifier_prefix"."$stock_id", text=> "$identifier_prefix stock $stock_id ($uniquename)", format=>"stock_qrcode"  &>
254                     <br /><br />
255                 </div>
256             </div>
258             <div class="row">
259               <div class="col-sm-6">
260                 <&| /page/info_section.mas, title => "Released variety name", subtitle=>$released_variety_link, is_subsection => 1 &>
261                   <& /stock/stockprops.mas,
262                      stock_id  =>$stock_id,
263                     form_div_id => 'released_variety_link',
264                     props      => ['released_variety_name'],
265                     div_name   => 'released_variety_name',
266                     edit_privs => $edit_privs,
267                     subset     => ['released_variety_name'],
268                     editable   => ['released_variety_name']  &>
269                  </&>
270               </div>
271               </div>
272               <div class="row">
273                 <div class="col-sm-6">
274                 </div>
275               </div>
276           </div>
277        </div>
278 </&>
280 <&| /page/info_section.mas, title => "Navigator" , collapsible=> 1, collapsed=>0 &>
282 % if ($type_name eq 'population') {
283     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, type_name => $type_name,  info_section_title => "<h4 style='display:inline'>Members</h4>", info_section_subtitle => 'View accessions in this population .', icon_class => "glyphicon glyphicon-list-alt", info_section_id => "population_members_section", info_section_collapsed => 0 &>
284 % }
286 % my $subtitle = $edit_privs ? "<button class=\"btn btn-sm btn-primary\" style=\"margin:3px\" id=\"stock_add_synonym\" >Add Synonym</button>" : "<button disabled class=\"btn btn-sm btn-primary\" style=\"margin:3px\" title=\"Login to add info\">Add Synonym</button>";
287 % my $props_subtitle = $edit_privs ? "<button class=\"btn btn-sm btn-primary\" style=\"margin:3px\" id=\"stock_add_props\" >Add Additional Info</button>" : "<button disabled class=\"btn btn-sm btn-primary\" style=\"margin:3px\" title=\"Login to add info\">Add Additional Info</button>";
289 % if ($type_name eq 'plot' || $type_name eq 'plant' || $type_name eq 'subplot' || $type_name eq 'tissue_sample') {
290     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Experiment Usage</h4>", info_section_subtitle => 'View experiments that this stock has been used in.', icon_class => "glyphicon glyphicon-leaf", info_section_id => "stock_trials_section" &>
291     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Related Stocks</h4>", info_section_subtitle => 'View any accession, plot, plant, and/or tissue_sample that are linked to this stock.', icon_class => "glyphicon glyphicon-retweet", info_section_id => "stock_related_stock_section", stock_uniquename => $uniquename, type_name => $type_name &>
292 %   my $trait_assayed_buttons = $type_name eq 'plot' ? "<button class='btn btn-sm btn-primary' style='margin:3px' id='stock_download_phenotypes_button'>Download Phenotypes</button> $p_download_link <a class='btn btn-sm btn-default' style='margin:3px' target='_blank' href = '/breeders/plot_phenotyping?stock_id=$stock_id'>Direct plot phenotyping</a>" : "<button class='btn btn-sm btn-primary' style='margin:3px' id='stock_download_phenotypes_button'>Download Phenotypes</button> $p_download_link";
293     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Traits Assayed</h4>", info_section_subtitle => 'View and download phenotypic data for this stock.', icon_class => "glyphicon glyphicon-equalizer", info_section_id => "stock_traits_section", buttons_html => $trait_assayed_buttons &>
294 % }
296 % if ($type_name ne 'vector_construct' ){
297     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, type_name => $type_name, stockref => $stockref, buttons_html => $subtitle.$props_subtitle, info_section_title => "<h4 style='display:inline'>Additional Info</h4>", info_section_subtitle => 'View and edit additional properties such as synonyms, editors, and all types of properties.', icon_class => "glyphicon glyphicon-info-sign", info_section_id => "stock_additional_info_section", stockprops => $stockprops, edit_privs => $edit_privs, editable_stock_props => \@editable_stock_props, editor_link => $editor_link_table, source_dbs => \%source_dbs, locus_add_uri => $locus_add_uri, new_locus_link => $new_locus_link, allele_div => $allele_div, is_owner => $is_owner, info_section_collapsed => 0 &>
298 % } else {
299     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, type_name => $type_name, stockref => $stockref, buttons_html => $subtitle.$props_subtitle, info_section_title => "<h4 style='display:inline'>Additional Info</h4>", info_section_subtitle => 'View and edit additional properties such as synonyms, editors, and all types of properties.', icon_class => "glyphicon glyphicon-info-sign", info_section_id => "stock_additional_info_section", stockprops => $stockprops, edit_privs => $edit_privs, editable_stock_props => \@editable_vector_props, editor_link => $editor_link_table, source_dbs => \%source_dbs, locus_add_uri => $locus_add_uri, new_locus_link => $new_locus_link, allele_div => $allele_div, is_owner => $is_owner, info_section_collapsed => 0 &>
300     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Related Stocks</h4>", info_section_subtitle => 'View accessions (transformants) and transformation ids that are linked to this vector construct.', icon_class => "glyphicon glyphicon-retweet", info_section_id => "vector_related_stocks_section", stock_uniquename => $uniquename, type_name => $type_name &>
301 % }
303 % if ($type_name eq 'accession'){
304     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Experiment Usage</h4>", info_section_subtitle => 'View experiments that this stock has been used in.', icon_class => "glyphicon glyphicon-leaf", info_section_id => "stock_trials_section" &>
305 %    my $trait_assayed_buttons = $type_name eq 'plot' ? "<button class='btn btn-sm btn-primary' style='margin:3px' id='stock_download_phenotypes_button'>Download Phenotypes</button> $p_download_link <a class='btn btn-sm btn-default' style='margin:3px' target='_blank' href = '/breeders/plot_phenotyping?stock_id=$stock_id'>Direct plot phenotyping</a>" : "<button class='btn btn-sm btn-primary' style='margin:3px' id='stock_download_phenotypes_button'>Download Phenotypes</button> $p_download_link";
306     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Traits Assayed</h4>", info_section_subtitle => 'View and download phenotypic data for this stock.', icon_class => "glyphicon glyphicon-equalizer", info_section_id => "stock_traits_section", buttons_html => $trait_assayed_buttons &>
307 % }
309 % if ($type_name eq 'accession' || $type_name eq 'plant' || $type_name eq 'plot' || $type_name eq 'tissue_sample'){
311 %   my $sequencing_status_button = '';
312 %   if ($c->user) {
313 %       $sequencing_status_button = '<button id="show_sequencing_info_dialog_button" class="btn btn-primary btn-sm" data-toggle="modal" style="margin:3px" data-target="#edit_sequencing_info_dialog">Add sequencing info</button>';
314 %   }
315 %   else {
316 %       $sequencing_status_button = '<button disabled id="show_sequencing_info_dialog_button" class="btn btn-primary btn-sm" data-toggle="modal" style="margin:3px" data-target="#edit_sequencing_info_dialog">Add sequencing info</button>';
317 %   }
319       <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Sequencing Status</h4>", info_section_subtitle => 'View and edit sequencing status info for this stock.', icon_class => "glyphicon glyphicon-inbox", info_section_id => "stock_sequencing_status_section", buttons_html => "$sequencing_status_button", map_html => $map_html &>
321         <!-- buttons_html => '<a class="btn btn-default btn-sm" style="margin:3px" href = "/stock/'.$stock_id.'/genotypes">Download All Genotypes</a>', -->
323     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Genotype Marker Data</h4>", info_section_subtitle => 'View and download phenotypic data for this stock.', icon_class => "glyphicon glyphicon-map-marker", info_section_id => "stock_genotypes_section",  map_html => $map_html &>
324 % }
326 % if ($type_name eq 'accession'){
328 <%perl>
329         my $collapsible = 0;
330         if ($has_pedigree==1) {
331             $collapsible = 1;
332         }
333         my $add_parent_link = '<button class="btn btn-primary btn-sm" style="margin:3px" id="add_parent_link" disabled>Add parent</button>';
334         if ($person_id && ($submitter || $curator || $sequencer)) { $add_parent_link = qq | <button class="btn btn-primary btn-sm" style="margin:3px" id="add_parent_link" >Add parent</button> |; }
336         my $remove_parent_link = '<button class="btn btn-default btn-sm" style="margin:3px" id="remove_parent_link" disabled>Remove parent</button>';
337         if ($person_id && ($submitter || $curator || $sequencer)) { $remove_parent_link = qq | <button class="btn btn-default btn-sm" style="margin:3px" id="remove_parent_link">Remove parent</button> |; }
338 </%perl>
340     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Pedigree</h4>", info_section_subtitle => 'View and edit pedigree information.', icon_class => "glyphicon glyphicon-random", info_section_id => "stock_pedigree_section", buttons_html => $add_parent_link.$remove_parent_link, has_pedigree => $has_pedigree, info_section_collapsed => 1 &>
341     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Related Stocks</h4>", info_section_subtitle => 'View any plots, plants, tissue_sample, and/or accessions that are linked to this stock.', icon_class => "glyphicon glyphicon-retweet", info_section_id => "stock_related_stock_section", stock_uniquename => $uniquename, type_name => $type_name &>
343 % }
345     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Images</h4>", info_section_subtitle => 'View and add images of this stock and of related stocks.', icon_class => "glyphicon glyphicon-camera", info_section_id => "stock_images_section", image_ids => $image_ids, related_image_ids => $related_image_ids, dbh => $dbh, buttons_html => qq|<a id="add_new_image_button" class="btn btn-sm btn-default" style="margin:3px" href="/image/add?type_id=$stock_id&action=new&type=stock&refering_page=$this_page">Add new image</a><a class="btn btn-sm btn-default" style="margin:3px" id="stock_images_section_compare_images_button">Compare Images</a>| &>
347     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Upload Data Files</h4>", info_section_subtitle => 'Upload any additional files for this Accession.', icon_class => "glyphicon glyphicon-cloud-upload", info_section_id => "stock_upload_files" &>
349     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Literature Annotation</h4>", info_section_subtitle => 'View annotations for this stock found in literatur and ontologies.', icon_class => "glyphicon glyphicon-book", info_section_id => "stock_literature_annotation_section", buttons_html => $new_pub_link.$ontology_subtitle, pubs => $pubs, cvterm_add_uri => $cvterm_add_uri, stockref => $stockref, trait_ontology_db_name => $trait_ontology_db_name, is_owner => $is_owner, dbh=>$dbh &>
351     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>JBrowse Genome Alignments</h4>", info_section_subtitle => 'View JBrowse tracks for this stock.', icon_class => "glyphicon glyphicon-align-left", info_section_id => "stock_jbrowse_section" &>
353     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Comments</h4>", info_section_subtitle => 'View and add comments to this stock.', icon_class => "glyphicon glyphicon-pencil", info_section_id => "stock_comments_section", referer => $this_page &>
355     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Audit Table</h4>", info_section_subtitle => 'Track audit information for this stock.', icon_class => "glyphicon glyphicon-time", info_section_id => "audit_table_section", stock_uniquename => $uniquename, referer => $this_page &>
357 % if ($type_name eq 'population') {
358     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, stock_uniquename => $uniquename, info_section_title => "<h4 style='display:inline'>Delete This Stock</h4>", info_section_subtitle => 'Delete this population.', icon_class => "glyphicon glyphicon-trash", info_section_id => "population_delete_section" &>
359 % } else {
360     <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Obsolete This Stock</h4>", info_section_subtitle => 'Make a stock obsolete so that it does not show in searches.', icon_class => "glyphicon glyphicon-trash", info_section_id => "stock_delete_section" &>
361 % }
363 </&>
365 <& /stock/download_stock_phenotypes_dialog.mas, stock_id => $stock_id, stock_name => $uniquename, stock_type => $type_name &>
367 <div id="remove_parent_dialog">
368     Remove a parent (this will only remove the link to the parent, not the parent accession itself).
369     <br /><br />
370     <div id="remove_parent_list">[loading parent list...]</div>
371 </div>
374 <&| /page/info_section.mas, title=>"Phenotype data " ,  subtitle=>$p_download_link ,  collapsible => 1, collapsed => 1 &>
375 % foreach my $project (keys %$direct_phenotypes) {
376 %   my $rs = $direct_phenotypes->{$project} ;
378 <&| /page/info_section.mas,
379     id       => "stock_phenotype",
380     title    =>"Experiment: $project",
381     subtitle => $add_phenotype_link,
382     is_subsection => 1,
383     collapsible => 1
385     <& /stock/add_phenotype.mas,
386       stock_id => $stock_id ,
387       trait_ontology_db_name => $trait_ontology_db_name,
388       project=>$project
389     &>
390   <& /phenotypes/phenotype_data.mas ,
391       phenotypes=> $rs
392     &>
393   </&>
394 % }
396 % foreach my $key (keys %$members_phenotypes) {
397 % my $m_rs = $members_phenotypes->{$key};
398 <&| /page/info_section.mas,
399      title         => "Member phenotypes",
400      subtitle      => $key,
401      is_subsection => 1,
402      collapsible   => 1,
403  &>
404     <& /phenotypes/phenotype_data.mas,
405          phenotypes => $m_rs,
406          object_id  => $stock_id,
407          has_qtl    => $has_qtl_data,
408      &>
409   </&>
410 % }
411 </&>
413 <div id="stock_trials_info_popup">
414     <table id="stock_trials_info_table" >
415         <thead>
416             <tr><th>Trait</th><th>Average</th><th>Std dev</th><th>Count</th></tr>
417         </thead>
418     </table>
419 </div>
421 <script>
422     jQuery(document).ready(function() {
423         stock_detail_page_init_dialogs();
425         jQuery('[name="stock_new_qtl_link"]').click(function(){
426             window.location.href = '/phenome/qtl_form.pl';
427         });
429         jQuery('[name="stock_go_to_stock_search"]').click(function(){
430             window.location.href = '/search/stocks/';
431         });
433         jQuery('#remove_parent_link').click( function() {
434             jQuery('#remove_parent_dialog').dialog("open");
435             get_remove_parents_list(<% $stock_id %>);
436         });
438         jQuery.ajax({
439             url: "<% $test_url %>",
440             success: function(response) {
441                 if ( response.indexOf("Accession_<%$stock_id%>") > -1 ) {  // if dataset is found, create and display link
442                     jQuery('#jbrowse_check').replaceWith('<a id="jbrowse_link" href="<% $jbrowse_url %>">View the tracks for this accession in JBrowse</a>');
443                 }
444                 else { // if not found, display message that dataset doesn't exist
445                     jQuery('#jbrowse_check').html(" <i>This accession does not have any data in Jbrowse.</i>");
446                 }
447             },
448             error: function() {
449                 jQuery('#jbrowse_check').html(" <i>Jbrowse has not been set up for this database.</i>");
450             }
451         });
454   });
458 </script>