[ensembl-dev] database access

Dan Staines dstaines at ebi.ac.uk
Thu Mar 14 15:42:32 GMT 2013


On 03/14/2013 02:49 PM, Gary Duncan wrote:
> here it is

Thanks - however, without the requisite input files etc. its hard to 
test properly, but the work of getting the registry loaded, and then 
getting the DBAdaptor and GeneAdaptor works fine, as does running 
through all protein_coding genes and executing your code to get introns 
(takes about 2-3 mins to run for me):

#Load all DBs from Ensembl Genomes
Bio::EnsEMBL::Registry->load_registry_from_db(
   -HOST => 'mysql.ebi.ac.uk',
   -PORT => 4157,
   -USER => 'anonymous',
   -verbose => 1
);

#Get the adaptors once
my $dba = Bio::EnsEMBL::Registry->get_DBAdaptor('Dictyostelium 
discoideum', 'core');
my $gene_adaptor = $dba->get_GeneAdaptor();

my @data;

for my $gene (@{$gene_adaptor->fetch_all_by_biotype('protein_coding')}) {
	foreach my $transcript (@{$gene->get_all_Transcripts()}) {
	   print $transcript->stable_id(), "\n";
		foreach my $intron (@{$transcript->get_all_Introns}) {
	    print $intron->seq_region_start.' - '.$intron->seq_region_end.' - 
'.$intron->seq. "\n";
		  #Store into a temporary array
		  push(@data, [
		    $transcript->stable_id(),
		    $intron->seq_region_start(),
		    $intron->seq_region_end(),
		    $intron->seq()
		  ]);
		}
	}
}

What version of the Ensembl API are you using? I used the current public 
branch (branch-ensembl-70) and all is fine (could be a bit faster to 
load the registry with branch-ensemblgenomes-17-70 but its a matter of 
~10s vs ~5s initial startup).

Dan.

-- 
Dan Staines, PhD               Ensembl Genomes Technical Coordinator
EMBL-EBI                       Tel: +44-(0)1223-492507
Wellcome Trust Genome Campus   Fax: +44-(0)1223-494468
Cambridge CB10 1SD, UK         http://www.ensemblgenomes.org/




More information about the Dev mailing list