Source code for pyensae.graphhelper.linkage

dendogram, heatmap functionalities.

It comes from ` <>`_
which I copied here because the module does not properly work on Python 3 (import issues).
See also `biokit license <>`_.

:author: Thomas Cokelaer


[docs]class Linkage: """ Linkage used in other tools such as Heatmap, the class requires `scipy <>`_. :githublink:`%|py|18` """
[docs] def __init__(self): """ unused :githublink:`%|py|23` """ pass
[docs] def linkage(self, df, method, metric): """ Mostly calls `linkage <>`_. :param df: dataframe :param method: see `linkage <>`_ :param metric: see `linkage <>`_ :return: output of `linkage <>`_ :githublink:`%|py|38` """ from scipy.cluster.hierarchy import linkage from scipy.spatial.distance import pdist, squareform d = pdist(df) D = squareform(d) Y = linkage(D, method=method, metric=metric) return Y