Quantcast
Channel: Post Feed
Viewing all articles
Browse latest Browse all 41826

Errors In A Bioperl Script, Please Help Me To Have A Check, Thanks In Advance!

$
0
0
Dear friends: I have a blast report, and want to extract following information for each result(query): the Query_name, hit_number, name and description of the hit(HSP) with the highest identity. my bioperl script is: #!/usr/bin/perl -w use strict; use warnings; use Bio::SearchIO; if (@ARGV != 2){die "Usage: $0 <BLAST-report-file> <output-file>\n"}; my ($infile,$outfile) = @ARGV; print "Parsing the BLAST result ..."; my $blast = new Bio::SearchIO( -format => 'blast', -file => $infile); open (OUT,">$outfile") or die "Cannot open $outfile: $!"; print OUT "query\tNumber of hits\tGreatest identity %\tAccession (identity %)\tDescription (identity %)\n"; while (my $result = $blast->next_result){ print OUT $result->query_name . "\t"; print OUT $result->num_hits. "\t"; # don't need the '&': if (my $hit = sort_hit($result)) if (my $hit = &sort_hit($result)){ if (my $hsp = $hit->hsp){ print OUT $hsp->percent_identity. "\t"; print OUT $hit->accession. "\t"; print OUT $hit->description. "\n"; } } } close OUT; print " DONE!!!\n"; # the problem starts here: # no matter what, this function will always return the first hit sub sort_hit{ my $result = shift; ...

Viewing all articles
Browse latest Browse all 41826

Trending Articles