Ejemplo n.º 1
0
    def clusterdistance(self,
                        index1=0,
                        index2=0,
                        method='a',
                        dist='e',
                        transpose=0):
        """Calculate the distance between two clusters.

  - index1   : 1D array identifying which genes/microarrays belong to the
    first cluster. If the cluster contains only one gene, then
    index1 can also be written as a single integer.
  - index2   : 1D array identifying which genes/microarrays belong to the
    second cluster. If the cluster contains only one gene, then
    index2 can also be written as a single integer.
  - transpose: if equal to 0, genes (rows) are clustered;
    if equal to 1, microarrays (columns) are clustered.
  - dist     : specifies the distance function to be used:

    - dist=='e': Euclidean distance
    - dist=='b': City Block distance
    - dist=='c': Pearson correlation
    - dist=='a': absolute value of the correlation
    - dist=='u': uncentered correlation
    - dist=='x': absolute uncentered correlation
    - dist=='s': Spearman's rank correlation
    - dist=='k': Kendall's tau

  - method   : specifies how the distance between two clusters is defined:

    - method=='a': the distance between the arithmetic means of the
      two clusters
    - method=='m': the distance between the medians of the two
      clusters
    - method=='s': the smallest pairwise distance between members
      of the two clusters
    - method=='x': the largest pairwise distance between members of
      the two clusters
    - method=='v': average of the pairwise distances between
      members of the clusters

  - transpose: if equal to 0: clusters of genes (rows) are considered;
    if equal to 1: clusters of microarrays (columns) are considered.

"""
        if transpose == 0:
            weight = self.eweight
        else:
            weight = self.gweight
        return clusterdistance(self.data, self.mask, weight, index1, index2,
                               method, dist, transpose)
Ejemplo n.º 2
0
    def clusterdistance(self, index1=0, index2=0, method='a', dist='e',
                        transpose=0):
        """Calculate the distance between two clusters.

        Arguments:
         - index1   : 1D array identifying which genes/microarrays belong to the
           first cluster. If the cluster contains only one gene, then
           index1 can also be written as a single integer.
         - index2   : 1D array identifying which genes/microarrays belong to the
           second cluster. If the cluster contains only one gene, then
           index2 can also be written as a single integer.
         - transpose: if equal to 0, genes (rows) are clustered;
           if equal to 1, microarrays (columns) are clustered.
         - dist     : specifies the distance function to be used:

           - dist=='e': Euclidean distance
           - dist=='b': City Block distance
           - dist=='c': Pearson correlation
           - dist=='a': absolute value of the correlation
           - dist=='u': uncentered correlation
           - dist=='x': absolute uncentered correlation
           - dist=='s': Spearman's rank correlation
           - dist=='k': Kendall's tau

         - method   : specifies how the distance between two clusters is defined:

           - method=='a': the distance between the arithmetic means of the
             two clusters
           - method=='m': the distance between the medians of the two clusters
           - method=='s': the smallest pairwise distance between members of
             the two clusters
           - method=='x': the largest pairwise distance between members of
             the two clusters
           - method=='v': average of the pairwise distances between members
             of the clusters

         - transpose: if equal to 0: clusters of genes (rows) are considered;
           if equal to 1: clusters of microarrays (columns) are considered.

        """
        if transpose == 0:
            weight = self.eweight
        else:
            weight = self.gweight
        return clusterdistance(self.data, self.mask, weight,
                               index1, index2, method, dist, transpose)