Reformat, correct docs, for legibility
[bioperl-live.git] / scripts / utilities / bp_seq_length.pl
blobfecf05d5636a7b86eed3a656120823671ba23df1
1 #!perl
3 =head1 NAME
5 bp_seq_length.pl - lists the number of bases and number of sequences in specified sequence database files
7 =head1 SYNOPSIS
9 bp_seq_length.pl *.fa
11 =head1 DESCRIPTION
13 bp_seq_length.pl will report the total number of residues and total number of individual sequences contained within a specified sequence database file.
15 =head1 OPTIONS
17 -f/--format - Specify the database format ('fasta' is default).
18 This script uses SeqIO and as such formats are
19 limited to those which SeqIO system supports.
21 =head1 FEEDBACK
23 =head2 Mailing Lists
25 User feedback is an integral part of the evolution of this and other
26 Bioperl modules. Send your comments and suggestions preferably to
27 the Bioperl mailing list. Your participation is much appreciated.
29 bioperl-l@bioperl.org - General discussion
30 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
32 =head2 Reporting Bugs
34 Report bugs to the Bioperl bug tracking system to help us keep track
35 of the bugs and their resolution. Bug reports can be submitted via the
36 web:
38 https://github.com/bioperl/bioperl-live/issues
40 =head1 AUTHOR - Jason Stajich
42 Jason Stajich E<lt>jason@bioperl.orgE<gt>
44 =cut
46 use strict;
47 use warnings;
48 use Bio::SeqIO;
49 use Getopt::Long;
51 my $format = 'fasta';
52 GetOptions('f|format:s' => \$format);
54 exec('perldoc',$0) unless @ARGV;
56 foreach my $f ( @ARGV ) {
57 my $in = new Bio::SeqIO(-file => $f,
58 -format => $format);
59 my $len = 0;
60 my $count = 0;
61 while( my $seq = $in->next_seq ) {
62 $len += $seq->length();
63 $count++;
66 printf "%-10s %d bp $count sequences\n",$f,$len;