[Bioperl-l] Genome Scanning Question

Andreas Kähäri ak at ebi.ac.uk
Mon Sep 21 14:06:44 UTC 2009


On Thu, Sep 17, 2009 at 05:31:13PM -0700, Michael UNO wrote:
> 
> What objects & methods could be used if I wanted to determine if a gene is
> located at a specific location within a genome at the Ensembl database. For
> example, if given a coordinate (e.g. Canine Chr15:66,500,123) is there a
> method that will simply tell me "yes, there is a gene at this location". And
> can it tell what gene(s) are located at this coordinate?

Here's a basic script do do something like what you want to do, for a
specific species, chromosome, and region:

#!/usr/bin/perl -w

use strict;
use warnings;

use Bio::EnsEMBL::Registry;

my $registry = 'Bio::EnsEMBL::Registry';

$registry->load_registry_from_db(
  '-host' => 'ensembldb.ensembl.org',
  '-user' => 'anonymous'
);

my $species = 'Dog';

my ( $chrname, $chrstart, $chrend ) = ( '13', 40_500_000, 41_000_000 );

my $slice_adaptor = $registry->get_adaptor( $species, 'Core', 'Slice' );

my $slice =
  $slice_adaptor->fetch_by_region( 'Chromosome', $chrname, $chrstart,
  $chrend );

my @genes = @{ $slice->get_all_Genes() };

if ( !@genes ) {
  print("No genes on that interval\n");
} else {
  printf( "%d genes on the interval:\n", scalar(@genes) );
  foreach my $gene (@genes) {
    printf(
      "%s (%s) [%s,%s,%s]\n",
      $gene->stable_id(), $gene->external_name() || 'No external name',
      $gene->start(), $gene->end(), $gene->strand() );
  }
}


Are you aware of the ensembl-dev mailing list and of the ensembl
helpdesk at helpdesk at ensembl.org (or via the "he!p" button in the genome
browser itself)?


Regards,
Andreas


-- 
Andreas Kähäri, Ensembl Software Developer            ()[]()[]
European Bioinformatics Institute (EMBL-EBI)          []()[]()
Wellcome Trust Genome Campus, Hinxton                 ()[]()[]
Cambridge CB10 1SD, United Kingdom                    []()[]()



More information about the Bioperl-l mailing list