package Bio::EnsEMBL::GlyphSet::_oligo;

use strict;

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

sub features { ## Hack in db in the future!!
  my ($self) = @_;
  $self->timer_push( 'Preped');
  my $T = $self->{'container'}->get_all_OligoFeatures( $self->my_config('array') );
  $self->timer_push( 'Retrieved oligos', undef, 'fetch' );
  return ( $self->my_config('array') => [$T] );
}

sub feature_group {
  my( $self, $f ) = @_;
  return $f->probeset;    ## For core features this is what the sequence name is...
}

sub feature_label {
  my( $self, $f ) = @_;
  return $f->probeset;
}

sub feature_title {
  my( $self, $f ) = @_;
  return "Probe set: ".$f->probeset;
}

sub href {
### Links to /Location/Feature with type of 'OligoProbe'
  my ($self, $f ) = @_;
  return $self->_url({
    'object' => 'Location',
    'action' => 'Genome',
    'db'     => $self->my_config('db'),
    'ftype'  => 'OligoFeature',
    'id'     => $f->probeset,
    'array'  => $self->my_config( 'caption' ),
  });
}

sub export_feature {
  my $self = shift;
  my ($feature, $source) = @_;
  return $self->_render_text($feature, 'Oligo', {
    'headers' => [ 'probeset' ],
    'values' => [ $feature->can('probeset') ? $feature->probeset : '' ]
  }, { 'source' => $source });
}

1;