package SGN::View::Mason::Commands;
use strict;
use vars qw($m $c);
#line 51 "/home/production/cxgn/sgn/mason/locus/index.mas"

  use CXGN::Sunshine::Browser;
  use CXGN::Page::FormattingHelpers qw / html_optional_show info_table_html /;
HTML::Mason::Component::FileBased->new(
'code' => sub {
use utf8; local $SGN::View::Mason::Commands::m = $HTML::Mason::Commands::m;
HTML::Mason::Exception::Params->throw
    ( error =>
      "Odd number of parameters passed to component expecting name/value pairs"
    ) if @_ % 2;
my ( $locusref, $locus_add_uri, $locus_autocomplete_uri, $cvterm_add_uri, $cvterm_autocomplete_uri, $trait_db_name, $blast_url );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }
#line 42 "/home/production/cxgn/sgn/mason/locus/index.mas"
     $locusref = exists $pos{'locusref'} ? $_[ $pos{'locusref'} ] :  undef;
#line 43 "/home/production/cxgn/sgn/mason/locus/index.mas"
     $locus_add_uri = exists $pos{'locus_add_uri'} ? $_[ $pos{'locus_add_uri'} ] :  '';
#line 44 "/home/production/cxgn/sgn/mason/locus/index.mas"
     $locus_autocomplete_uri = exists $pos{'locus_autocomplete_uri'} ? $_[ $pos{'locus_autocomplete_uri'} ] :  undef;
#line 45 "/home/production/cxgn/sgn/mason/locus/index.mas"
     $cvterm_add_uri = exists $pos{'cvterm_add_uri'} ? $_[ $pos{'cvterm_add_uri'} ] :  '';
#line 46 "/home/production/cxgn/sgn/mason/locus/index.mas"
     $cvterm_autocomplete_uri = exists $pos{'cvterm_autocomplete_uri'} ? $_[ $pos{'cvterm_autocomplete_uri'} ] :  undef;
#line 47 "/home/production/cxgn/sgn/mason/locus/index.mas"
     $trait_db_name = exists $pos{'trait_db_name'} ? $_[ $pos{'trait_db_name'} ] :  'SP';
#line 48 "/home/production/cxgn/sgn/mason/locus/index.mas"
     $blast_url = exists $pos{'blast_url'} ? $_[ $pos{'blast_url'} ] :  '/tools/blast/';
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 39 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 50 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
' );
#line 55 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
' );
#line 56 "/home/production/cxgn/sgn/mason/locus/index.mas"


my $locus     = $locusref->{locus};
my $locus_id  = $locusref->{locus_id};
my $action    = $locusref->{action} || 'view';
my $person_id = $locusref->{person_id};
my $curator   = $locusref->{curator};
my $submitter = $locusref->{submitter};
my $sequencer = $locusref->{sequencer};
my $is_owner  = $locusref->{is_owner};
my $owners     = $locusref->{owners};
my $dbh       = $locusref->{dbh};
my $xrefs     = $locusref->{xrefs};
my $feature   =  $locusref->{feature};
my $src_feature = $locusref->{src_feature};
my $dbxrefs     = $locusref->{dbxrefs};
my $pubs        = $locusref->{pubs};

###check these params
# dbxrefs, unigenes , ontology

my $this_page = "/locus/$locus_id/view/";

my $locus_xml = $locus_id ? qq |<a href = "/phenome/generic_gene_page.pl?locus_id=$locus_id">Download GMOD XML</a>|
  : qq |<span class="ghosted">Download GMOD XML</span>|;
my $editor_note =
  qq |<a href="/phenome/editors_note.pl">Note to Editors</a>|;
my $guide_html =
  qq|<a href="http://docs.google.com/View?docid=ddhncntn_0cz2wj6">Annotation guidelines</a>|;

my $common_name = $locus->get_common_name();
my @owners = $locus->get_owners();
my $owner_objects= $locus->get_owners(1);

my $locus_name = $locus->get_locus_name();

my $registry = $locus->get_associated_registry();
my $registry_subtitle =  $is_owner && $locus_id ?   '<a href="javascript:Tools.toggleContent(\'associateRegistryForm\', \'locus_registry\')">[Associate a registry name with this locus]</a> '
  : qq|<span class = "ghosted"> [Associate registry name]</span>| ;

my @synonyms = $locus->get_locus_aliases('f','f');
my @figures = $locus->get_figure_ids();

my $figure_subtitle =
  $curator || $submitter || $sequencer ?
  " <a href=\"/image/add?type_id=$locus_id&type=locus&action=new&refering_page=$this_page\">[ Add notes, figures or images]</a>" : "<span class= \"ghosted\">[Add notes, figures or images]</span> " ;

my $stock_subtitle =   $curator || $submitter || $sequencer ?
  '<a href="javascript:Tools.toggleContent(\'associateStockForm\', \'locus_accessions\')">[Associate accession]</a> ' :   '<span class= "ghosted">[Associate accession]</span> ';

my $accessions = $locus->get_stock_ids;

my @alleles = $locus->get_alleles(); #array of allele objects

my $allele_subtitle = $curator || $submitter || $sequencer  ?
  "<a href=\"/phenome/allele.pl?locus_id=$locus_id&amp;action=new\">[Add new allele]</a>" :
  '<span class="ghosted">[Add new Allele]</span>' ;

my $al_subtitle = $curator || $submitter || $sequencer  ?
  '<a href="javascript:Tools.toggleContent(\'associateLocusForm\', \'locus_network\');Tools.getOrganisms()">[Associate new locus]</a> ' :
  '<span class="ghosted">[Associate new locus]</span>' ;

my $collapsed = $locus->count_associated_loci() ? 1 : 0 ;

my $network_sub = $collapsed ?
  "View <b>$locus_name</b> relationships in the stand-alone <a href=\"/tools/networkbrowser/?type=locus&name=$locus_id\">network browser</a>" : '';

my $new_unigene_link =  $curator || $submitter || $sequencer  ?
  '<a href="javascript:Tools.toggleContent(\'associateUnigeneForm\', \'locus_unigenes\' )">[Associate new unigene]</a>' :
    '<span class= "ghosted">[Associate new unigene]</span> ';
my $new_genbank_link = qq | <a href="/chado/add_feature.pl?type=locus;type_id=$locus_id;refering_page=$this_page;action=new">[Associate new genbank sequence]</a> | ;
my %dbxrefs = $locus->get_all_dbxrefs();

my $tgrc;
foreach ( @{ $dbxrefs{'tgrc'} } ) {
  if ( $_->[1] eq '0' ) {
    my $url       = $_->[0]->get_urlprefix() . $_->[0]->get_url();
    my $accession = $_->[0]->get_accession();
    $tgrc .=
      qq|<br>$locus_name is a <a href="$url$accession" target="blank">TGRC gene</a><br />|;
  }
}
my $tair;
foreach ( @{ $dbxrefs{'TAIR locus'} } ) {
  if ( $_->[1] eq '0' ) {
    my $url       = $_->[0]->get_urlprefix() . $_->[0]->get_url();
    my $accession = $_->[0]->get_accession();
    $tair .=
      qq|<br>$locus_name is a <a href="$url$accession" target="blank">TAIR locus</a><br />|;
  }
}

my $phylogenes;
foreach ( @{ $dbxrefs{'PhyloGenes'} } ) {
  if ( $_->[1] eq '0' ) {
    my $url       = $_->[0]->get_urlprefix() . $_->[0]->get_url();
    my $accession = $_->[0]->get_accession();
    $phylogenes .=
      qq|<br>$locus_name is on <a href="$url$accession" target="blank">PhyloGenes</a><br />|;
  }
}

my $tomDel;
my ($chr, $pos, $jbrowse_url);
my $tomDel_pub = qq|Please cite <a href ="https://doi.org/10.1101/2021.11.08.467620" target="blank">Razifard et al.|;
foreach ( @{ $dbxrefs{'TomDel'} } ) {
  if ( $_->[1] eq '0' ) {
    my $url       = $_->[0]->get_urlprefix() . $_->[0]->get_url();
    my $accession = $_->[0]->get_accession();
    my $description = $_->[0]->get_description;

    $description =~ /^chromosome (SL2.50ch\d{2}).*position: (\d[0-9]+)$/;
    $chr = $1;
    $pos = $2;
    $jbrowse_url = "https://solgenomics.net/jbrowse_solgenomics/?data=data/json/SL2.50&loc=$chr:$pos&tracks=DNA,gene_models,TomDelDB";
    $tomDel .=
      qq|<br /><a href="$url$accession" target="blank">TomDelDB genotype frequencies</a> in tomato populations. <a href="$jbrowse_url" target="blank">$description</a><br />|;
    $tomDel .= qq|$tomDel_pub<br />|;
    }
}
my $pub_subtitle = $curator || $submitter || $sequencer  ?
  qq|<a href="/chado/add_publication.pl?type=locus&amp;type_id=$locus_id&amp;refering_page=$this_page&amp;action=new"> [Associate publication] </a>| :
  qq|<span class=\"ghosted\">[Associate publication]</span>|;

$pub_subtitle .=
  qq | <a href="javascript:void(0)"onclick="window.open('/phenome/locus_pub_rank.pl?locus_id=$locus_id','publication_list','width=600,height=400,status=1,location=1,scrollbars=1')">[Matching publications]</a> |;

my ($genbank, $gb_count);
foreach  my $g  ( @{ $dbxrefs{'DB:GenBank_GI'} } )  {
  if ( $g->[1] eq '0' ) {
    my $url = $g->[0]->get_urlprefix() . $g->[0]->get_url();
    my $feature = CXGN::Chado::Feature->new_with_accession($dbh, $g->[0]->get_accession);
    my $gb_accession = $feature->get_name;
    my $description = $g->[0]->get_description();
    my $feature_seq = $feature->get_residues;
    my $blast_link = qq |
      <form style="display: inline" method="post" action="/tools/blast"><input type="hidden" name="seq" value=">$gb_accession ($description)\n$feature_seq" /><input style="padding: 1px; line-height: 0.8" type="submit" value="BLAST" /></form>
        |;

    $genbank .=
      qq|<a href="$url$gb_accession" target="blank">$gb_accession</a> $description $blast_link<br />|;
    $gb_count++;
  }
}
my $ont_count = $locus->count_ontology_annotations();

my $ontology_subtitle = $curator || $submitter || $sequencer  ?
  qq|<a href="javascript:Tools.toggleContent('associate_cvterm_form', 'locus_ontology')">[Add ontology annotations]</a> | :
  qq |<span class = "ghosted"> [Add ontology annotations]</span> |;

#line 207 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 209 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/util/import_javascript.mas', classes => ["jquery","jqueryui", "thickbox", "CXGN.Phenome.Locus", "CXGN.Phenome.Tools", "CXGN.Sunshine.NetworkBrowser"]   
); #line 209 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '


