Subject: | Bug in treecluster |
I found some errant warning messages when trying to run Algorithm::Cluster::treecluster. I was invoking a call to tree cluster as follows:
my %params = (
applyscale => 0,
transpose => 0,
method => 'a',
dist => 'e',
data => \@distance,
mask => '',
weight => '',
);
Running the code produced several warning messages. I eventually traced the messages to validity tests for mask and weight in the sub check_matrix_dimensions. The 'mask' warning is located on about line 192:
module_warn("Parameter 'mask' is not a valid matrix, ignoring it.");
There was a similar warning for the weight validity test. I corrected the problem by wrapping the weight and mask validity tests with an 'unless':
unless ($param->{mask} eq '' )
{
... do the test
}
unless ($param->{mask} eq '' )
{
....do the test
}
I then make sure to set mask and weight parameters to '' when I pass them to the module. They end up begin ignored anyway but the warnings caused much consternation.
From the documentation, I think this is supposed to be the behavior anyway. The warnings were really quite confusing because of their generic nature.
One final item, the C prototype accepts either 'data' matrix or a 'distance' matrix. This is also true of the Python module. I spent quite a while messing around until I realized that there does not seem to be any distinction between the two in the Perl module. I was trying to pass
distance => /@distance
Might be nice if treecluster.pm recognized 'distancematrix' as a valid parameter in addition to 'data'.