This file is indexed.

/usr/bin/search_overview is in libbio-graphics-perl 2.39-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/usr/bin/perl -w

eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
    if 0; # not running under some shell

=head1 NAME

search_overview -- Render a SearchIO parser report into a simple overview graphic

=head1 SYNOPSIS

search_overview -i filename [-f format] [-o outputfilename] [--labels]

=head1 DESCRIPTION

This script will take any Bio::SearchIO parseable report and turn it
into a simple overview graphic of the report.  For our purposes we are
assuming BLAST and the BLAST scores when assigning colors.  Output is
a PNG format file.

This is not intended to be an overly customized script, rather it
should probably just be either a quick and dirty look at a report or a
starting point for more complicated implementations.

The color is determined by the hit score which is currently pegged to the NCBI 
scheme which looks like this

 RED     E<gt>= 200 
 PURPLE  80-200
 GREEN   50-80
 BLUE    40-50
 BLACK   E<lt>40

Options:
 -i/--input        The input filename, otherwise input is assumed from STDIN
 -o/--output       The output filename, this is optional, if you do not
                   provide the output filename the script will create a file
                   using the name of the query sequence and will process
                   all the sequences in the file.  If an output filename
                   IS provided the script will only display an image for the 
                   first one.
 -f/--format       The SearchIO format parser to use, if not provided
                   SearchIO will guess based on the file extension.
 -l/--labels       Display the hit sequence name as a label in the overview.
                   For lots of sequences this will make the image very long
                   so by default it is turned off.

=head1 AUTHOR Jason Stajich

Jason Stajich, jason[-at-]open-bio[-dot-]org.

=cut

use strict;

use Bio::Graphics::Panel;
use Bio::Graphics::Feature;
use Bio::Graphics::FeatureFile;
use Bio::SearchIO;
use Getopt::Long;

use constant WIDTH          => 600;  # default width

my ($in,$format,$out);

my $showlabels = 0;

# This defines the color order
# For NCBI it is typically defined like this
# Score
# RED     >= 200 
# PURPLE  80-200
# GREEN   50-80
# BLUE    40-50
# BLACK   <40
my @COLORS = qw(red magenta green blue black);
my @SCORES = (200,80,50,40,0);

GetOptions(
	   'i|in|input:s'   => \$in,
	   'f|format:s'     => \$format,
	   'o|output:s'     => \$out,
	   'l|labels'       => \$showlabels
	   );


my $parser = new Bio::SearchIO(-file   => $in,
			       -format => $format);

while( my $r = $parser->next_result ) {

    my ($qname,$qlen) = ($r->query_name, $r->query_length);
    my $max = 0;
    my (@features,@configs);
    while(my $h = $r->next_hit ) {
	next if $h->num_hsps == 0;
	my ($left,$right) = ( $h->start('query'),
			      $h->end  ('query') );
	
	if( ! $qlen ) { 
	    $max = MAX($max,abs($right-$left));
	}
	my $bin = 0;
	my $score = $h->score;
	for my $s ( @SCORES ) {
	    last if( $score > $s);
	    $bin++;
	}
	push @features, Bio::Graphics::Feature->new(-start   => $left,
						    -stop     => $right,
						    -type    => 'similarity',
						    -name    => $h->name,
						    -desc    => $h->description
						    );
	push @configs, [ ( -glyph   => 'segments',  
			   -bgcolor => $COLORS[$bin],
			   -fgcolor => $COLORS[$bin],
			   -label   => $showlabels,
			   -height  => 1,
			   )];
						    
    }
    my $panel = Bio::Graphics::Panel->new(-length => $qlen || $max,
					  -bgcolor => 'white',
					  -pad_left=> 10,
					  -pad_right=> 10);
    $panel->add_track('arrow' => Bio::Graphics::Feature->new
		      (-start => 1,
		       -end   => $qlen || $max),
		      -bump   => 0,
		      -double => 1,
		      -tick   => 2,
		      );
    foreach my $f ( @features ) {
	my $c = shift @configs;
	$panel->add_track($f, @$c);
    }
    if( $out ) { 
	open(OUT,">$out") || die("cannot open $out: $!");
	binmode(OUT);
	print OUT $panel->png;
	close(OUT);
	if( $parser->result_count > 1 ) { 
	    print STDERR "only printing the first result, do not provide a outfile name if you want to see them all\n";
	}
	last;
    } else { 
	open(OUT, ">$qname.png") || die("$qname: $!");
	binmode(OUT);
	print OUT $panel->png;	
	close(OUT);
    }
}
 
sub MAX {return $_[0] < $_[1] ? $_[1] : $_[0] }
sub MIN {return $_[0] > $_[1] ? $_[1] : $_[0] }