<script language="javascript">

   jQuery(document).ready(function() {
     jQuery("#genome_locus").autocomplete({
        source: \'/ajax/locus/genome_autocomplete\'
     });
  });

</script>


' );
#line 223 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/page/page_title.mas', title=> "$common_name locus ".$locus->get_locus_name   
); #line 223 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '


' );
#line 226 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 226 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '


' );
#line 229 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/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             => "/locus/$locus_id/view/",
    alternate_new_button => '<a class="btn btn-sm btn-default" href ="/locus/0/new">New</a>'
      
); #line 238 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
<table><tr><td>
      <table>
	<tr><td>

' );
#line 243 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/locus/synonym.mas',  locus_id=>"$locus_id" , synonyms=>\@synonyms   
); #line 243 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
</td></tr>

<tr><td>
' );
#line 247 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/phenome/display_owners.mas',
	 object_id => $locus_id,
	 object_type => "locus"
  
); #line 250 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
</td></tr>
<tr><td>
' );
#line 253 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/phenome/assign_owner.mas',
   object_id     => $locus_id,
   object_type   => "locus",
   owner_add_uri => "/ajax/locus/assign_owner",
   show_form     => $curator
  
); #line 258 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
</td></tr>
<tr><td>
' );
#line 261 "/home/production/cxgn/sgn/mason/locus/index.mas"
 if ($locus_id && $person_id) {
$m->print( '  <a href="/phenome/claim_locus_ownership.pl?locus_id=' );
#line 262 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print(  $locus_id  );
#line 262 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '&amp;action=confirm"> [Request editor privileges]</a><br /><br />
' );
#line 263 "/home/production/cxgn/sgn/mason/locus/index.mas"
 } elsif ( $locus_id ) {
$m->print( '  <span class="ghosted">[log-in to request editor privileges]</span><br />
' );
#line 265 "/home/production/cxgn/sgn/mason/locus/index.mas"
}
$m->comp(   '/locus/edits_info.mas', locus=>$locus    
); #line 266 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
        </td></tr>
      </table>
    </td>
    <td><table><tr><td>
 ' );
#line 271 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/locus/map_location.mas', person_id=>"$person_id", locus=>$locus    
); #line 271 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
  </td></tr></table></td></tr>
