/usr/bin/bp_dbsplit is in bioperl 1.6.923-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 | #!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
#-*-Perl-*-
=head1 NAME
bp_dbsplit - script to split an input set of database(s) into smaller pieces
=head1 SYNOPSIS
bp_dbsplit.PLS --size 50 [-i inputfile] [-if inputformat] [-of outputformat]
[--prefix outputprefix] [ < file1 file 2 OR file1 file2]
=head1 DESCRIPTION
This script will take as input a list of filenames or a single file or
from STDIN a sequence database and split the database into separate
files of X numbers of sequences. You specify X with the C<--size/-s>
parameter. The input and output sequence format is any that is
supported by bioperl (fasta,embl,genbank,gcg, swissprot, etc).
You can specify the input data either as a single file with -i
filename, or as a single file as an argument like
% bp_dbsplit file1 file2
or as a list of sequence data with
% cat file1 file2 file3 | bp_dbsplit
You'll want to use the C<--prefix> to specify what the output prefix will
be.
=head1 FEEDBACK
=head2 Mailing Lists
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to
the Bioperl mailing list. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
=head2 Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution. Bug reports can be submitted via
the web:
https://redmine.open-bio.org/projects/bioperl/
=head1 AUTHOR
Jason Stajich, jason-at-bioperl-dot-org
=cut
use strict;
use warnings;
use Bio::SeqIO;
use Bio::SeqIO::MultiFile;
use Getopt::Long;
my $dbsize = 100;
my $prefix;
my ($informat,$outformat,$infile) = ( 'fasta', 'fasta');
GetOptions (
's|size:s' => \$dbsize,
'if:s' => \$informat,
'of:s' => \$outformat,
'i:s' => \$infile,
'p|prefix:s' => \$prefix,
);
if( @ARGV == 1 ) {
$infile = shift @ARGV;
}
$prefix ||= $infile || $ARGV[0] || 'db';
my $in;
if( @ARGV ) {
$in = new Bio::SeqIO::MultiFile(-files => [@ARGV],
-format => $informat || 'fasta');
} elsif( $infile ) {
$in = new Bio::SeqIO(-file => $infile,
-format=> $informat);
} else {
$in = new Bio::SeqIO(-format=> $informat);
}
my $count = 1;
my $out = new Bio::SeqIO(-format => $outformat,
-file => ">$prefix.$count");
my $scount = 0;
while( my $seq = $in->next_seq ) {
if( ++$scount > $dbsize && $count ) {
$out->close();
undef($out);
$count++;
$out = new Bio::SeqIO(-format => $outformat,
-file => ">$prefix.$count");
$scount = 1;
}
$out->write_seq($seq);
}
__END__
|