[Bioperl-l] fasta genbank record with gid

Jason Stajich jason at cgt.duhs.duke.edu
Sat Jun 19 10:46:28 EDT 2004


(This only works if you have read in a format which has a GI field in it
like genbank)

$seq->display_id( sprintf("gi|%d|%s|%s", $seq->primary_id, $seq->display_id, $seq->accession_number));

--jason
On Fri, 18 Jun 2004, Pedro Antonio Reche wrote:

> Hi all,
> I am using the following code provided by Jason Stajich to download
> genbank fasta records:
> #!/usr/sbin/perl -w
> #
> # How to retrieve GenBank entries over the Web
> #
> # by Jason Stajich
> #
> use Bio::DB::GenPept;
> use Bio::SeqIO;
> my $gb = new Bio::DB::GenPept;
>
> my $seqout = new Bio::SeqIO(-fh => \*STDOUT, -format => 'fasta');
>
> my $seqio = $gb->get_Stream_by_id([ qw( 18606304 )]);
>
> while( defined ($seq = $seqio->next_seq )) {
>         $seqout->write_seq($seq);
> }
>
> When I do this I get the following:
>  >AAH22894 Thymic stromal lymphopoietin, isoform 2 [Homo sapiens].
> MKTKAALAIWCPGYSETQINATQAMKKRRKRKVTTNKCLEQVSQLQGLWRRFNRPLLKQQ
>
> which is nice but I wonder if it will be possible to include the GI
> number in the fasta header so that I would get something like this
>
>  >18606304|AAH22894 Thymic stromal lymphopoietin, isoform 2 [Homo sapiens].
> MKTKAALAIWCPGYSETQINATQAMKKRRKRKVTTNKCLEQVSQLQGLWRRFNRPLLKQQ
>
> Thanks in advance for any help.
> Regards,
>
> pdro
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu


More information about the Bioperl-l mailing list