<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Abhishek,<br>
    <br>
    As Kieron mentioned, exon objects in ensembl have a
    coding_region_start() method.<br>
    <br>
    If, for the exons, you replace the feature->start() and
    feature->end() methods with feature->coding_region_start() and
    feature->coding_region_end(), you will get only the coding parts
    for each exon.<br>
    If the entire exon is non-coding, it will return undefined.<br>
    <br>
    <br>
    Hope that helps,<br>
    Magali<br>
    <br>
    <div class="moz-cite-prefix">On 07/02/13 17:30, Abhishek Niroula
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAO=3BLZ=aUYBxMwxLERPM1BMC44L+k60HKrzWruRh_0cxQoEBw@mail.gmail.com"
      type="cite">Thanks Kieron.<br>
      I have pasted my code in here which I used to extract the exon
      information. ensembl_gene_transcript_id.txt file contains Ensembl
      gene and ensembl transcript. For each transcript, I want to obtain
      corresponding genome co-ordinate for each amino acid position. I
      am not pretty sure if somebody has already done this.<br>
      <br>
      <br>
      #!/usr/bin/perl<br>
      <br>
      use strict;<br>
      use warnings;<br>
      use Bio::EnsEMBL::Registry;<br>
      use Data::Dumper;<br>
      <br>
      sub feature2string<br>
      {<br>
          my $feature = shift;<br>
      <br>
          my $stable_id  = $feature->stable_id();<br>
          my $seq_region = $feature->slice->seq_region_name();<br>
          my $start      = $feature->start();<br>
          my $end        = $feature->end();<br>
          my $strand     = $feature->strand();<br>
      <br>
          return sprintf( "%s: %s:%d-%d (%+d)",<br>
              $stable_id, $seq_region, $start, $end, $strand );<br>
      }<br>
      <br>
      my $registry = "Bio::EnsEMBL::Registry";<br>
      ## Load the databases into the registry<br>
      $registry->load_registry_from_db( -host =>'<a
        moz-do-not-send="true" href="http://ensembldb.ensembl.org">ensembldb.ensembl.org</a>',
      -user => 'anonymous' );<br>
      <br>
      my $gene_adaptor  = $registry->get_adaptor( 'Human', 'Core',
      'Transcript' );<br>
      <br>
      open MYFILE, "<ensembl_gene_transcript_id.txt" or die $!;<br>
      my @lines = <MYFILE>;<br>
      close (MYFILE);<br>
      foreach my $line (@lines){<br>
          print $line;<br>
          my $substring=substr($line,0,-1);<br>
          my @ids=split(/\|/,$substring);<br>
          my $transcript=$ids[1];<br>
          my $gene=$ids[0];<br>
      ### Open a file for each gene to write the exons<br>
          open (CDS, ">".$gene."_exon.txt") or die "open: $!";<br>
      <br>
      ### Now fetch all the exons for the transcript<br>
          my $geneobj=$gene_adaptor->fetch_by_stable_id($ids[1]);<br>
          my $cdsseq=$geneobj->translateable_seq();<br>
          open(CDSSEQ, ">".$gene.".fa") or die "open: $!";<br>
          print CDSSEQ ">".$gene."\n".$cdsseq."\n";<br>
          close (CDSSEQ);<br>
          my $exons=$geneobj->get_all_Exons();<br>
      ## Just to print the exons loop across the array<br>
          foreach my $exon ( @{ $exons } ) {<br>
              my $exon_info= feature2string($exon);<br>
              print CDS "".$exon_info."\n";<br>
          }<br>
          close (CDS);<br>
      }<br>
      <br>
      <br>
      <br>
      <br>
      <div class="gmail_quote">On Thu, Feb 7, 2013 at 6:13 PM, Kieron
        Taylor <span dir="ltr"><<a moz-do-not-send="true"
            href="mailto:ktaylor@ebi.ac.uk" target="_blank">ktaylor@ebi.ac.uk</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          Hi Abishek,<br>
          <br>
          We need you to provide more specifics in order to determine
          what the difficulty is.<br>
          <br>
          If you have Ensembl Exon objects, their coding_region_start()
          will inform you if the Exon does not code.<br>
          <br>
          We can be of more assistance if you can tell us more or
          provide code samples. There are several ways to approach the
          task and we wouldn't want to recommend the most difficult for
          you!<br>
          <br>
          Regards,<br>
          <br>
          -- <br>
          Kieron Taylor PhD.<br>
          Ensembl Core team<br>
          EBI
          <div>
            <div class="h5"><br>
              <br>
              <br>
              On 30/01/2013 15:15, Abhishek Niroula wrote:<br>
            </div>
          </div>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div>
              <div class="h5">
                Hello,<br>
                <br>
                I am trying to get genomic co-ordinates for translatable
                portion of some<br>
                human cdna sequences. I could succesfully extract the
                transcript start<br>
                and end coordinates and also coordinates for each exon
                in a transcript.<br>
                But, all the exons in a protein may not be translatable.
                I am stuck at<br>
                this point.<br>
                My goal is to check if a given genomic co-ordinate in a
                chromosome is<br>
                located in protein coding (translatable region) of the
                chromosome.<br>
                <br>
                Thanks for your effort in advance.<br>
                <br>
                --<br>
                Best Reagrds,<br>
                Abhishek Niroula<br>
                <br>
                <br>
              </div>
            </div>
            _______________________________________________<br>
            Dev mailing list    <a moz-do-not-send="true"
              href="mailto:Dev@ensembl.org" target="_blank">Dev@ensembl.org</a><br>
            Posting guidelines and subscribe/unsubscribe info: <a
              moz-do-not-send="true"
              href="http://lists.ensembl.org/mailman/listinfo/dev"
              target="_blank">http://lists.ensembl.org/mailman/listinfo/dev</a><br>
            Ensembl Blog: <a moz-do-not-send="true"
              href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a><br>
            <br>
          </blockquote>
          <br>
          <br>
          <br>
          _______________________________________________<br>
          Dev mailing list    <a moz-do-not-send="true"
            href="mailto:Dev@ensembl.org" target="_blank">Dev@ensembl.org</a><br>
          Posting guidelines and subscribe/unsubscribe info: <a
            moz-do-not-send="true"
            href="http://lists.ensembl.org/mailman/listinfo/dev"
            target="_blank">http://lists.ensembl.org/mailman/listinfo/dev</a><br>
          Ensembl Blog: <a moz-do-not-send="true"
            href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a><br>
        </blockquote>
      </div>
      <br>
      <br clear="all">
      <br>
      -- <br>
      Best Reagrds,
      <div>Abhishek Niroula</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Dev mailing list    <a class="moz-txt-link-abbreviated" href="mailto:Dev@ensembl.org">Dev@ensembl.org</a>
Posting guidelines and subscribe/unsubscribe info: <a class="moz-txt-link-freetext" href="http://lists.ensembl.org/mailman/listinfo/dev">http://lists.ensembl.org/mailman/listinfo/dev</a>
Ensembl Blog: <a class="moz-txt-link-freetext" href="http://www.ensembl.info/">http://www.ensembl.info/</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>