NAME

fHGT::Distance.pm - package for distance and closeness manipulation in fHGT.


SYNOPSIS

The pairwise closeness matrix is represented as a hash array. Distances are defined as -log($closeness). The hash array should be accessed only through the subroutines defined here.


DESCRIPTION


Alphabets

The following alphabets are defined.

        fHGT::Distance::@DNA_ALPHABET = ('A', 'C', 'G', 'T');
        fHGT::Distance::@BINARY_ALPHABET = ('1', '0');
        fHGT::Distance::@RNA_ALPHABET =('A', 'C', 'G', 'U');

All are importable.


PreserveComments

Not importable. Usage:

        fHGT::Distance::PreserveComments($one_or_zero);

If the argument is true, then the comments in the files read are written to STDOUT (or whatever else it is set to by select previously). This is the default behavior. If the argument is false, then the comments from the input files are not copied.


ReadMatrix

Importable. Usage:

        ($num_taxa, %close) = fHGT::Distance::ReadMatrix($input_file, \@taxon_name);

Reads the pairwise closeness values into the hash array. $input_file can be 'STDIN', in which case standard input is read. In any case, the format is set by WriteMatrix. The taxon names are stored in $taxon_name[1...$num_taxa].


WriteMatrix

Importable. Usage:

        fHGT::Distance::WriteMatrix(\%close, \@taxon_names);

Writes the pairwise closeness values given by the hash array onto stdout. The names are @taxon_names[1...$#taxon_names]. The format is simple. for each taxon, the name is stated with a colon after it and then the closeness to every taxon is printed, one by line.


ReadSample

NOT IMPLEMENTED YET. Usage:

        ($num_taxa, %close) = fHGT::Distance::ReadSample($sample_file);

Reads in a sample and computes the pairwise closeness values.


ClosePair

Importable. Usage:

        $close_xy = fHGT::Distance::ClosePair(\%closeness, $x, $y);

Returns the closeness of two terminal taxa.


CloseTriplet

Importable. Usage:

        $close_xyz = fHGT::Distance::CloseTriplet(\%closeness, $x, $y, $z);

Returns the triplet's average closeness.


DistancePair

Importable. Usage:

        $dist_xy = fHGT::Distance::DistancePair(\%closeness, $x, $y);

Returns the pairwise distance of two taxa.


SetClosePair

Importable. Usage:

        fHGT::Distance::SetClosePair(\%close, $x, $y, $close_xy);

Sets the closeness of the given taxa.


AddToClosePair

Importable. Usage:

        fHGT::Distance::AddToClosePair(\%close, $x, $y, $w);

Equivalent to (but faster than)

        $c = fHGT::Distance::AddToClosePair(\%close, $x, $y);
        fHGT::Distance::AddToClosePair(\%close, $x, $y, $c+$w);


ClosenessToDistance

Importable. Usage:

        ClosenessToDistance(\%close);

Converts the closeness values to distances.


DistanceToCloseness

Importable. Usage:

        DistanceToCloseness(\%close);

Converts the distance values to closenesses.


_WriteDistanceMatrix

Not importable. Usage:

        fHGT::Distance::_WriteDistanceMatrix(\%distance1, \@taxon);

Writes the distance matrix onto stdout in a nice format. Used only for diagnostics (required sample length etc.).


_DiffDistance

Not importable. Usage:

        %distance = fHGT::Distance::_DiffDistance(\%distance1, \%distance2);

Calculates the difference of two distance matrices. %distance = %distance1-%distance2. I used it for testing convergence rates.


Debugging

Not importable. Usage:

        fHGT::Distance::_Debug($boolean); # detailed debug info wanted?


AUTHOR

Miklós Csürös csuros@cs.yale.edu


VERSION

        $Id: Distance.pm,v 1.5 1999/02/09 06:23:32 csuros Exp csuros $


Up | Previous (fHGT::Bipartition) | Next (fHGT::Node)