INNER CODE UNIT · Python
get_clustermap
widdowquinn/pyani · pyani/pyani_graphics/sns/__init__.py:102
def get_clustermap(dfr, params, title=None, annot=True):
"""Return a Seaborn clustermap for the passed dataframe.
:param dfr:
:param params:
:param title: str, plot title
:param annot: Boolean, add text for cell values?
"""
# If we do not catch warnings here, then we often get the following warning:
# ClusterWarning: scipy.cluster: The symmetric non-negative hollow
# observation matrix looks suspiciously like an uncondensed distance matrix
# The usual solution would be to convert the array with
# scipy.spatial.distance.squareform(), but this requires that all values in
# the main diagonal are zero, which is not the case for ANI.
# As we know this is a (1-distance) matrix, we could just set the diagonal
# to zero and fudge it, but this is not a good solution. Instead, we suppress
# the warning in a context manager for this function call only, because we