[Bioperl-l] Output of a BLAST parse to text file

Zachariah Wylde zwyl001 at aucklanduni.ac.nz
Sat Mar 31 23:35:51 EDT 2012

Hi there,

I am very new to Bioperl, so excuse me if come across as simple! I need to
write a bioperl script to extract information from BLAST results.
The script needs to count how many  HSPs are on each mouse chromosome and
be written to a tab-separated table. I have this so far, but do not
understand how to
sort the information. I would much, appreciate if you could help me??

Yours sincerely,

Zac Wylde

use strict;
use warnings;
use lib "C:/Program Files (x86)/BioPerl";
use Bio::SearchIO;

my $infile = "Alignment_Ref_Seq.txt";
open INFILE, $infile or die "Cannot open $infile: $!";

my $outfile = "assignment2.txt";
open OUTFILE, ">$outfile" or die "Cannot open $outfile: $!";

my $parser = new Bio::SearchIO(-format => 'blast', -file =>

while (my $result = $parser->next_result){
while (my $hit = $result->next_hit){
while (my $hsp = $hit->next_hsp){
if ($hit->description =~ /(mus musculus)|(mouse)/i){
if ($hit->description =~ /chromosome (\w+)/){
print "Hit = ", $hit->name, " \t",
"chromosome = ", $1, " \t",
"HSPs = ", $hit->num_hsps, "\n";

close INFILE;
close OUTFILE;

#chromosome from

More information about the Bioperl-l mailing list