src/hg/instinct/hgGeneset/hgStats.c 1.3

1.3 2010/01/28 23:45:26 jsanborn
fixed clustering
Index: src/hg/instinct/hgGeneset/hgStats.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/hgGeneset/hgStats.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -B -U 4 -r1.2 -r1.3
--- src/hg/instinct/hgGeneset/hgStats.c	28 Jan 2010 23:19:36 -0000	1.2
+++ src/hg/instinct/hgGeneset/hgStats.c	28 Jan 2010 23:45:26 -0000	1.3
@@ -260,9 +260,9 @@
     }
 
 /* Fill the genename with gene names */
 struct hashEl *el;
-struct hashCookie cookie = hashFirst(settings->x_index);
+struct hashCookie cookie = hashFirst(settings->y_index);
 while ((el = hashNext(&cookie)) != NULL)
     {
     char *name = el->name;
     int val    = ptToInt(el->val);
@@ -286,16 +286,16 @@
     // for sample or feature id.
     if (rd->feature_id != prevFeatureId)
 	{
 	safef(id, sizeof (id), "%d", rd->feature_id);
-	row = hashIntValDefault(settings->x_index, id, -1);
+	row = hashIntValDefault(settings->y_index, id, -1);
 	prevFeatureId = rd->feature_id;
 	}
 
     if (rd->sample_id != prevSampleId)
 	{
 	safef(id, sizeof (id), "%d", rd->sample_id);
-	column = hashIntValDefault(settings->y_index, id, -1);
+	column = hashIntValDefault(settings->x_index, id, -1);
 	prevSampleId = rd->sample_id;
 	}
 
     if (row < 0 || column < 0)
@@ -459,10 +459,10 @@
 {
 if (rdList == NULL || settings == NULL)
     return NULL;
 
-int rows    = hashNumEntries(settings->x_index);
-int columns = hashNumEntries(settings->y_index);
+int rows    = hashNumEntries(settings->y_index);
+int columns = hashNumEntries(settings->x_index);
 
 if (rows > MAX_ROWS || columns > MAX_COLUMNS)
     return NULL;
 
@@ -494,9 +494,9 @@
 TreeSort(nNodes, rows, geneindex, geneorder, nodeorder, nodecounts, tree);
 
 int i;
 struct slName *newGeneOrder = NULL;
-for (i = 0; i < nNodes; i++)
+for (i = 0; i < rows; i++)
     slNameAddHead(&newGeneOrder, genename[geneindex[i]]);
 
 slReverse(&newGeneOrder);