src/hg/encode/validateFiles/validateFiles.c 1.12
1.12 2009/03/24 15:51:04 mikep
make library function to read all chromInfo, and add chromDb option to validateFiles to get chromInfo from DB
Index: src/hg/encode/validateFiles/validateFiles.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/encode/validateFiles/validateFiles.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -b -B -U 4 -r1.11 -r1.12
--- src/hg/encode/validateFiles/validateFiles.c 13 Mar 2009 23:23:51 -0000 1.11
+++ src/hg/encode/validateFiles/validateFiles.c 24 Mar 2009 15:51:04 -0000 1.12
@@ -4,8 +4,9 @@
#include "hash.h"
#include "options.h"
#include "sqlNum.h"
#include "chromInfo.h"
+#include "jksql.h"
static char const rcsid[] = "$Id$";
static char *version = "$Revision$";
@@ -53,8 +54,9 @@
" csfasta : Colorspace fasta (implies -colorSpace) (see link below)\n"
" csqual : Colorspace quality (see link below)\n"
" (see http://marketing.appliedbiosystems.com/mk/submit/SOLID_KNOWLEDGE_RD?_JS=T&rd=dm)\n"
"\n"
+ " -chromDb=db Specify DB containing chromInfo table to validate chrom names and sizes\n"
" -chromInfo=file.txt Specify chromInfo file to validate chrom names and sizes\n"
" -colorSpace Sequences include colorspace values [0-3] (can be used \n"
" with formats such as tagAlign and pairedTagAlign)\n"
" -maxErrors=N Maximum lines with errors to report in one file before \n"
@@ -68,8 +70,9 @@
}
static struct optionSpec options[] = {
{"type", OPTION_STRING},
+ {"chromDb", OPTION_STRING},
{"chromInfo", OPTION_STRING},
{"maxErrors", OPTION_INT},
{"colorSpace", OPTION_BOOLEAN},
{"zeroSizeOk", OPTION_BOOLEAN},
@@ -766,9 +769,17 @@
printOkLines = optionExists("printOkLines");
printFailLines = optionExists("printFailLines");
colorSpace = optionExists("colorSpace") || sameString(type, "csfasta");
initArrays();
-if (strlen(optionVal("chromInfo", "")) > 0)
+// Get chromInfo from DB or file
+if (strlen(optionVal("chromDb", "")) > 0)
+ {
+ if (!(ci = createChromInfoList(NULL, optionVal("chromDb", ""))))
+ errAbort("could not load chromInfo from DB %s\n", optionVal("chromDb", ""));
+ chrHash = chromHash(ci);
+ chromInfoFree(&ci);
+ }
+else if (strlen(optionVal("chromInfo", "")) > 0)
{
if (!(ci = chromInfoLoadAll(optionVal("chromInfo", ""))))
errAbort("could not load chromInfo file %s\n", optionVal("chromInfo", ""));
chrHash = chromHash(ci);