<div dir="ltr"><div><div>Thank you very much!!!<br><br></div>Magali, your code has been really helpful, i just modified it to read the list of transcript IDs from a text file. Here is the version I'm using in case you want to check (but it seems it's working fine) and someone else will need it<br><br>#!/usr/bin/perl<br><br>use strict;<br>use warnings;<br>use Bio::EnsEMBL::Registry;<br><br>my $registry = 'Bio::EnsEMBL::Registry' ;<br><br>$registry->load_registry_from_db(<br>-host => '<a href="http://ensembldb.ensembl.org">ensembldb.ensembl.org</a>' ,<br>-user => 'anonymous' ,<br>-port => '3306'<br>);<br><br>my $transcript_adaptor = $registry->get_adaptor( 'mouse', 'core', 'Transcript');<br>my $txinput= 'tx_test.txt' ;<br>open my $TX, $txinput or die $!;<br>my @data= <$TX> ;<br>foreach my $line(@data) <br><br>{<br>$line=~s/ //g;<br>$line=~s/\t//g;<br>$   line=~s/\n//g;<br><br>my $transcript = $transcript_adaptor->fetch_by_stable_id($line);<br><br>my $exons = $transcript->get_all_translateable_Exons();<br>foreach my $exon (@$exons) {<br>  print "Transcript " . $transcript->stable_id . "\t" ."Exon " . $exon->stable_id . ":" . $exon->start . "-" . $exon->end. "\t";<br>  my @pep_coords = $transcript->genomic2pep($exon->start, $exon->end, $exon->strand);<br>  foreach my $pep (@pep_coords) {<br>  <br>    print $pep->start() . "-" . $pep->end() . "\n";<br>  }<br>}<br>my $translation = $transcript->translation;<br><br>if ($translation) {<br>  my $pfs = $translation->get_all_ProteinFeatures();<br> <br>  foreach my $pf (@$pfs) {<br>    print "Transcript " . $transcript->stable_id ."\t" . "Domain ". $pf->hseqname . ":" .  $pf->start . "-" . $pf->end . "\n";<br>  }<br>}<br>}<br>close $TX;<br><br></div>Thanks again!<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-05-18 16:01 GMT+02:00 mag <span dir="ltr"><<a href="mailto:mr6@ebi.ac.uk" target="_blank">mr6@ebi.ac.uk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hi Leila,<br>
    <br>
    For a given transcript, you can access all its exons and its
    translation (when available) with related protein features.<br>
    <br>
    This snippet of code shows how you can display protein coordinates
    for all exons and protein domains for the related translation,
    starting from a given transcript:<br>
    <br>
    my $registry = Bio::EnsEMBL::Registry->load_registry_from_db(<br>
    -host => '<a href="http://ensembldb.ensembl.org" target="_blank">ensembldb.ensembl.org</a>',<br>
    -user => 'anonymous',<br>
    -port => '3306'<br>
    );<br>
    <br>
    my $transcript_adaptor = $registry->get_adaptor('human', 'core',
    'Transcript');<br>
    my $stable_id = 'ENST00000380152';<br>
    my $transcript =
    $transcript_adaptor->fetch_by_stable_id($stable_id);<br>
    <br>
    # Only get exons within the coding region<br>
    my $exons = $transcript->get_all_translateable_Exons();<br>
    foreach my $exon (@$exons) {<br>
      # Print the genomic coordinates for each exon<br>
      print "Exon " . $exon->stable_id . ":" . $exon->start . "-"
    . $exon->end. "\t";<br>
      my @pep_coords = $transcript->genomic2pep($exon->start,
    $exon->end, $exon->strand);<br>
      foreach my $pep (@pep_coords) {<br>
        # Print the protein coordinates for each exon<br>
        print $pep->start() . "-" . $pep->end() . "\n";<br>
      }<br>
    }<br>
    <br>
    my $translation = $transcript->translation;<br>
    # Check if there is a translation<br>
    if ($translation) {<br>
      my $pfs = $translation->get_all_ProteinFeatures();<br>
      # Display all protein features<br>
      foreach my $pf (@$pfs) {<br>
        print $pf->hseqname . ":" .  $pf->start . "-" .
    $pf->end . "\n";<br>
      }<br>
    }<br>
    <br>
    <br>
    If you only have exon coordinates to start with, you will need to
    create a slice for each set of coordinates, then retrieve
    transcripts overlapping that slice and use the process described
    above.<br>
    <br>
    my $slice_adaptor = $registry->get_adaptor('human', 'core',
    'Slice');<br>
    my $slice = $slice_adaptor->fetch_by_region('chromosome',
    $chromosome, $exon_start, $exon_end);<br>
    my $transcripts = $slice->get_all_Transcripts();<br>
    <br>
    <br>
    Hope that helps,<br>
    Magali<div><div class="h5"><br>
    <br>
    <div>On 16/05/2015 00:32, Leila Alieh wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>Hi all!<br>
                  <br>
                </div>
                I have a list of genomic coordinates of exons and I want
                to transform them into protein coordinates of the
                different protein isoforms these exons belong to.
                Moreover I want to find the protein coordinates of the
                domains of these proteins, and then overlap the 2 sets
                of information to find exons which encode for protein
                domains. For what I read the (only?) way to do so is to
                use the Perl API of ensembl, and in particular  I should
                use TranscriptMapper and ProteinFeauture, right? I read
                the the tutorial and the documentation but I still find
                it very difficult to understand the API and I don't
                knowhow to write the code in a way to restrict the query
                only to my list of exons/proteins. Could you please show
                me some examples? In particular I'd like to know what
                Greg did to find the protein coordinates of the protein
                domains (<a href="http://lists.ensembl.org/pipermail/dev/2015-April/011013.html" target="_blank">http://lists.ensembl.org/pipermail/dev/2015-April/011013.html</a>).<br>
              </div>
              <br>
            </div>
            Thank you in advance and I apologize if I did some mistake
            in the thread, it's the first time that I'm using the
            ensembl mailing list.<br>
            <br>
          </div>
          P.S. Please, please, please, make the protein coordinates
          accessible in Ensembl gene mart as soon as possible, it would
          save a lot of work/time<br>
          <br>
        </div>
        Thanks again!<br>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><span class=""><pre>_______________________________________________
Dev mailing list    <a href="mailto:Dev@ensembl.org" target="_blank">Dev@ensembl.org</a>
Posting guidelines and subscribe/unsubscribe info: <a href="http://lists.ensembl.org/mailman/listinfo/dev" target="_blank">http://lists.ensembl.org/mailman/listinfo/dev</a>
Ensembl Blog: <a href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a>
</pre>
    </span></blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
Dev mailing list    <a href="mailto:Dev@ensembl.org">Dev@ensembl.org</a><br>
Posting guidelines and subscribe/unsubscribe info: <a href="http://lists.ensembl.org/mailman/listinfo/dev" target="_blank">http://lists.ensembl.org/mailman/listinfo/dev</a><br>
Ensembl Blog: <a href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a><br>
<br></blockquote></div><br></div>