Bio::DB::CUTG: move into its own distribution
[bioperl-live.git] / bin / bp_filter_search
blob9f1c7ca66aa233fa9787d86b46a82dbbabb20ac4
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
6 =head1 NAME
8 bp_filter_search - filters searchio results, outputting a tab delimited summary
10 =head1 SYNOPSIS
12 #bp_filter_search -format blast -score 200 < search.bl > search.tab
14 =head1 DESCRIPTION
16 This script filters searchio results allowing a number of different
17 filters to be applied before outputting to stdout in a tab delimited
18 format.
20 =head1 FEEDBACK
22 =head2 Mailing Lists
24 User feedback is an integral part of the evolution of this and other
25 Bioperl modules. Send your comments and suggestions preferably to
26 the Bioperl mailing list. Your participation is much appreciated.
28 bioperl-l@bioperl.org - General discussion
29 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
31 =head2 Reporting Bugs
33 Report bugs to the Bioperl bug tracking system to help us keep track
34 of the bugs and their resolution. Bug reports can be submitted via
35 email or the web:
37 https://github.com/bioperl/bioperl-live/issues
39 =head1 AUTHOR
41 Ewan Birney <birney@ebi.ac.uk>
43 =cut
45 use Bio::SearchIO;
46 use Getopt::Long;
48 my ($format,$score);
50 $format = 'blast';
51 $score = 150;
53 GetOptions(
54 'format:s' => \$format,
55 'score:s' => \$score,
59 my $searchin = Bio::SearchIO->new( -format => $format);
62 while( (my $result = $searchin->next_result()) ) {
63 while( (my $hit = $result->next_hit())) {
65 if( $score ) {
66 if( $hit->raw_score < $score ) {
67 next;
72 foreach my $hsp ( $hit->hsps() ) {
73 print $result->query_name,"\t",$hit->score,"\t",$hsp->start,"\t",$hsp->end,"\t",$hsp->strand,"\t",$hsp->hseq_id,"\t",$hsp->hstart,"\t",$hsp->hend,"\t",$hsp->strand,"\n";