~ubuntu-branches/ubuntu/lucid/bioperl/lucid

« back to all changes in this revision

Viewing changes to scripts/utilities/seq_length.PLS

  • Committer: Bazaar Package Importer
  • Author(s): Matt Hope
  • Date: 2004-04-18 14:24:11 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040418142411-gr92uexquw4w8liq
Tags: 1.4-1
* New upstream release
* Examples and working code are installed by default to usr/bin,
  this has been moved to usr/share/doc/bioperl/bin

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
 
 
3
=head1 NAME
 
4
 
 
5
seq_length.pl - lists the number of bases and number of sequences in specified sequence database files
 
6
 
 
7
=head1 SYNOPSIS
 
8
 
 
9
seq_length.pl *.fa
 
10
 
 
11
=head1 DESCRIPTION
 
12
 
 
13
seq_length.pl will report the total number of residues and total number of individual sequences contained within a specified sequence database file.
 
14
 
 
15
=head1 OPTIONS
 
16
 
 
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.
 
20
 
 
21
=head1 FEEDBACK
 
22
 
 
23
=head2 Mailing Lists
 
24
 
 
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.
 
28
 
 
29
  bioperl-l@bioperl.org              - General discussion
 
30
  http://bioperl.org/MailList.shtml  - About the mailing lists
 
31
 
 
32
=head2 Reporting Bugs
 
33
 
 
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
 
36
email or the web:
 
37
 
 
38
  bioperl-bugs@bioperl.org
 
39
  http://bioperl.org/bioperl-bugs/
 
40
 
 
41
=head1 AUTHOR - Jason Stajich
 
42
 
 
43
Jason Stajich E<lt>jason@bioperl.orgE<gt>
 
44
 
 
45
=cut
 
46
 
 
47
use strict;
 
48
use Bio::SeqIO;
 
49
use Getopt::Long;
 
50
 
 
51
my $format = 'fasta';
 
52
GetOptions('f|format:s' => \$format);
 
53
 
 
54
exec('perldoc',$0) unless @ARGV;
 
55
 
 
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++;
 
64
    }
 
65
    
 
66
    printf "%-10s %d bp $count sequences\n",$f,$len;
 
67
}