src/hg/instinct/bioInt2/bioLevelI.c 1.6

1.6 2009/04/27 06:15:48 jsanborn
updated lots of stuff, will break older implementation of database
Index: src/hg/instinct/bioInt2/bioLevelI.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/bioInt2/bioLevelI.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -b -B -U 4 -r1.5 -r1.6
--- src/hg/instinct/bioInt2/bioLevelI.c	4 Apr 2009 00:39:22 -0000	1.5
+++ src/hg/instinct/bioInt2/bioLevelI.c	27 Apr 2009 06:15:48 -0000	1.6
@@ -74,38 +74,8 @@
 return maxId + 1;
 }   
 
 
-void createAnalysisFeaturesTable(struct sqlConnection *biConn, char *tableName)
-{
-struct dyString *dy = newDyString(1024);
-dyStringPrintf(dy, "CREATE TABLE %s (\n", tableName);
-dyStringPrintf(dy, "id int unsigned not null,\n");
-dyStringPrintf(dy, "feature_name varchar(255) not null,\n");
-dyStringPrintf(dy, "KEY(id),\n");
-dyStringPrintf(dy, "KEY(feature_name),\n");
-dyStringPrintf(dy, "KEY(id, feature_name),\n");
-dyStringPrintf(dy, "KEY(feature_name, id)\n");
-dyStringPrintf(dy, ")\n");
-sqlUpdate(biConn,dy->string);
-dyStringFree(&dy);
-} 
-
-void createAnalysisValsTable(struct sqlConnection *biConn, char *tableName)
-{
-struct dyString *dy = newDyString(1024);
-dyStringPrintf(dy, "CREATE TABLE %s (\n", tableName);
-dyStringPrintf(dy, "sample_id int unsigned not null,\n");
-dyStringPrintf(dy, "feature_id int unsigned not null,\n");
-dyStringPrintf(dy, "val float not null,\n");
-dyStringPrintf(dy, "conf float not null,\n");
-dyStringPrintf(dy, "KEY(feature_id, sample_id),\n");
-dyStringPrintf(dy, "KEY(sample_id, feature_id)\n");
-dyStringPrintf(dy, ")\n");
-sqlUpdate(biConn,dy->string);
-dyStringFree(&dy);
-} 
-
 boolean analysisFeatureExists(struct sqlConnection *biConn, struct analysisFeatures *af)
 {
 char query[256];
 safef(query, sizeof(query),
@@ -117,10 +87,8 @@
 } 
 
 struct hash *getAnalysisFeaturesHash(struct sqlConnection *biConn)
 {
-fprintf(stdout, "getting analysis features hash.\n");
-
 struct hash *hash = hashNew(0);
 char query[128];
 safef(query, sizeof(query), "select * from %s", AF_TABLE);
 
@@ -134,10 +102,8 @@
 }  
 
 struct hash *storeAnalysisFeaturesInDb(struct sqlConnection *biConn, struct analysisResult *arList)
 {
-fprintf(stdout, "storing analysis features\n");
-
 if (!sqlTableExists(biConn, AF_TABLE))
     createAnalysisFeaturesTable(biConn, AF_TABLE);
 
 /* Get existing analysis features */
@@ -187,15 +153,12 @@
 
 void storeAnalysisResultsInDb(struct sqlConnection *biConn, struct biAnalysis *ba, 
 			      struct analysisResult *arList)
 {
-//fprintf(stdout, "storing analysis in table %s in %s db\n", 
-//	ba->tableName, ba->db);
-
 if (!sqlTableExists(biConn, ba->tableName))
     createAnalysisValsTable(biConn, ba->tableName);
 
-struct hash *featureIds = storeAnalysisFeaturesInDb(biConn, arList); 
+struct hash *featureIds = getAnalysisFeaturesHash(biConn);
 struct hash *sampleIds = createHash(biConn, SA_TABLE, "name", "id");
 
 struct analysisVals *av = AllocA(struct analysisVals);
 struct analysisResult *ar;