Hi,<div><br></div><div>You would have to bare in mind, that this code would produce a redundant list of introns, as there can be multiple transcripts per gene, with shared introns/exons. You would either need to do some redundancy checks afterwards, or use the canonical_transcript() method instead.</div>
<div><br></div><div>Also, if using this method, doing the following would be more efficient:</div><div><br></div><div>my $transcripts = $gene->get_all_Transcripts();</div><meta charset="utf-8"><div>while (my $transcript = shift @{$transcripts}) {</div>
<div>     printf( "\tLooking at transcript '%s'\n", $transcript->stable_id() );</div><div><meta charset="utf-8"><div><br></div><div>     my $introns = $transcript->get_all_Introns();</div><meta charset="utf-8"><div>
<meta charset="utf-8"><div>     while (my $intron = shift @{$introns}) {</div></div><div>          printf( "\t\tIntron between %d and %d\n", $intron->start(), $intron->end() );</div><div>     }</div><div>}</div>
</div><div><br></div><div>Although personally I would do the following:</div><div><br></div><div><meta charset="utf-8"><div>my $transcript = $gene->canonical_transcript();</div><div>printf( "\tLooking at transcript '%s'\n", $transcript->stable_id() );</div>
<div><div><br></div><div>my $introns = $transcript->get_all_Introns();</div><div><div>while (my $intron = shift @{$introns}) {</div></div><div>     printf( "\t\tIntron between %d and %d\n", $intron->start(), $intron->end() );</div>
<div>}</div></div></div><div><br></div><div>Cheers,</div><div><br>Steve<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">You can not get the introns for a gene, but you may get them for each of<br>

its transcripts.  Like this, for example:<br>
<br>
  my $ga = $registry->get_adaptor( 'Homo sapiens', 'Core', 'Gene' );<br>
<br>
  my $gene = $ga->fetch_by_stable_id('ENSG00000139618');<br>
<br>
  printf( "Looking at gene '%s'\n", $gene->stable_id() );<br>
<br>
  foreach my $transcript ( @{ $gene->get_all_Transcripts() } ) {<br>
    printf( "\tLooking at transcript '%s'\n",<br>
            $transcript->stable_id() );<br>
<br>
    foreach my $intron ( @{ $transcript->get_all_Introns() } ) {<br>
      printf( "\t\tIntron between %d and %d\n",<br>
              $intron->start(), $intron->end() );<br>
    }<br>
  }<br>
<br>
Output:<br>
<br>
Looking at gene 'ENSG00000139618'<br>
        Looking at transcript 'ENST00000380152'<br>
                Intron between 32889805 and 32890558<br>
                Intron between 32890665 and 32893213<br>
                Intron between 32893463 and 32899212<br>
                Intron between 32899322 and 32900237<br>
                Intron between 32900288 and 32900378<br>
                Intron between 32900420 and 32900635<br>
                Intron between 32900751 and 32903579<br>
                Intron between 32903630 and 32905055<br>
                Intron between 32905168 and 32906408<br>
                Intron between 32907525 and 32910401<br>
                Intron between 32915334 and 32918694<br>
                Intron between 32918791 and 32920963<br>
                Intron between 32921034 and 32928997<br>
                Intron between 32929426 and 32930564<br>
                Intron between 32930747 and 32931878<br>
                Intron between 32932067 and 32936659<br>
                Intron between 32936831 and 32937315<br>
                Intron between 32937671 and 32944538<br>
                Intron between 32944695 and 32945092<br>
                Intron between 32945238 and 32950806<br>
                Intron between 32950929 and 32953453<br>
                Intron between 32953653 and 32953886<br>
                Intron between 32954051 and 32954143<br>
                Intron between 32954283 and 32968825<br>
                Intron between 32969071 and 32971034<br>
                Intron between 32971182 and 32972298<br>
        Looking at transcript 'ENST00000470094'<br>
                Intron between 32954051 and 32954143<br>
                Intron between 32954283 and 32968825<br>
                Intron between 32969071 and 32970127<br>
                Intron between 32970254 and 32971034<br>
                Intron between 32971182 and 32972298<br>
<br>
<br>
<br>
--<br>
Andreas K?h?ri, Ensembl Software Developer<br>
European Bioinformatics Institute (EMBL-EBI)<br>
Wellcome Trust Genome Campus<br>
Hinxton, Cambridge CB10 1SD, United Kingdom<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>