[Bioperl-l] fasta genbank record with gid

Pedro Antonio Reche reche at research.dfci.harvard.edu
Mon Jun 21 10:22:23 EDT 2004


Dear Jason, thanks a lot for the code. it worked great.
Best,

pdro
On Jun 19, 2004, at 10:46 AM, Jason Stajich wrote:

> (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
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
======================================================================== 
======
Pedro A Reche, PhD
Dana-Farber Cancer Institute  (D1510A)                                   
                                             TL: 617 632 3824
Harvard Medical School                                                   
                                                          FX: 617 632  
3351
44 Binney Street ,                                                       
                             EM: reche at research.dfci.harvard.edu
Boston, MA 02115, USA                                                    
                                        W3: www.mifoundation.org



More information about the Bioperl-l mailing list