/usr/bin/bp_generate_histogram is in bioperl 1.6.924-1.
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 | #!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
use strict;
use warnings;
use lib '.','./blib','../../blib/lib';
use Bio::DB::GFF;
use Getopt::Long;
my $usage = <<USAGE;
Usage: $0 [options] feature_type1 feature_type2...
Dump out a GFF-formatted histogram of the density of the indicated set
of feature types.
Options:
--dsn <dsn> Data source (default dbi:mysql:test)
--adaptor <adaptor> Schema adaptor (default dbi::mysqlopt)
--user <user> Username for mysql authentication
--pass <password> Password for mysql authentication
--bin <bp> Bin size in base pairs.
--aggregator <list> Comma-separated list of aggregators
--sort Sort the resulting list by type and bin
--merge Merge features with same method but different sources
USAGE
;
my ($DSN,$ADAPTOR,$AGG,$USER,$PASSWORD,$BINSIZE,$SORT,$MERGE);
GetOptions ('dsn:s' => \$DSN,
'adaptor:s' => \$ADAPTOR,
'user:s' => \$USER,
'password:s' => \$PASSWORD,
'aggregators:s' => \$AGG,
'bin:i' => \$BINSIZE,
'sort' => \$SORT,
'merge' => \$MERGE,
) or die $usage;
my @types = @ARGV or die $usage;
# some local defaults
$DSN ||= 'dbi:mysql:test';
$ADAPTOR ||= 'dbi::mysqlopt';
$BINSIZE ||= 1_000_000; # 1 megabase bins
my @options;
push @options,(-user=>$USER) if defined $USER;
push @options,(-pass=>$PASSWORD) if defined $PASSWORD;
push @options,(-aggregator=>[split /\s+/,$AGG]) if defined $AGG;
my $db = Bio::DB::GFF->new(-adaptor=>$ADAPTOR,-dsn => $DSN,@options)
or die "Can't open database: ",Bio::DB::GFF->error,"\n";
my @features = $db->features(-binsize=>$BINSIZE,-types=>\@types);
if ($MERGE) {
my %MERGE;
for my $f (@features) {
my $name = $f->name;
my $class = $name->class;
$name =~ s/^(.+:.+):.+$/$1/;
$f->group(Bio::DB::GFF::Featname->new($class,$name));
my $source = $f->source;
$source =~ s/:.+$//;
$f->source($source);
if (my $already_there = $MERGE{$f->source,$f->abs_ref,$f->abs_start}) {
$already_there->score($already_there->score + $f->score);
} else {
$MERGE{$f->source,$f->abs_ref,$f->abs_start} = $f;
}
}
@features = values %MERGE;
}
# sort features by type, ref and start if requested
if ($SORT) {
@features = sort {
$a->type cmp $b->type
|| $a->abs_ref cmp $b->abs_ref
|| $a->start <=> $b->start
}
@features;
}
for my $f (@features) {
print $f->gff_string,"\n";
}
__END__
=head1 NAME
bp_generate_histogram.pl -- Generate a histogram of Bio::DB::GFF features
=head1 SYNOPSIS
bp_generate_histogram.pl -d gadfly variation gene:curated
=head1 DESCRIPTION
Use this utility to generate feature density histograms from
Bio::DB::GFF databases. The result is a GFF data file that is
suitable for loading with load_gff.pl.
=head2 OPTIONS
The following options are recognized:
Option Description
------ -----------
--dsn <dsn> Data source (default dbi:mysql:test)
--adaptor <adaptor> Schema adaptor (default dbi::mysqlopt)
--user <user> Username for mysql authentication
--pass <password> Password for mysql authentication
--aggregator <list> Comma-separated list of aggregators
=head1 BUGS
Please report them.
=head1 SEE ALSO
L<Bio::DB::GFF>
=head1 AUTHOR
Lincoln Stein E<lt>lstein@cshl.orgE<gt>
Copyright (c) 2001 Cold Spring Harbor Laboratory
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. See DISCLAIMER.txt for
disclaimers of warranty.
=cut
|