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

use strict;

use Bio::EnsEMBL::Gene;

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

sub _das_type {
  return "prediction_transcript";
}

sub _make_gene {
  my( $self, $transcript ) = @_;
  my $gene = new Bio::EnsEMBL::Gene();
  $gene->add_Transcript( $transcript );
  return $gene;
}

sub features {
  my $self = shift;
  my $slice = $self->{'container'};
  my $db_alias = $self->my_config('db');
  my $analyses = $self->my_config('logic_names');

  my @genes = map { $self->_make_gene($_) }
              map { @{$slice->get_all_PredictionTranscripts( $_, $db_alias )||[]} }
              @$analyses;
  return \@genes;
}

## Hacked url for prediction transcripts pt=xxx
sub href {
  my ($self, $gene, $transcript) = @_;
  my $db_alias = $self->my_config('db');
  return $self->_url({'type'=>'Transcript','action'=>'Summary','pt'=>$transcript->stable_id,'g'=>undef,'db'=>$db_alias});
}

sub export_feature {
  my $self = shift;
  my ($feature, $transcript_id, $source) = @_;
  
  return $self->_render_text($feature, "$source prediction", { 'headers' => [ 'transcript_id' ], 'values' => [ $transcript_id ] });
}

1;<commit_msg>fix features for new Glyphset_transcript methodology<commit_after>package Bio::EnsEMBL::GlyphSet::_prediction_transcript;

use strict;

use Bio::EnsEMBL::Gene;

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

sub _das_type { return 'prediction_transcript'; }

sub _make_gene {
  my ($self, $transcript) = @_;
  my $gene = new Bio::EnsEMBL::Gene;
  
  $gene->add_Transcript($transcript);
  $gene->stable_id($transcript->stable_id); # fake a stable id so that the data structures returned by features are correct.
  
  return $gene;
}

sub features {
  my $self     = shift;
  my $slice    = $self->{'container'};
  my $db_alias = $self->my_config('db');

  return $self->SUPER::features(map $self->_make_gene($_), map @{$slice->get_all_PredictionTranscripts($_, $db_alias) || []}, @{$self->my_config('logic_names')});
}

## Hacked url for prediction transcripts pt=xxx
sub href {
  my ($self, $gene, $transcript) = @_;
  
  return $self->_url({
    type   => 'Transcript',
    action => 'Summary',
    pt     => $transcript->stable_id,
    g      => undef,
    db     => $self->my_config('db')
  });
}

sub export_feature {
  my $self = shift;
  my ($feature, $transcript_id, $source) = @_;
  
  return $self->_render_text($feature, "$source prediction", { headers => [ 'transcript_id' ], values => [ $transcript_id ] });
}

1;
{'fraction_non_alphanumeric': 0.18278720884326885, 'fraction_numerical': 0.0007895775759968417, 'mean_word_length': 4.473002159827214, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 40, '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': '5447145', 'n_tokens_mistral': 945, 'n_tokens_neox': 885, 'n_words': 189}