[ensembl-dev] gene centred info via slices

Felix Kokocinski fsk at sanger.ac.uk
Mon Oct 11 09:48:28 BST 2010


Bronwen Aken wrote:
> Hi Hardip,
> 
> At a glance your code looks fine. I'm not sure why it is slow. Are you 
> connecting to our MySQL (host ensembldb.ensembl.org 
> <http://ensembldb.ensembl.org> port 5306) or do you have local copies of 
> the databases?
> 
> If you are only interested in one biotype eg. protein-coding then you 
> could modify your gene-fetch query like:
> foreach my $gene (@{$slice->get_all_Genes(undef, undef, undef, undef, 
> 'protein_coding')}){
> 

just to add to this: For specific biotypes you could also do:
$genes = $slice->get_all_Genes_by_type($type);

Actually the "get_all_Genes" method seems to be much slower than before 
(on the human core db) than previously for me as well...

   Best, Felix



> Cheers,
> Bronwen
> 
> 
> On 11 Oct 2010, at 06:06, Hardip Patel wrote:
> 
>> Dear all
>>
>> I am trying to fetch gene centred information using following code. It 
>> takes a long time to extract information for all genes from human or 
>> mice at least.
>>
>> I was wondering if the following code could be optimized to get 
>> information faster.
>>
>> my $slice_adaptor = $registry->get_adaptor($spec, 'Core', 'slice');
>>   foreach my $slice (@{$slice_adaptor->fetch_all('toplevel')}){
>>     foreach my $gene (@{$slice->get_all_Genes}){
>>       foreach my $transcript (@{$gene->get_all_Transcripts}){
>>           foreach my $exon (@{$transcript->get_all_Exons}){
>>             ####get transcript, UTR, exon, and intron start and end in 
>> cDNA coordinates and genomic coordinates
>>         }
>>       }
>>     }
>> }
>> ------
>>
>> Regards
>>
>> -- 
>> Hardip R. Patel
>>




More information about the Dev mailing list