src/hg/protein/pbCalResStdGlobal/pbCalResStdGlobal.c 1.8

1.8 2009/09/25 21:57:47 kent
Adding database parameter as now required for hAllocConn(). Changing a stderr message to verbose(2 since it was coming up a lot to no bad effect. Bumping up MAXN so can handle 20 million proteins in SwissProt since now up to 9.3 million and previous limit was 10 million. Changing biggest array to be dynamically allocated to avoid linkage error.
Index: src/hg/protein/pbCalResStdGlobal/pbCalResStdGlobal.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/protein/pbCalResStdGlobal/pbCalResStdGlobal.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -b -B -U 4 -r1.7 -r1.8
--- src/hg/protein/pbCalResStdGlobal/pbCalResStdGlobal.c	27 Aug 2008 22:35:00 -0000	1.7
+++ src/hg/protein/pbCalResStdGlobal/pbCalResStdGlobal.c	25 Sep 2009 21:57:47 -0000	1.8
@@ -1,15 +1,15 @@
 /* pbCalResStdGlobal- Calculate the avg frequency and standard deviation of each AA residue for the proteins for all proteins */
 
-#define MAXN 10000000
-#define MAXRES 23
-
 #include "common.h"
 #include "hCommon.h"
 #include "hdb.h"
 #include "spDb.h"
 #include "math.h"
 
+#define MAXN 20000000
+#define MAXRES 23
+
 void usage()
 /* Explain usage and exit. */
 {
 errAbort(
@@ -21,9 +21,9 @@
   );
 }
 
 double measure[MAXN];
-double freq[MAXN][MAXRES];
+double (*freq)[MAXRES];	// Dynamically allocated to be same as fres[MAXN][MAXRES];
 double avg[MAXRES];
 double sumJ[MAXRES];
 double sigma[MAXRES];
 double sumJ[MAXRES];
@@ -115,8 +115,9 @@
 int icnt, jcnt;
 int sortedCnt;
 
 if (argc != 2) usage();
+freq = needLargeZeroedMem(sizeof(double)*MAXN*MAXRES);
 
 strcpy(aaAlphabet, "WCMHYNFIDQKRTVPGEASLXZB");
 
 sprintf(spDbName, "sp%s", argv[1]);
@@ -136,9 +137,9 @@
     }
 icnt = 0;
 jcnt = 0;
 
-conn2 = hAllocConn();
+conn2 = hAllocConn(spDbName);
 
 safef(query2, sizeof(query2), "select acc, val from %s.protein;", spDbName);
 sr2 = sqlMustGetResult(conn2, query2);
 row2 = sqlNextRow(sr2);
@@ -173,9 +174,9 @@
 		}
 	    }
 	if (!aaResFound)
 	    {
-	    fprintf(stderr, "%c %d not a valid AA residue.\n", *chp, *chp);
+	    verbose(2, "%c %d not a valid AA residue.\n", *chp, *chp);
 	    }
 	chp++;
 	}