in reply to Get Fasta file with Protein Sequences given a file with Genbank Ids using Perl
The documentation for Bio::DB::GenBank states that the set_Seq_by_id method takes only one argument which is the id (as a string) of a sequence. It does not appear that you can supply a list of sequences as the argument.
So, if you want to write multiple sequences you will need to do something like this:
Note that I changed the write mode from > to >> in order to append to the file. So, you should delete any old roar.fa file that may exist before running the script again.foreach my $id (@lines) { my $seq = $gb->get_Seq_by_id($id); write_sequence( ">>roar.fa", 'fasta', $seq ); }
|
|---|