<commit_before>package EnsEMBL::Web::Component::UserData::SelectOutput;

use strict;
use warnings;
use warnings "uninitialized";

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

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

sub caption {
  my $self = shift;
  return '';
}


sub content {
  my $self = shift; 
  my $object = $self->object;
  my $html = "<h2>Stable ID Mapper</h2>";
  my $text = "Please select the format you would like your output in:";
  my $referer;
  if ($object->param('_referer')){ 
    $referer =  ';_referer='. $object->param('_referer');
  }
  my $extra_param = ';x_requested_with='.$object->param('x_requested_with');
  if ($object->param('_time')) { $extra_param.= ';_time='.$object->param('_time'); }                      
  my $convert_file;
  if ($object->param('convert_file')) {
    $convert_file = ';convert_file='.$object->param('convert_file');
  }
  if ($object->param('id_limit')) {
    $convert_file .=';id_limit=' .$object->param('id_limit');
  }
  my $species= ';species='.$object->param('species');
  my $html_url = '/'.$object->data_species.'/UserData/IDConversion?format=html' .$convert_file.$referer.$species;
  my $text_url = '/'.$object->data_species.'/UserData/MapIDs?format=text' .$convert_file.$referer.$extra_param.$species;
  my $list =  [
              '<a href='.$html_url.'>HTML</a>',
              '<a class="modal_link" href='.$text_url.'>Text</a> ',
  ];


  my $form = $self->modal_form('select', "/$object->data_species/UserData/IDMapper", { no_button => 1 });

  $form->add_fieldset;
  $form->add_notes({ class => undef, text => $text });
  $form->add_notes({ class => undef, list => $list });

  $html .= $form->render;
  return $html;
}


1;<commit_msg>modified to work with variaion consequence calculator<commit_after>package EnsEMBL::Web::Component::UserData::SelectOutput;

use strict;
use warnings;
use warnings "uninitialized";

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

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

sub caption {
  my $self = shift;
  return '';
}


sub content {
  my $self = shift; 
  my $object = $self->object;
  my ($html_target, $text_target, $title);
  

  if ($object->param('id_mapper') ) {
    $title = 'Stable ID Mapper';
    $html_target = 'IDConversion';
    $text_target = 'MapIDs';       
  } elsif ($object->param('consequence_mapper') ){
    $title = 'Consequence Calculator';  
    $html_target = 'ConsequenceCalculator';
    $text_target = 'SNPConsequence';
  }


  my $html = "<h2>$title</h2>";
  my $text = "Please select the format you would like your output in:";
  my $referer;
  if ($object->param('_referer')){ 
    $referer =  ';_referer='. $object->param('_referer');
  }
 
  my $extra_param = ';x_requested_with='.$object->param('x_requested_with');
  if ($object->param('_time')) { $extra_param.= ';_time='.$object->param('_time'); }                      
  my $convert_file;
  if ($object->param('convert_file')) {
    $convert_file = ';convert_file='.$object->param('convert_file');
  }
  if ($object->param('id_limit')) {
    $convert_file .=';id_limit=' .$object->param('id_limit');
  }
  my $species= ';species='.$object->param('species');
  my $html_url = '/'.$object->data_species.'/UserData/'.$html_target.'?format=html' .$convert_file.$referer.$species;
  my $text_url = '/'.$object->data_species.'/UserData/'.$text_target.'?format=text' .$convert_file.$referer.$extra_param.$species;
  my $list =  [
              '<a href='.$html_url.'>HTML</a>',
              '<a class="modal_link" href='.$text_url.'>Text</a> ',
  ];


  my $form = $self->modal_form('select', "/$object->data_species/UserData/IDMapper", { no_button => 1 });

  $form->add_fieldset;
  $form->add_notes({ class => undef, text => $text });
  $form->add_notes({ class => undef, list => $list });

  $html .= $form->render;
  return $html;
}


1;
{'fraction_non_alphanumeric': 0.20565749235474007, 'fraction_numerical': 0.0030581039755351682, 'mean_word_length': 3.8940149625935163, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 69, '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': '2137814', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1399, 'n_words': 260}