In fact, there is a hyperlink at the word CDS in the particular GenBank page of NCBI and when the link is clicked it shows the cds of the gene. Is it possible to get the cds sequence directly using a perl script....

It sounds to me like you have a website that provides the 'cds' already prepared and you are asking us if there is a way to download the text from the webpage. If that is the case then yes you can do that. Given an URL there are several ways to download a page. On *nix platforms you can use wget with the perl system function or with qx(). From Perl directly you can use the LWP::Simple module.

But it sounds like you need to give the number or name of the gene to get to the correct page before the CDS link appears. If that is the case you might be able to use WWW::Mechanize. It doesn't support JavaScript, hence the word 'might'. Are these pages open to the public? What is the CDS format? I didn't see it in a quick web search.

Edit: I found a few solutions here that seem to do part of what you are requesting.


In reply to Re: Is it possible to retrieve the coding sequence of a gene from NCBI GenBank database using perl ? by Lotus1
in thread Is it possible to retrieve the coding sequence of a gene from NCBI GenBank database using perl ? 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.