<commit_before># $Id$

package EnsEMBL::Web::Component::Location::SelectPopulation;

use strict;

use base qw(EnsEMBL::Web::Component::MultiSelector);

sub _init {
  my $self = shift;
 
  $self->SUPER::_init;
 
  $self->{'link_text'}       = 'Select populations';
  $self->{'included_header'} = 'Selected Populations';
  $self->{'excluded_header'} = 'Unselected Populations';
  $self->{'url_param'}       = 'pop';
}

sub content_ajax {
  my $self        = shift;
  my $hub         = $self->hub;
  my $object      = $self->object;
  my $params      = $hub->multi_params; 
  my $slice       = $hub->database('core')->get_SliceAdaptor->fetch_by_region($object->seq_region_type, $object->seq_region_name, 1, $object->seq_region_length, 1);
  my $ld_adaptor  = $hub->database('variation')->get_LDFeatureContainerAdaptor;
  my @populations = @{$ld_adaptor->get_populations_by_Slice($slice)};  
  my %shown       = map { $hub->param("pop$_") => $_ } grep s/^pop(\d+)$/$1/, $hub->param;
  my $next_id     = 1 + scalar keys %shown;
  my %available;
  $available{$_} = $_ for sort @populations;

  $self->{'all_options'}      = \%available;
  $self->{'included_options'} = \%shown;

  $self->SUPER::content_ajax;
}

1;
<commit_msg>populations are now keyed by id<commit_after># $Id$

package EnsEMBL::Web::Component::Location::SelectPopulation;

use strict;

use base qw(EnsEMBL::Web::Component::MultiSelector);

sub _init {
  my $self = shift;
 
  $self->SUPER::_init;
 
  $self->{'link_text'}       = 'Select populations';
  $self->{'included_header'} = 'Selected Populations';
  $self->{'excluded_header'} = 'Unselected Populations';
  $self->{'url_param'}       = 'pop';
}

sub content_ajax {
  my $self        = shift;
  my $hub         = $self->hub;
  my $object      = $self->object;
  my $params      = $hub->multi_params; 
  my $slice       = $hub->database('core')->get_SliceAdaptor->fetch_by_region($object->seq_region_type, $object->seq_region_name, 1, $object->seq_region_length, 1);
  my $ld_adaptor  = $hub->database('variation')->get_LDFeatureContainerAdaptor;
  my $populations = $ld_adaptor->get_populations_hash_by_Slice($slice);
  my %shown       = map { $hub->param("pop$_") => $_ } grep s/^pop(\d+)$/$1/, $hub->param;

  $self->{'all_options'}      = $populations;
  $self->{'included_options'} = \%shown;

  $self->SUPER::content_ajax;
}

1;

{'fraction_non_alphanumeric': 0.18726114649681527, 'fraction_numerical': 0.003821656050955414, 'mean_word_length': 4.002123142250531, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 49, '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': '6886586', 'n_tokens_mistral': 876, 'n_tokens_neox': 825, 'n_words': 149}