# $Id$

package Bio::EnsEMBL::Collection::Gene;

use strict;
use warnings;

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

#-----------------------------------------------------------------------
# Specialized protected methods from base class Bio::EnsEMBL::Collection
#-----------------------------------------------------------------------

sub _extra_tables { return ( [ 'gene_stable_id', 'gsi' ] ) }

sub _extra_columns {
  return ( 'g.biotype', 'g.status', 'gsi.stable_id' );
}

sub _extra_where_clause {
  return 'g.is_current = 1 AND g.gene_id = gsi.gene_id';
}

#-----------------------------------------------------------------------
# Implemented abstract protected methods from base class
# Bio::EnsEMBL::Collection
#-----------------------------------------------------------------------

sub _feature_table { return [ 'gene', 'g' ] }

1;

# $Id$

package Bio::EnsEMBL::Collection::Gene;

use strict;
use warnings;

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

#-----------------------------------------------------------------------
# Specialized protected methods from base class Bio::EnsEMBL::Collection
#-----------------------------------------------------------------------

sub _extra_tables {
  return ( [ 'gene_stable_id', 'gsi' ], [ 'xref', 'x' ] );
}

sub _extra_columns {
  return ( 'g.biotype', 'g.status', 'gsi.stable_id',
           'x.display_label' );
}

sub _extra_where_clause {
  return q(
        g.is_current  = 1
    AND g.gene_id     = gsi.gene_id
    AND x.xref_id     = g.display_xref_id
  );
}

#-----------------------------------------------------------------------
# Implemented abstract protected methods from base class
# Bio::EnsEMBL::Collection
#-----------------------------------------------------------------------

sub _feature_table { return [ 'gene', 'g' ] }

1;

Join with the xref table to get the xref.display_label.
Join with the xref table to get the xref.display_label.

A gene entry in a colleciton now contains:

  index contents

  5     gene.biotype
  6     gene.status
  7     gene_stable_id.stable_id
  8     xref.display_xref_id

(apart from the usual seq_region stuff in index 0-4).
