As per Bio::DB::GenBank's documentation the function you are calling get_Seq_by_gi() returns a Bio::Seq object. Whose documentation is here Bio::Seq. In there it shows how to print the sequence, for example, using a method like : print $seq->seq()."\n";

That said, be warned that in your script you hammer in your '7157' ID to a remote service which expects GenBank's IDs (NM_000546.5). You do get a response which is garbage unfortunately as it relates to "Dictyostelium discoideum (Slime mold)" and not to "Homo Sapiens" - what's the difference one can ask (sidenote: more evidence that the old GIGO effect is deep-rooted into the heart of the lite "sciences").

In order to get the response you want you must supply the get_Seq_by_id() with this $id='NM_000546.5'. Then it remains to explore the documentation in order to extract what you want from that large (>100KB) dataset you just transfered from 4000km away across land and sea and possibly through aether.

If your main aim is to convert programmatically the ID 7157 to an ID understood by GenBank, e.g. NM_000546.5 then welcome to the club of gene id conversions. Probably a tenth of the net's transfers are to sites claiming to convert between the numerous ID standards imposed by bio-narcissi and fund-whores and desperate users who somewhere got lost in these standards or found that the mapping is not 1-1. I can not help you with that although, additionally to Bioperl, R (bioconductor) may offer you another lifeline.


In reply to Re: How to convert the NCBI Gene ID to GenBank ID? by bliako
in thread How to convert the NCBI Gene ID to GenBank ID? by supriyoch_2008

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.