<commit_before>package Bio::EnsEMBL::GlyphSet::P_variation;

use strict;

use base qw(Bio::EnsEMBL::GlyphSet);

sub my_colour {
  my ($self, $key) = @_;
  $self->{'colour_map'} ||= $self->{'config'}->species_defs->colour('variation');
  return map $self->{'colour_map'}->{lc $key}->{$_}, qw(default text);
}

sub _init {
  my $self = shift;
  
  return $self->render_text if $self->{'text_export'};
  
  my $config     = $self->{'config'};
  my $snps       = $self->cache('image_snps');
  my $h          = $self->my_config('height') || 4; 
  my $pix_per_bp = $self->scalex;
  my $t_width    = $h * 0.75 / $pix_per_bp;
  
  $self->_init_bump(undef,  $self->my_config('depth') || 1e6);

  return unless $snps;
  
  foreach my $snp (@$snps) {
    my $x = $snp->{'position'};
    my ($colour, $legend) = $self->my_colour($snp->{'type'});
    
    if ($snp->{'indel'}) {
      my ($y, $end, $direction) = $snp->{'indel'} eq 'insert' ? ($h, 1, 'down') : (0, $snp->{'length'} - 1, 'up');
      my $pos    = $x . ($end ? '-' . ($x + $end) : '');
      my $type   = ucfirst $snp->{'indel'};
      
      my ($glyph, $zmenu) = $self->Triangle({<commit_msg>Checks if the track concerns somatic variations or not.<commit_after>package Bio::EnsEMBL::GlyphSet::P_variation;

use strict;

use base qw(Bio::EnsEMBL::GlyphSet);


sub my_label { 
  my $self = shift;  
  my $label = $self->{'my_config'}->id =~/somatic/ ?'Somatic Mutations' : 'Variations'; 
  return $label; 
}


sub my_colour {
  my ($self, $key) = @_;
  $self->{'colour_map'} ||= $self->{'config'}->species_defs->colour('variation');
  return map $self->{'colour_map'}->{lc $key}->{$_}, qw(default text);
}

sub _init {
  my $self = shift;
  
  return $self->render_text if $self->{'text_export'};
  
  my $config     = $self->{'config'};
  my $snps       = $self->cache('image_snps');
  my $h          = $self->my_config('height') || 4; 
  my $pix_per_bp = $self->scalex;
  my $t_width    = $h * 0.75 / $pix_per_bp;
  
  $self->_init_bump(undef,  $self->my_config('depth') || 1e6);

  return unless $snps;
  
	my $is_somatic = $self->{'my_config'}->id =~/somatic/ ? 1 : 0;
	
  foreach my $snp (@$snps) {
		next if ($snp->{'vf'}->is_somatic != $is_somatic);
    my $x = $snp->{'position'};
    my ($colour, $legend) = $self->my_colour($snp->{'type'});
    
    if ($snp->{'indel'}) {
      my ($y, $end, $direction) = $snp->{'indel'} eq 'insert' ? ($h, 1, 'down') : (0, $snp->{'length'} - 1, 'up');
      my $pos    = $x . ($end ? '-' . ($x + $end) : '');
      my $type   = ucfirst $snp->{'indel'};
      
      my ($glyph, $zmenu) = $self->Triangle({
{'fraction_non_alphanumeric': 0.24087591240875914, 'fraction_numerical': 0.00768344218209758, 'mean_word_length': 3.173076923076923, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 55, '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': '1876488', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1061, 'n_words': 219}