[Bioperl-l] add identifier to Bio::Seq object returned by fetch()

Jason Stajich jason at cgt.duhs.duke.edu
Wed May 21 18:27:12 EDT 2003


On Wed, 21 May 2003, Prachi Shah wrote:

> Hello everyone,
>
> I wanted to retrieve selected sequences from an
> indexed FASTA sequence file and write the sequences to
> an output file. The indexing is done with the
> Bio::Index::Fasta module. Everything works fine, but
> the problem is the returned Bio::Seq object from the
> fetch() call does not have the ID used to search the
> sequence. I would like to write the sequence to the
> output file in the full Fasta format with the
> identifier. For the snippet of code below, the
> write_seq() call simply writes the sequence without
> the "$key" part. Is there a way to add the identifier
> to the Bio::Seq object returned before writting it to
> a file with the write_seq.
>
> Thanks,
> Prachi.
>
> ########### code follows #################
> my $inx1 = Bio::Index::Fasta->new(
> '-filename' => $Index_File_Name1,
> '-write_flag' => 1);
> $inx1->id_parser(\&my_id_parser);
> $inx1->make_index($Seqfile1);
>
> my $out = Bio::SeqIO->new('-format' => 'Fasta','-file'
> => ">$clusterfile");

> my $seq = $inx1->fetch($key); # Returns Bio::Seq object

$seq->display_id($key);

> $out->write_seq($seq);
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
> _______________________________________________
> 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