Created
March 14, 2011 10:31
-
-
Save andrewyatz/868984 to your computer and use it in GitHub Desktop.
Code which looks for sequence regions in the Aedes database from Ensembl Metazoa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Bio::EnsEMBL::Registry; | |
Bio::EnsEMBL::Registry->load_registry_from_db( | |
-host=>'mysql.ebi.ac.uk', | |
-user=>'anonymous', | |
-port=>4157, | |
-db_version => 61 | |
); | |
my $name = 'Aedes aegypti'; | |
my $assembly = 'AaegL1'; | |
my $cs_name = 'supercontig'; | |
my $chromosome_name= 'supercont1.1'; | |
my $start_pos = 5248294; | |
my $end_pos = 5248380; | |
my $dba = Bio::EnsEMBL::Registry->get_DBAdaptor($name, 'core'); | |
my $sa = $dba->get_SliceAdaptor(); | |
#Showing what is available for this species | |
my $toplevel_slices = $sa->fetch_all('toplevel'); | |
my $seqlevel_slices = $sa->fetch_all('seqlevel'); | |
my %top_cs = map { $_->coord_system_name, 1 } @{$toplevel_slices}; | |
my %seq_cs = map { $_->coord_system_name, 1 } @{$seqlevel_slices}; | |
print 'Available toplevel coordinate systems: ', join(',', keys %top_cs), "\n"; | |
print 'Available seqlevel coordinate systems: ', join(',', keys %seq_cs), "\n"; | |
foreach my $s (@{$toplevel_slices}) { | |
print $s->name(), "\n"; | |
} | |
#Taking the values given originally to find a slice | |
print '=' x 20, "\n"; | |
my $region = $sa->fetch_by_region('toplevel', $chromosome_name, $start_pos, $end_pos); | |
print $region->name, "\n"; | |
#or can use the coord system name | |
$region = $sa->fetch_by_region($cs_name, $chromosome_name, $start_pos, $end_pos); | |
print $region->name, "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment