<commit_before>package EnsEMBL::Web::Component::Location::Compara_AlignSliceSelector;

use strict;
use warnings;
no warnings "uninitialized";
use base qw(EnsEMBL::Web::Component::Location);
use CGI qw(escapeHTML);

sub _init {
  my $self = shift;
  $self->cacheable( 0 );
  $self->ajaxable(  0 );
}

sub content {
  my $self   = shift;
  my $url = $self->object->_url({}, 1 );
  my $extra_inputs;
  foreach(sort keys %{$url->[1]||{}}) {
    $extra_inputs .= sprintf '
      <input type="hidden" name="%s" value="%s" />', escapeHTML($_),escapeHTML($url->[1]{$_});
  }

  my $options = '';
  my $species = $ENV{'ENSEMBL_SPECIES'};
  my $align = $self->object->param('align');
## Get the compara database hash!

  my $h = $self->object->species_defs->multi_hash->{'DATABASE_COMPARA'};
  my %a = %{$h->{'ALIGNMENTS'}||{}};
  my %x = ();
  foreach my $aa ( keys %a ) {
    next unless $a{$aa}{'species'}{$species};
    my $T = keys %{$a{$aa}{'species'}||{}};
    $x{$aa} = [ $a{$aa}{'name'}, $T ];
  }

  foreach ( sort { $x{$b}[1]<=>$x{$a}[1] || $x{$a}[0] cmp $x{$a}[0] } keys %x ) {
    $options .= sprintf '
        <option name="align" value="%d" %s>%s</option>',
      escapeHTML($_),
      $_ eq $align ? ' selected="selected"' :'',
      escapeHTML( $x{$_}[0] );
  }
  
## Get the species in the alignment and turn on the approriate Synteny tracks!
  
  return sprintf qq(
  <div class="autocenter navbar" style="width:%spx; text-align:left" >
    <form action="%s" method="get"><div style="padding:2px;">
      <label for="align">Alignment:</label> <select name="align" id="align">%s
      </select>%s
      <input value="Go&gt;" type="submit" class="go-button" />
    </div></form>
  </div>),
    $self->image_width, 
    $url->[0],
    $options,
    $extra_inputs;
}


1;<commit_msg>added blank first line for when none is selected<commit_after>package EnsEMBL::Web::Component::Location::Compara_AlignSliceSelector;

use strict;
use warnings;
no warnings "uninitialized";
use base qw(EnsEMBL::Web::Component::Location);
use CGI qw(escapeHTML);

sub _init {
  my $self = shift;
  $self->cacheable( 0 );
  $self->ajaxable(  0 );
}

sub content {
  my $self   = shift;
  my $url = $self->object->_url({}, 1 );
  my $extra_inputs;
  foreach(sort keys %{$url->[1]||{}}) {
    $extra_inputs .= sprintf '
      <input type="hidden" name="%s" value="%s" />', escapeHTML($_),escapeHTML($url->[1]{$_});
  }

  my $options = '';
  my $species = $ENV{'ENSEMBL_SPECIES'};
  my $align = $self->object->param('align');
## Get the compara database hash!

  my $h = $self->object->species_defs->multi_hash->{'DATABASE_COMPARA'};
  my %a = %{$h->{'ALIGNMENTS'}||{}};
  my %x = ();
  foreach my $aa ( keys %a ) {
    next unless $a{$aa}{'species'}{$species};
    my $T = keys %{$a{$aa}{'species'}||{}};
    $x{$aa} = [ $a{$aa}{'name'}, $T ];
  }

  foreach ( sort { $x{$b}[1]<=>$x{$a}[1] || $x{$a}[0] cmp $x{$a}[0] } keys %x ) {
    $options .= sprintf '
        <option value="%d" %s>%s</option>',
      escapeHTML($_),
      $_ eq $align ? ' selected="selected"' :'',
      escapeHTML( $x{$_}[0] );
  }
  
## Get the species in the alignment and turn on the approriate Synteny tracks!
  
  return sprintf qq(
  <div class="autocenter navbar" style="width:%spx; text-align:left" >
    <form action="%s" method="get"><div stlye="padding:2px">
      <label for="align">Alignment:</label> <select name="align" id="align">
        <option value="">== select an alignment ==</option>%s
      </select>%s
      <input value="Go&gt;" type="submit" class="go-button" />
    </div></form>
  </div>),
    $self->image_width, 
    $url->[0],
    $options,
    $extra_inputs;
}


1;
{'fraction_non_alphanumeric': 0.22860267979217938, 'fraction_numerical': 0.007109652720809406, 'mean_word_length': 3.769230769230769, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6961615', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1373, 'n_words': 298}