[BioPython] Bio.Cluster with 3D coordinates

km km at mrna.tn.nic.in
Tue Feb 21 17:19:10 EST 2006


Hi all,
how to reduce the dimensionality from 3-D to 2D while interpreting clusters witn Bio.Cluster ?
 
regards,
KM

On Tue, Feb 21, 2006 at 04:45:01PM -0500, Michiel De Hoon wrote:
> > Can anyone give axample amd suggestions how to find cluster centers
> > of my points in Cartesian space (x,y,z) using Bio.Cluster or Bio.kMeans ?
> 
> >>> from Numeric import *
> >>> from Bio.Cluster import kcluster, clustercentroid
> >>> datapoints = array([[1.1,0.9,1.1],
> ...                     [2.3,3.1,2.7],
> ...                     [1.2,1.0,0.9],
> ...                     [2.2,2.9,2.6],
> ...                     [2.2,3.0,2.9]])
> >>> clusterid, error, nfound = kcluster(datapoints)
> >>> clusterid
> array([0, 1, 0, 1, 1])
> >>> centroid, centroid_mask = clustercentroid(datapoints,
> clusterid=clusterid)
> >>> centroid[0]
> array([ 1.15,  0.95,  1.  ])
> >>> centroid[1]
> array([ 2.23333333,  3.        ,  2.73333333])
> >>> centroid_mask
> array([[1, 1, 1],
>        [1, 1, 1]])
> # Because there are no missing data.
> 
> 
> kcluster uses the Euclidean distance by default. To find more than two
> clusters, use kcluster(..., nclusters=the_number_of_clusters_you_want). If
> you have a lot of data points, it's better to make kcluster use multiple runs
> by specifying kcluster(..., npass=some_big_number).
> 
> --Michiel.
> 
> 
> 
> 
> Michiel de Hoon
> Center for Computational Biology and Bioinformatics
> Columbia University
> 1150 St Nicholas Avenue
> New York, NY 10032
> 
> 
> 
> -----Original Message-----
> From: biopython-bounces at portal.open-bio.org on behalf of
> ziemys at ecr6.ohio-state.edu
> Sent: Tue 2/21/2006 1:51 PM
> To: biopython at biopython.org
> Subject: [BioPython] Bio.Cluster with 3D coordinates
>  
> HI,
> 
> 
> 
> Bio.Cluster seems to be "optimised" for gene data. However, I did not find
> clues how to use it with 3D coordinates.
> 
> Arturas Z.
> 
> 
> _______________________________________________
> BioPython mailing list  -  BioPython at biopython.org


More information about the BioPython mailing list