src/hg/regulate/regCluster/regCluster.c 1.4

1.4 2010/05/16 21:41:42 kent
Putting in something so that multiple peaks in the same cluster from the same source don't get counted twice.
Index: src/hg/regulate/regCluster/regCluster.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/regulate/regCluster/regCluster.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -b -B -U 4 -r1.3 -r1.4
--- src/hg/regulate/regCluster/regCluster.c	5 May 2010 00:50:37 -0000	1.3
+++ src/hg/regulate/regCluster/regCluster.c	16 May 2010 21:41:42 -0000	1.4
@@ -308,11 +308,13 @@
         {
 	struct slRef *ref, *refList=cluster->itemRefList;
 	++clusterIx;
 	struct regItem *item = refList->val;
+	struct hash *uniqHash = hashNew(0);
 	for (ref = refList; ref != NULL; ref = ref->next)
 	    {
 	    item = ref->val;
+	    hashStore(uniqHash, item->source->dataSource);
 	    fprintf(fCluster, "%d\t%s\t", clusterIx, item->chrom);
 	    fprintf(fCluster, "%d\t%d\t", item->chromStart, item->chromEnd);
 	    fprintf(fCluster, "%g", item->score);
 	    int i;
@@ -322,9 +324,10 @@
 	    }
 	double score = clScoreScale * cluster->maxSubScore;
 	if (score > 1000) score = 1000;
 	fprintf(fBed, "%s\t%d\t%d\t%d\t%g\n", chrom, 
-		cluster->chromStart, cluster->chromEnd, slCount(refList), score);
+		cluster->chromStart, cluster->chromEnd, uniqHash->elCount, score);
+	hashFree(&uniqHash);
 	}
     }
 lmCleanup(&lm);
 }