[Bioperl-l] Blasting multiple protein sequences.

Christopher Bottoms maizemu at gmail.com
Mon Apr 26 21:20:10 EDT 2010

The function blast_sequence only acts on a single sequence. You've passed it
an array of sequence objects. Try something more like the following. It's
not tested, but the principles should be correct, even if there is an error
or two:

my $fastafilename = 'protein.fa';

# reads an array of sequences
my @seq_object_array = read_all_sequences($fastafilename,'fasta');

#Number to allow outputting separate files for each sequence
my $report_number = 0;

#Iterate over each sequence object
for my $seq_object( @seq_object_array){

     #Get the blast report for this sequence object
     my $blast_report = blast_sequence($seq_object);

     #create a unique name for the output file (prepended with an '>')
     my $blast_out = '>blast_report_' . $report_number++ . '.out';

     #output the blast report
     write_blast($blast_out, $blast_report);


On Mon, Apr 26, 2010 at 7:56 PM, Chet Seligman <cseligman at earthlink.net>wrote:

> I am a student and new to BioPerl.
> I have a fasta formatted file with 17 protein sequences in it and I would
> like to blast them all.
> My problem is that only the first one gets blasted.
> Can anyone make a suggestion?
> Thanks in advance - Chet
> Here's my code:
> #!/usr/bin/perl
> use Bio::Perl;
> use strict;
> my $fastafilename = 'protein.fa';
> # reads an array of sequences
> my @seq_object_array = read_all_sequences($fastafilename,'fasta');
> # BLAST a sequence (assumes an internet connection)
> my  $blast_report = blast_sequence(@seq_object_array);
> write_blast(">blast.out",$blast_report);
> exit;
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

More information about the Bioperl-l mailing list