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

View of /FigKernelPackages/ContigMD5.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Wed Mar 7 20:39:20 2007 UTC (13 years, 3 months ago) by olson
Branch: MAIN
little module to help compute contig checksum

package ContigMD5;

#
# Little class to normalize & compute contig MD5 checksums.
#
#
# We throw away > fasta identifier lines, as well as whitespace. It is
# incumbent on the user of this class to stop sending it data when the
# end of the sequence is reached.
#

use strict;
use Digest::MD5;

sub new
{
    my($class) = @_;

    my $self = {
	digest => new Digest::MD5->new(),
    };

    return bless $self, $class;
}

sub add
{
    my($self, $txt) = @_;

    $txt =~ s/^>[^\n]*\n//m;
    $txt = s/\s*//g;
    $self->{digest}->add(lc($txt));
}

sub checksum
{
    my($self) = @_;
    return $self->{digest}->hexdigest;
}
1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3