Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Trim EOL whitespace.

  • Loading branch information...
commit c5e168d05a87ac65e7491fdd6db73748217ae5d9 1 parent 83f9b75
@cbrueffer cbrueffer authored peterjc committed
View
36 Bio/Cluster/cluster.c
@@ -5,7 +5,7 @@
* Human Genome Center, Institute of Medical Science, University of Tokyo,
* 4-6-1 Shirokanedai, Minato-ku, Tokyo 108-8639, Japan.
* Contact: mdehoon 'AT' gsc.riken.jp
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation with or without modifications and for any purpose and
* without fee is hereby granted, provided that any copyright notices
@@ -14,7 +14,7 @@
* names of the contributors or copyright holders not be used in
* advertising or publicity pertaining to distribution of the software
* without specific prior permission.
- *
+ *
* THE CONTRIBUTORS AND COPYRIGHT HOLDERS OF THIS SOFTWARE DISCLAIM ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE
@@ -23,7 +23,7 @@
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
* OR PERFORMANCE OF THIS SOFTWARE.
- *
+ *
*/
#include <time.h>
@@ -334,7 +334,7 @@ static int svd(int m, int n, double** u, double w[], double** vt)
* A=usv of a real m by n rectangular matrix, where m is greater
* than or equal to n. Householder bidiagonalization and a variant
* of the QR algorithm are used.
- *
+ *
*
* On input.
*
@@ -932,7 +932,7 @@ positive integer if the singular value decomposition fails to converge.
static
double euclid (int n, double** data1, double** data2, int** mask1, int** mask2,
const double weight[], int index1, int index2, int transpose)
-
+
/*
Purpose
=======
@@ -1708,7 +1708,7 @@ Otherwise, the distance between two columns in the matrix is calculated.
/* ********************************************************************* */
-static double(*setmetric(char dist))
+static double(*setmetric(char dist))
(int, double**, double**, int**, int**, const double[], int, int, int)
{ switch(dist)
{ case 'e': return &euclid;
@@ -2203,7 +2203,7 @@ calculating the medians.
}
}
}
-
+
/* ********************************************************************* */
int getclustercentroids(int nclusters, int nrows, int ncolumns,
@@ -2427,7 +2427,7 @@ kmeans(int nclusters, int nrows, int ncolumns, double** data, int** mask,
break; /* Identical solution found; break out of this loop */
}
- if (npass<=1)
+ if (npass<=1)
{ *error = total;
break;
}
@@ -2532,7 +2532,7 @@ kmedians(int nclusters, int nrows, int ncolumns, double** data, int** mask,
break; /* Identical solution found; break out of this loop */
}
- if (npass<=1)
+ if (npass<=1)
{ *error = total;
break;
}
@@ -2603,7 +2603,7 @@ of the matrix are clustered.
npass (input) int
The number of times clustering is performed. Clustering is performed npass
-times, each time starting from a different (random) initial assignment of
+times, each time starting from a different (random) initial assignment of
genes to clusters. The clustering solution with the lowest within-cluster sum
of distances is chosen.
If npass==0, then the clustering algorithm will be run once, where the initial
@@ -2697,7 +2697,7 @@ number of clusters is larger than the number of elements being clustered,
return;
}
}
-
+
if (method=='m')
{ double* cache = malloc(nelements*sizeof(double));
if(cache)
@@ -3105,7 +3105,7 @@ weights array, the function returns NULL.
/* ******************************************************************** */
-void cuttree (int nelements, Node* tree, int nclusters, int clusterid[])
+void cuttree (int nelements, Node* tree, int nclusters, int clusterid[])
/*
Purpose
@@ -3160,7 +3160,7 @@ error occured, all elements in clusterid are set to -1.
}
for (i = 0; i < n; i++) nodeid[i] = -1;
for (i = n-1; i >= 0; i--)
- { if(nodeid[i]<0)
+ { if(nodeid[i]<0)
{ j = icluster;
nodeid[i] = j;
icluster++;
@@ -3269,7 +3269,7 @@ If a memory error occurs, pclcluster returns NULL.
if(!makedatamask(nelements, ndata, &newdata, &newmask))
{ free(result);
free(distid);
- return NULL;
+ return NULL;
}
for (i = 0; i < nelements; i++) distid[i] = i;
@@ -3313,7 +3313,7 @@ If a memory error occurs, pclcluster returns NULL.
free(mask[is]);
data[is] = data[nnodes-inode];
mask[is] = mask[nnodes-inode];
-
+
/* Fix the distances */
distid[is] = distid[nnodes-inode];
for (i = 0; i < is; i++)
@@ -3334,7 +3334,7 @@ If a memory error occurs, pclcluster returns NULL.
free(data);
free(mask);
free(distid);
-
+
return result;
}
@@ -3829,7 +3829,7 @@ If a memory error occurs, treecluster returns NULL.
for (i = 1; i < nelements; i++) free(distmatrix[i]);
free (distmatrix);
}
-
+
return result;
}
@@ -4235,7 +4235,7 @@ somcluster.
double clusterdistance (int nrows, int ncolumns, double** data,
int** mask, double weight[], int n1, int n2, int index1[], int index2[],
char dist, char method, int transpose)
-
+
/*
Purpose
=======
View
6 Bio/Cluster/cluster.h
@@ -6,7 +6,7 @@
* Human Genome Center, Institute of Medical Science, University of Tokyo,
* 4-6-1 Shirokanedai, Minato-ku, Tokyo 108-8639, Japan.
* Contact: mdehoon 'AT' gsc.riken.jp
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation with or without modifications and for any purpose and
* without fee is hereby granted, provided that any copyright notices
@@ -15,7 +15,7 @@
* names of the contributors or copyright holders not be used in
* advertising or publicity pertaining to distribution of the software
* without specific prior permission.
- *
+ *
* THE CONTRIBUTORS AND COPYRIGHT HOLDERS OF THIS SOFTWARE DISCLAIM ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE
@@ -24,7 +24,7 @@
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
* OR PERFORMANCE OF THIS SOFTWARE.
- *
+ *
*/
#ifndef min
View
84 Bio/Cluster/clustermodule.c
@@ -257,7 +257,7 @@ parse_mask(PyObject* object, PyArrayObject** array,
{ PyErr_SetString(PyExc_ValueError, "mask cannot be cast to needed type.");
return NULL;
}
- }
+ }
}
if(PyArray_DIM(*array, 0) != nrows) /* Checking number of rows */
{ PyErr_Format(PyExc_ValueError,
@@ -339,7 +339,7 @@ parse_weight(PyObject* object, PyArrayObject** array, const int ndata)
}
if(PyArray_NDIM(*array) == 1) /* Checking number of dimensions */
{ /* no checking on last dimension of expected size 1 */
- if (ndata!=1 && ndata!=PyArray_DIM(*array, 0))
+ if (ndata!=1 && ndata!=PyArray_DIM(*array, 0))
{ PyErr_Format(PyExc_ValueError,
"weight has incorrect extent (%" NPY_INTP_FMT " expected %d)",
PyArray_DIM(*array, 0), ndata);
@@ -422,12 +422,12 @@ parse_initialid(PyObject* object, int* nclusters, npy_intp nitems)
Py_DECREF((PyObject*) clusterid);
return NULL;
}
- }
+ }
}
/* -- Check the size of the array ----------------------------------- */
if(PyArray_NDIM(array) == 1)
{ /* no checking on last dimension of expected size 1 */
- if (nitems!=1 && nitems!=PyArray_DIM(array, 0))
+ if (nitems!=1 && nitems!=PyArray_DIM(array, 0))
{ PyErr_Format(PyExc_ValueError,
"initialid has incorrect extent (%" NPY_INTP_FMT
" expected %" NPY_INTP_FMT ")",
@@ -523,12 +523,12 @@ parse_clusterid(PyObject* object, PyArrayObject** array, unsigned int nitems,
"clusterid cannot be cast to needed type.");
return NULL;
}
- }
+ }
}
/* -- Check the array size ------------------------------------------ */
if(PyArray_NDIM(*array) == 1)
{ /* no checking on last dimension of expected size 1 */
- if (nitems!=1 && nitems!=PyArray_DIM(*array, 0))
+ if (nitems!=1 && nitems!=PyArray_DIM(*array, 0))
{ PyErr_Format(PyExc_ValueError,
"clusterid has incorrect extent (%" NPY_INTP_FMT " expected %d)",
PyArray_DIM(*array, 0), nitems);
@@ -913,7 +913,7 @@ parse_index(PyObject* object, PyArrayObject** array, int* n)
return NULL;
}
*array = (PyArrayObject*) object;
- }
+ }
}
/* We have an array */
*n = (int) PyArray_DIM(*array, 0);
@@ -970,9 +970,9 @@ PyNode_init(PyNode *self, PyObject *args, PyObject *kwds)
double distance = 0.0;
static char *kwlist[] = {"left", "right", "distance", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "ii|d", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "ii|d", kwlist,
&left, &right, &distance))
- return -1;
+ return -1;
self->node.left = left;
self->node.right = right;
self->node.distance = distance;
@@ -1150,7 +1150,7 @@ PyTree_init(PyTree* self, PyObject* args, PyObject* kwds)
flag = malloc((2*n+1)*sizeof(int));
if(flag) /* Otherwise, we're in enough trouble already */
{ int j;
- for (i = 0; i < 2*n+1; i++) flag[i] = 0;
+ for (i = 0; i < 2*n+1; i++) flag[i] = 0;
for (i = 0; i < n; i++)
{ j = nodes[i].left;
if (j < 0)
@@ -1442,7 +1442,7 @@ py_version(PyObject* self)
#else
return PyString_FromString( CLUSTERVERSION );
#endif
-}
+}
/* kcluster */
static char kcluster__doc__[] =
@@ -1600,18 +1600,18 @@ py_kcluster(PyObject* self, PyObject* args, PyObject* keywords)
return NULL;
}
/* --------------------------------------------------------------------- */
- kcluster(NCLUSTERS,
- nrows,
- ncolumns,
- data,
- mask,
+ kcluster(NCLUSTERS,
+ nrows,
+ ncolumns,
+ data,
+ mask,
weight,
- TRANSPOSE,
- NPASS,
- METHOD,
- DIST,
- PyArray_DATA(aCLUSTERID),
- &ERROR,
+ TRANSPOSE,
+ NPASS,
+ METHOD,
+ DIST,
+ PyArray_DATA(aCLUSTERID),
+ &ERROR,
&IFOUND);
/* --------------------------------------------------------------------- */
free_data(aDATA, data);
@@ -1620,7 +1620,7 @@ py_kcluster(PyObject* self, PyObject* args, PyObject* keywords)
/* --------------------------------------------------------------------- */
return Py_BuildValue("Ndi", aCLUSTERID, ERROR, IFOUND);
-}
+}
/* end of wrapper for kcluster */
/* kmedoids */
@@ -1634,7 +1634,7 @@ static char kmedoids__doc__[] =
" #1: a 2D Numerical Python array (in which only the left-lower\n"
" part of the array will be accessed);\n"
" #2: a 1D Numerical Python array containing the distances\n"
-" consecutively;\n"
+" consecutively;\n"
" #3: a list of rows containing the lower-triangular part of\n"
" the distance matrix.\n"
" Examples are:\n"
@@ -1728,12 +1728,12 @@ py_kmedoids(PyObject* self, PyObject* args, PyObject* keywords)
return NULL;
}
/* --------------------------------------------------------------------- */
- kmedoids(NCLUSTERS,
- nitems,
- distances,
- NPASS,
- PyArray_DATA(aCLUSTERID),
- &ERROR,
+ kmedoids(NCLUSTERS,
+ nitems,
+ distances,
+ NPASS,
+ PyArray_DATA(aCLUSTERID),
+ &ERROR,
&IFOUND);
/* --------------------------------------------------------------------- */
free_distances(DISTANCES, aDISTANCES, distances, nitems);
@@ -1749,7 +1749,7 @@ py_kmedoids(PyObject* self, PyObject* args, PyObject* keywords)
return NULL;
}
return Py_BuildValue("Ndi",aCLUSTERID, ERROR, IFOUND);
-}
+}
/* end of wrapper for kmedoids */
/* treecluster */
@@ -1784,7 +1784,7 @@ static char treecluster__doc__[] =
" #1: a 2D Numerical Python array (in which only the left-lower\n"
" part of the array will be accessed);\n"
" #2: a 1D Numerical Python array containing the distances\n"
-" consecutively;\n"
+" consecutively;\n"
" #3: a list of rows containing the lower-triangular part of\n"
" the distance matrix.\n"
" Examples are:\n"
@@ -1956,7 +1956,7 @@ py_treecluster(PyObject* self, PyObject* args, PyObject* keywords)
tree->nodes = nodes;
tree->n = nitems-1;
return (PyObject*) tree;
-}
+}
/* end of wrapper for treecluster */
/* somcluster */
@@ -2138,7 +2138,7 @@ py_somcluster(PyObject* self, PyObject* args, PyObject* keywords)
return Py_BuildValue("NN",
PyArray_Return(aCLUSTERID),
PyArray_Return(aCELLDATA));
-}
+}
/* end of wrapper for somcluster */
/* median */
@@ -2181,7 +2181,7 @@ py_median(PyObject* unused, PyObject* args)
"Argument cannot be cast to needed type.");
return NULL;
}
- }
+ }
if (PyArray_NDIM(aDATA) != 1 && (PyArray_NDIM(aDATA) > 0 || PyArray_DIM(aDATA, 0) != 1))
{ PyErr_Format(PyExc_ValueError,
"median: Argument has incorrect rank (%d expected 1).",
@@ -2205,7 +2205,7 @@ py_median(PyObject* unused, PyObject* args)
Py_DECREF((PyObject*) aDATA);
/* --------------------------------------------------------------------- */
return PyFloat_FromDouble(result);
-}
+}
/* end of wrapper for median */
/* mean */
@@ -2247,7 +2247,7 @@ py_mean(PyObject* unused, PyObject* args)
"Argument cannot be cast to needed type.");
return NULL;
}
- }
+ }
if (PyArray_NDIM(aDATA) != 1 && (PyArray_NDIM(aDATA) > 0 || PyArray_DIM(aDATA, 0) != 1))
{ PyErr_Format(PyExc_ValueError,
"Argument has incorrect rank (%d expected 1).",
@@ -2272,7 +2272,7 @@ py_mean(PyObject* unused, PyObject* args)
Py_DECREF((PyObject*) aDATA);
/* --------------------------------------------------------------------- */
return PyFloat_FromDouble(result);
-}
+}
/* end of wrapper for mean */
/* clusterdistance */
@@ -2435,7 +2435,7 @@ py_clusterdistance(PyObject* self, PyObject* args, PyObject* keywords)
return NULL;
}
return PyFloat_FromDouble(result);
-}
+}
/* end of wrapper for clusterdistance */
/* clustercentroids */
@@ -2582,7 +2582,7 @@ py_clustercentroids(PyObject* self, PyObject* args, PyObject* keywords)
return NULL;
}
return Py_BuildValue("NN", PyArray_Return(aCDATA), PyArray_Return(aCMASK));
-}
+}
/* end of wrapper for clustercentroids */
/* distancematrix */
@@ -2640,7 +2640,7 @@ py_distancematrix(PyObject* self, PyObject* args, PyObject* keywords)
char DIST = 'e';
double** distances = NULL;
int nrows, ncolumns, nelements, ndata;
-
+
/* -- Read the input variables ----------------------------------------- */
static char* kwlist[] = { "data",
"mask",
@@ -2779,7 +2779,7 @@ py_pca(PyObject* self, PyObject* args)
double* p;
double* q;
int i, j;
-
+
/* -- Read the input variables ----------------------------------------- */
if(!PyArg_ParseTuple(args, "O", &DATA)) return NULL;
/* -- Check the data input array --------------------------------------- */
Please sign in to comment.
Something went wrong with that request. Please try again.