src/hg/regulate/regCluster/regCluster.c 1.3

1.3 2010/05/05 00:50:37 kent
Doing another pass at the regulatory clustering - this time whole genome rather than just chromosome 22.
Index: src/hg/regulate/regCluster/regCluster.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/regulate/regCluster/regCluster.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -B -U 4 -r1.2 -r1.3
--- src/hg/regulate/regCluster/regCluster.c	10 Mar 2010 19:31:19 -0000	1.2
+++ src/hg/regulate/regCluster/regCluster.c	5 May 2010 00:50:37 -0000	1.3
@@ -22,11 +22,12 @@
 "regCluster - Cluster regulator regions\n"
 "usage:\n"
 "   regCluster tableOfTables output.cluster output.bed\n"
 "Where the table-of-tables is space or tab separated in the format:\n"
-"   <fileName> <chrom> <start> <end> <score> <dim1 label> ... <dimN label>\n"
-"where chrom, start, end are the indexes (starting with 0) of the chromosome, start, and end\n"
-"fields in the file.\n"
+"   <fileName> <chrom> <start> <end> <score> <normScore> <dim1 label> ... <dimN label>\n"
+"where chrom, start, end, score are the indexes (starting with 0) of the chromosome, start, \n"
+"and end fields in the file, normScore is a factor to multiply score by to get it into the\n"
+"0-1000 range, and the dim# labels are the labels in each dimention.\n"
 "for example\n"
 "   simpleReg.bed 0 1 2 4 aCell aFactor\n"
 "options:\n"
 "   -dims=N - number of dimensions in data.  Would be 2 for cell-line + antibody. Default %d\n"
@@ -226,9 +227,17 @@
 int itemCount = slCount(itemList);
 struct regCluster *clusterList = NULL;
 if (itemCount < easyMax)
     {
-    addCluster(lm, itemList, 0, BIGNUM, &clusterList);
+    struct regItem *item = itemList;
+    int chromStart = item->chromStart;
+    int chromEnd = item->chromEnd;
+    for (item = item->next; item != NULL; item = item->next)
+        {
+	if (item->chromStart < chromStart) chromStart = item->chromStart;
+	if (item->chromEnd > chromEnd) chromEnd = item->chromEnd;
+	}
+    addCluster(lm, itemList, chromStart, chromEnd, &clusterList);
     }
 else
     {
     /* Make up coverage tree. */