[Bioperl-l] add identifier to Bio::Seq object returned by fetch()
Prachi Shah
prachi_shroff at yahoo.com
Wed May 21 15:06:04 EDT 2003
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
$out->write_seq($seq);
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
More information about the Bioperl-l
mailing list