</table>

' );
#line 275 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas', title=>"Locus details" , subtitle => "$locus_xml | $editor_note | $guide_html"
 );
#line 275 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '


' );
#line 278 "/home/production/cxgn/sgn/mason/locus/index.mas"
 if($locus_id) {
$m->print( '

' );
#line 281 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 287 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 289 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print(  $tgrc  );
#line 289 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
' );
#line 290 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print(  $tair  );
#line 290 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
' );
#line 291 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print(  $phylogenes  );
#line 291 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
' );
#line 292 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print(  $tomDel  );
#line 292 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 294 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas',
    title     => "Links to external databases",
    subtitle  => "",
    id        => "locus_dbxrefs",
    collapsible => 1,
    is_subsection => 1,
 );
#line 294 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 296 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 302 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
    ' );
#line 303 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/locus/registry.mas', person_id=>"$person_id", locus_id=>"$locus_id", registry => $registry , is_owner => $is_owner   
); #line 303 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
' );
#line 304 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas',
    title       => "Registry name: $registry",
    subtitle    => $registry_subtitle,
    id          => "locus_registry",
    collapsible => 1,
    is_subsection => 1,
 );
#line 304 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 306 "/home/production/cxgn/sgn/mason/locus/index.mas"
 if($is_owner) {
$m->comp( { content => sub {
#line 307 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
       ' );
#line 308 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/locus/history.mas', locus=>$locus    
); #line 308 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
' );
#line 309 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas', title=>"Locus history", collapsible=>1, collapsed=>1
 );
#line 309 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 311 "/home/production/cxgn/sgn/mason/locus/index.mas"
 }
 if ( $locus_name && $curator ) {
$m->print( '  ' );
#line 313 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 313 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
       ' );
#line 314 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/locus/merge_locus.mas', locus_id=>"$locus_id" , common_name=>"$common_name"   
); #line 314 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

  ' );
#line 316 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas', title=>"Curator tools",  collapsible=>1, collapsed=>1
 );
