[ensembl-dev] flushing slice data from cache when using the ensembl perl API

David Gacquer dgacquer at ulb.ac.be
Wed Oct 13 14:21:42 BST 2010

  Dear all,

I am using a local copy of the hg18 ensembl_core database (v54, may 
2009) along with the v54 perl API. I have a list of genomic positions 
and for each of them, I am retrieving the corresponding overlapping 
genes and transcripts using the following code:

print "processing $chr:$start-$end\n";
my $slice_adaptor = $registry->get_adaptor( 'Human', 'Core', 'Slice' );
my $slice = $slice_adaptor->fetch_by_region('chromosome', $chr, $start, 
my $overlapping_genes = $slice->get_all_Genes();
print "number of overlapping genes: ".scalar @{$overlapping_genes}."\n";
while ( my $gene = shift @{$overlapping_genes} ) {
       print "gene stable id: ".$gene->stable_id()."\n";

I have a particular issue when the same genomic position appears several 
times in a row. All overlapping genes and transcripts are correctly 
found only the first time. Here is the output I get from the previous code:

 >processing chr2:224536830-224536835
 >number of overlapping genes: 1
 >gene stable id ENSG00000135900

 >processing chr2:224536830-224536835 #same genomic position as before
 >number of overlapping genes: 0

This seems to be a cache problem, because when getting a registry 
without caching ($registry->load_registry_from_db(......., -no_cache => 
1) the problem is solved but I am getting warning messages of the form: 
"You are using the API without caching most recent features. Performance 
might be affected". Also, when getting a new registry for each genomic 
position and using $registry->clear() before switching to the next one, 
the problem is also solved, but this does not seem to be the most 
efficient way to send queries in batch mode on my local ensembl database.

Is there a way to flush all cache data relative to a given slice without 
having to clear the registry ? Or at least, is it possible to deactivate 
the warning messages when using the -no_cache => 1 option from  
load_registry_from_db ?

Best regards


David Gacquer, Ph. D.

IRIBHM - Universite Libre de Bruxelles
Bldg C, room C.4.117
ULB, Campus Erasme, CP602
808 route de Lennik
B-1070 Brussels

Phone: +32-2-555 4187
Fax: +32-2-555 4655
E-mail: dgacquer at ulb.ac.be

More information about the Dev mailing list