src/hg/snp/snpLoad/illuminaLookup1M.c 1.2

1.2 2009/12/05 00:22:49 fanhsu
Updated illuminaLookup1M.c to make it work again for newer Illumina SNP array chips.
Index: src/hg/snp/snpLoad/illuminaLookup1M.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/snp/snpLoad/illuminaLookup1M.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 4 -r1.1 -r1.2
--- src/hg/snp/snpLoad/illuminaLookup1M.c	1 Aug 2008 23:14:23 -0000	1.1
+++ src/hg/snp/snpLoad/illuminaLookup1M.c	5 Dec 2009 00:22:49 -0000	1.2
@@ -1,5 +1,5 @@
-/* illuminaLookup1M - generate data for Illumina 1M SNP arrays track. */
+/* illuminaLookup1M - generate data for Illumina 1M and other SNP arrays track. */
 /* use UCSC snpXXX if dbSNP ID is found */
 /* use Illumina data if not found */
 /* This program is adopted from Heather's illuminaLookup2.c, with substantial simplyfication */
 
@@ -8,8 +8,9 @@
 #include "hdb.h"
 
 static char const rcsid[] = "$Id$";
 
+char *snpDb = NULL;
 struct snpSubset 
     {
     char *chrom;
     int start;
@@ -34,9 +35,9 @@
 /* exclude SNPs that align multiple places */
 {
 struct hash *ret = NULL;
 char query[512];
-struct sqlConnection *conn = hAllocConn();
+struct sqlConnection *conn = hAllocConn(snpDb);
 struct sqlResult *sr;
 char **row;
 struct snpSubset *subsetElement = NULL;
 
@@ -68,9 +69,9 @@
 /* lookup details in snpHash */
 /* report and skip if SNP missing, class != single, locType != exact */
 {
 char query[512];
-struct sqlConnection *conn = hAllocConn();
+struct sqlConnection *conn = hAllocConn(snpDb);
 struct sqlResult *sr;
 char **row;
 struct hashEl *hel = NULL;
 struct snpSubset *subsetElement = NULL;
@@ -122,9 +123,8 @@
 
 int main(int argc, char *argv[])
 /* load SNPs into hash */
 {
-char *snpDb = NULL;
 char *illuminaTableName = NULL;
 char *snpTableName = NULL;
 
 struct hash *snpHash = NULL;
@@ -136,14 +137,12 @@
 illuminaTableName = argv[2];
 snpTableName = argv[3];
 
 /* process args */
-hSetDb(snpDb);
-if (!hTableExists(illuminaTableName))
+if (!hTableExists(snpDb, illuminaTableName))
     errAbort("no %s table in %s\n", illuminaTableName, snpDb);
-if (!hTableExists(snpTableName))
+if (!hTableExists(snpDb, snpTableName))
     errAbort("no %s table in %s\n", snpTableName, snpDb);
-
 snpHash = storeSnps(snpTableName);
 processSnps(snpHash, illuminaTableName);
 
 return 0;