#line 316 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
' );
#line 317 "/home/production/cxgn/sgn/mason/locus/index.mas"
 }
$m->print( '
 ' );
#line 319 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 319 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
   ' );
#line 320 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/image/print_images.mas', images=>\@figures , dbh=>$dbh   
); #line 320 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 322 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas', title=>"Notes and figures (" .  scalar(@figures)  . ")", subtitle => "$figure_subtitle", collapsible=>1, collapsed=>1
 );
#line 322 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 324 "/home/production/cxgn/sgn/mason/locus/index.mas"
#<&| /page/info_section.mas, title=>"eFP Browser links" &>
#
#   <& /locus/efp_browser_links.mas, locus => $locus &>
$m->print( '
' );
#line 328 "/home/production/cxgn/sgn/mason/locus/index.mas"
#</&>
$m->print( '
 ' );
#line 330 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 330 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
    ' );
#line 331 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/phenome/associate_accession_form.mas', locus_id=>$locus_id, person_id=>$person_id   
); #line 331 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
      ' );
#line 332 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/phenome/associated_accessions.mas', accessions=>$accessions, dbh=>$dbh   
); #line 332 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

 ' );
#line 334 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas', title=>"Accessions and images (" .  scalar(@$accessions)  . ")", subtitle => "$stock_subtitle", id=>"locus_accessions", collapsible=>1, collapsed=>1
 );
