[Bio] / FigKernelPackages / ContigMD5.pm Repository:
ViewVC logotype

Annotation of /FigKernelPackages/ContigMD5.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

1 : olson 1.1 package ContigMD5;
2 :    
3 :     #
4 :     # Little class to normalize & compute contig MD5 checksums.
5 :     #
6 :     #
7 :     # We throw away > fasta identifier lines, as well as whitespace. It is
8 :     # incumbent on the user of this class to stop sending it data when the
9 :     # end of the sequence is reached.
10 :     #
11 :    
12 :     use strict;
13 :     use Digest::MD5;
14 :    
15 :     sub new
16 :     {
17 :     my($class) = @_;
18 :    
19 :     my $self = {
20 :     digest => new Digest::MD5->new(),
21 :     };
22 :    
23 :     return bless $self, $class;
24 :     }
25 :    
26 :     sub add
27 :     {
28 :     my($self, $txt) = @_;
29 :    
30 :     $txt =~ s/^>[^\n]*\n//m;
31 : olson 1.2 $txt =~ s/\s*//g;
32 : olson 1.1 $self->{digest}->add(lc($txt));
33 :     }
34 :    
35 :     sub checksum
36 :     {
37 :     my($self) = @_;
38 :     return $self->{digest}->hexdigest;
39 :     }
40 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3