<div dir="ltr"><div><div><div><div>Hi!<br><br></div>I'm having a stupid problem with my input file. I made a list of transcripts IDs in a csv file, open it, copied the list and pasted in a text file, UTF-8 in plain text, one transcript ID per  line, without any comma or quotes. The code is getting me an error <br><br>Can't call method "get_all_translateable_Exons" on an undefined value at ./transdom_RR.pl line 53, <$TX> line 1.<br><br></div>The same code is running on a previous text file with transcript IDs that I used for trial. If I copy and paste one of these transcript from the "old" file to the "new" one the code is running until the first "new" transcript ID. The transcript IDs that I used for trial are present also in my new csv list and if I copy and paste them from the csv to a new text file the code doesn't work. So I think the problem is somehow in the format of the transcript IDs in the excel file, I tried to convert the csv file into xlxs and also to change the format in general and in text, but it didn't work.<br></div>Do you have any suggestion? How should I prepare the txt input file for  the perl code?<br><br></div>thanks!<br><div><div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-05-19 16:23 GMT+02:00 Leila Alieh <span dir="ltr"><<a href="mailto:alieh.leila@gmail.com" target="_blank">alieh.leila@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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(<span class=""><br>-host => '<a href="http://ensembldb.ensembl.org" target="_blank">ensembldb.ensembl.org</a>' ,<br>-user => 'anonymous' ,<br>-port => '3306'<br>);<br><br></span>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);<span class=""><br><br>my $exons = $transcript->get_all_translateable_Exons();<br>foreach my $exon (@$exons) {<br></span>  print "Transcript " . $transcript->stable_id . "\t" ."Exon " . $exon->stable_id . ":" . $exon->start . "-" . $exon->end. "\t";<span class=""><br>  my @pep_coords = $transcript->genomic2pep($exon->start, $exon->end, $exon->strand);<br>  foreach my $pep (@pep_coords) {<br>  <br></span><span class="">    print $pep->start() . "-" . $pep->end() . "\n";<br>  }<br>}<br>my $translation = $transcript->translation;<br><br></span><span class="">if ($translation) {<br>  my $pfs = $translation->get_all_ProteinFeatures();<br> <br></span>  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="HOEnZb"><div class="h5"><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><br>
    <br>
    <div>On 16/05/2015 00:32, Leila Alieh wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div>
      <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><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" target="_blank">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>
</div></div></blockquote></div><br></div>