#line 334 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 336 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 336 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

   ' );
#line 338 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/phenome/allele.mas', alleles=>\@alleles, user_id=>$person_id, curator=>$curator   
); #line 338 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 340 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas', title=>"Alleles (" .  scalar(@alleles)  . ")", subtitle => "$allele_subtitle", collapsible=>1, collapsed=>1
 );
#line 340 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '


' );
#line 343 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 348 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

    ' );
#line 350 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/locus/associate_locus.mas', locus_id=>$locus_id   
); #line 350 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
     ' );
#line 351 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/locus/network.mas', locus_id => $locus_id    
); #line 351 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 353 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas',
  title       => "Associated loci (" .  $locus->count_associated_loci() . ")",
  subtitle    => "$al_subtitle",
  id          =>"locus_network",
  collapsible =>1,
  collapsed   =>1
 );
#line 353 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 355 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 360 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 362 "/home/production/cxgn/sgn/mason/locus/index.mas"
 print CXGN::Sunshine::Browser::include_on_page( 'locus', $locus_id ) if $network_sub ;
$m->print( '
' );
#line 364 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas',
   title       => "Associated loci - graphical view",
   subtitle    => $network_sub,
   collapsible => 1,
   collapsed   => $collapsed,
   id          => "graphic_locus_network"
 );
#line 364 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '


' );
#line 367 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 372 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
' );
#line 373 "/home/production/cxgn/sgn/mason/locus/index.mas"
 ## solcyc links are generated from the unigenes function in the ajax/locus controller ##
$m->print( '   <div id="solcyc" >[loading...]</div>
' );
#line 375 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas',
  title       => "SolCyc links",
  id          => "solcyc_links",
  collapsible => 1,
  collapsed   => 1,
 );
#line 375 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '


' );
#line 378 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 378 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
   ' );
#line 379 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 383 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
' );
#line 384 "/home/production/cxgn/sgn/mason/locus/index.mas"
if ($feature) {
$m->print( '      ' );
#line 385 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/locus/print_mrna_features.mas',
	feature   => $feature,
	blast_url => $blast_url,
      
); #line 388 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
' );
#line 389 "/home/production/cxgn/sgn/mason/locus/index.mas"
}
$m->print( '   ' );
#line 390 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas', title => "Genome features",
        collapsible   => 1,
        collapsed     => 0,
        is_subsection => 1,
 );
#line 390 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

    ' );
#line 392 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 396 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
       ' );
#line 397 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/feature/jbrowse_exact_match.mas', feature=> $feature, src_feature=> $src_feature   
); #line 397 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
   ' );
#line 398 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas', title => "Gene model matches",
        collapsible   => 1,
        collapsed     => 0,
        is_subsection => 1,
 );
#line 398 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

   ' );
#line 400 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 406 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
      ' );
