Hi Andrea,<div><br></div><div>I'm not sure about the solution to your problem yet, I will have to do some investigating, but I can recommend a way to reduce your dataset. You are currently retrieving all exons for each transcript for each gene, which actually returns a redundant set of exons, as exons can be shared between transcripts. A better way to do this would be to either use the canonical transcript method e.g. $c_transcript = $gene->canonical_transcript(); and the $c_transcript->get_all_Exons(); or even better just called $gene->get_all_Exons? Or do you need the transcripts?</div>
<div><br></div><div>Perhaps I am missing the point, but I wonder if it can't be done using seq_region_name and checking for overlaps? I find this link particularly useful when trying to understand the more intricate functions of the API - <a href="http://www.ensembl.org/info/docs/Pdoc/ensembl/index.html">http://www.ensembl.org/info/docs/Pdoc/ensembl/index.html</a>.</div>
<div><br></div><div>Cheers,<br><br>Steve<br><br><div class="gmail_quote">On 12 January 2011 10:43,  <span dir="ltr"><<a href="mailto:dev-request@ensembl.org">dev-request@ensembl.org</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Date: Tue, 11 Jan 2011 19:38:02 +0000<br>
From: Andrea Edwards <<a href="mailto:edwardsa@cs.man.ac.uk">edwardsa@cs.man.ac.uk</a>><br>
Subject: [ensembl-dev] getting gene exons and transcripts that overlap<br>
        only the original slice<br>
To: <a href="mailto:Dev@ensembl.org">Dev@ensembl.org</a><br>
Message-ID: <<a href="mailto:4D2CB19A.7010501@cs.man.ac.uk">4D2CB19A.7010501@cs.man.ac.uk</a>><br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
Hello<br>
<br>
i have this code below taken from the core api tutorial which gets me<br>
all the exons and transcripts for the gene(s) that overlap a slice.<br>
<br>
  I was hoping for an easy way to get those features of the gene that<br>
only overlap the original one bp slice; this code gets all exons and<br>
transcripts<br>
associated with the gene<br>
<br>
I thought you might be able to call 'get_all_Object' methods with a<br>
parameter which represents a region of sequence overlap but it seems not.<br>
I also thought they might be filtered automatically based on the<br>
underlying slice but it seems not.<br>
<br>
Naturally i can filter the features in the list based on their start and<br>
end positions but for speed it would be easier not to retrieve them all at.<br>
I have a lot of data so speed is important. Please can you advise the<br>
best way to do this.<br>
<br>
$slice = $slice_adaptor->fetch_by_region( 'chromosome', '9', 21816758,<br>
21816758 );<br>
<br>
my $genes = $slice->get_all_Genes();<br>
while ( my $gene = shift @{$genes} ) {<br>
     my $gstring = feature2string($gene);<br>
     print "$gstring\n";<br>
<br>
     my $transcripts = $gene->get_all_Transcripts();<br>
     while ( my $transcript = shift @{$transcripts} ) {<br>
         my $tstring = feature2string($transcript);<br>
         print "\t$tstring\n";<br>
<br>
         foreach my $exon ( @{ $transcript->get_all_Exons() } ) {<br>
             my $estring = feature2string($exon);<br>
             print "\t\t$estring\n";<br>
         }<br>
     }<br>
}<br>
<br>
print "done\n";<br>
<br>
Many thanks<br>
<br>
<br><br></blockquote><div> </div></div>-- <br>Kindest regards,<br><br>Steve Moss<br><a href="http://stevemoss.ath.cx" target="_blank">http://stevemoss.ath.cx</a><br>
</div>