#line 407 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/locus/associate_unigene.mas',
         locus_id    => $locus_id,
         common_name => $common_name,
         current     => 1
        
); #line 411 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
      ' );
#line 412 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/locus/locus_unigenes.mas', locus_id  => $locus_id    
); #line 412 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
  ' );
#line 413 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas', title => "SGN Unigenes",
        id => 'locus_unigenes',
        subtitle => $new_unigene_link,
        collapsible => 1,
        collapsed =>  1 ,
        is_subsection => 1,
 );
#line 413 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

  ' );
#line 415 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 420 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
         ' );
#line 421 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print(  $genbank  );
#line 421 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
 ' );
#line 422 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas', title => "GenBank accessions",
              subtitle => $new_genbank_link,
              collapsible => 1,
              collapsed =>  1 ,
              is_subsection => 1,
 );
#line 422 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

   ' );
#line 424 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 429 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

        ' );
#line 431 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/locus/locus_genomic_annotations.mas', locus => $locus   
); #line 431 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

   ' );
#line 433 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas',
       title         => "Other genome matches",
       collapsible   => 1,
       collapsed     => 1,
       is_subsection => 1,
 );
#line 433 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 435 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas', title=>"Sequence annotations" , collapsible=>1, collapsed=>0
 );
#line 435 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 437 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 437 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 439 "/home/production/cxgn/sgn/mason/locus/index.mas"
 foreach my $pub ( @$pubs ) {
$m->print( '  ' );
#line 440 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/chado/publication.mas', pub=>$pub   
); #line 440 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
  <br >
' );
#line 442 "/home/production/cxgn/sgn/mason/locus/index.mas"
 }
$m->print( '
' );
#line 444 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas', title=>"Literature annotations [" . scalar(@$pubs) ."]" , subtitle=>$pub_subtitle, id=>"publications" , collapsible=>1, collapsed=>1
 );
#line 444 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '


' );
#line 447 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 452 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
  ' );
#line 453 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/ontology/associate_ontology.mas',
    trait_db_name => $trait_db_name,
    object_id     => $locus_id ,
    object_name   => "locus",
    cvterm_add_uri=> $cvterm_add_uri,
    ontology_url  => "/locus/$locus_id/ontologies/",
    reference_uri => "/locus/$locus_id/references",
    evidence_with_uri => "/locus/$locus_id/evidences",
    show_form     => $is_owner    
); #line 461 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '
' );
#line 462 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas',
  title       =>"Ontology annotations ($ont_count)",
  id          => "locus_ontology",
  collapsible => 1,
  collapsed   => 1,
  subtitle    => $ontology_subtitle
 );
#line 462 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 464 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp( { content => sub {
#line 467 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

     ' );
#line 469 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/sitefeatures/mixed/xref_set/link.mas',
        xrefs => [ grep { $_->feature->feature_name ne 'gbrowse2' } @$xrefs ],
        
); #line 471 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 473 "/home/production/cxgn/sgn/mason/locus/index.mas"
} }, '/page/info_section.mas',
     title       => 'Related views',
     collapsible => 1,
 );
#line 473 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 475 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->comp(   '/page/comments.mas', object_type=>'locus', object_id=>$locus_id, referer=>$this_page   
); #line 475 "/home/production/cxgn/sgn/mason/locus/index.mas"
$m->print( '

' );
#line 477 "/home/production/cxgn/sgn/mason/locus/index.mas"
 }
;return;
},
'declared_args' => {
  '$blast_url' => { default => ' \'/tools/blast/\'' },
  '$cvterm_add_uri' => { default => ' \'\'' },
  '$cvterm_autocomplete_uri' => { default => ' undef' },
  '$locus_add_uri' => { default => ' \'\'' },
  '$locus_autocomplete_uri' => { default => ' undef' },
  '$locusref' => { default => ' undef' },
  '$trait_db_name' => { default => ' \'SP\'' }
},
'load_time' => 1763528902,

)
;