src/hg/encode/validateFiles/validateFiles.c 1.37
1.37 2010/03/29 20:25:45 braney
fix up some printf's and add flag allowing non-native chroms
Index: src/hg/encode/validateFiles/validateFiles.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/encode/validateFiles/validateFiles.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -b -B -U 4 -r1.36 -r1.37
--- src/hg/encode/validateFiles/validateFiles.c 21 Mar 2010 18:03:25 -0000 1.36
+++ src/hg/encode/validateFiles/validateFiles.c 29 Mar 2010 20:25:45 -0000 1.37
@@ -28,8 +28,9 @@
boolean mmPerPair;
boolean nMatch;
boolean isSort;
boolean privateData;
+boolean allowOther;
int quick;
struct hash *chrHash = NULL;
char dnaChars[256];
char qualChars[256];
@@ -97,8 +98,9 @@
" -printFailLines Print lines which fail validation to stdout\n"
" -isSort input is sorted by chrom\n"
//" -acceptDot Accept '.' as 'N' in DNA sequence\n"
" -version Print version\n"
+ " -allowOther allow chromosomes that aren't native in BAM's\n"
, MAX_ERRORS);
}
static struct optionSpec options[] = {
@@ -120,8 +122,9 @@
{"privateData", OPTION_BOOLEAN},
// {"acceptDot", OPTION_BOOLEAN},
{"isSort", OPTION_BOOLEAN},
{"version", OPTION_BOOLEAN},
+ {"allowOther", OPTION_BOOLEAN},
{NULL, 0},
};
boolean checkMismatch(int ch1, int ch2)
@@ -1067,9 +1070,9 @@
int validateBigWig(struct lineFile *lf, char *file)
{
if (chrHash == NULL)
- errAbort("BAM validation requires the -chromInfo or -chromDb option\n");
+ errAbort("bigWig validation requires the -chromInfo or -chromDb option\n");
int errs = 0;
struct bbiFile *bbiFile;
bbiFile = bigWigFileOpen(file);
@@ -1089,17 +1092,17 @@
unsigned *size;
if ( (size = hashFindVal(chrHash, chroms->name)) == NULL)
{
- printf("bigWig contains invalid chromosome name: %s\n",
+ warn("bigWig contains invalid chromosome name: %s\n",
chroms->name);
errs++;
}
else
{
if (*size != chroms->size)
{
- printf("bigWig contains chromosome with wrong length: %s should be %d bases, not %d bases\n",
+ warn("bigWig contains chromosome with wrong length: %s should be %d bases, not %d bases\n",
chroms->name,
*size, chroms->size);
errs++;
}
@@ -1136,17 +1139,20 @@
unsigned *size;
if ( (size = hashFindVal(chrHash, head->target_name[ii])) == NULL)
{
- printf("BAM contains invalid chromosome name: %s\n",
+ if (!allowOther)
+ {
+ warn("BAM contains invalid chromosome name: %s\n",
head->target_name[ii]);
errs++;
}
+ }
else
{
if (*size != head->target_len[ii])
{
- printf("BAM contains chromosome with wrong length: %s should be %d bases, not %d bases\n",
+ warn("BAM contains chromosome with wrong length: %s should be %d bases, not %d bases\n",
head->target_name[ii],
*size, head->target_len[ii]);
errs++;
}
@@ -1236,8 +1242,9 @@
isSort = optionExists("isSort");
mmCheckOneInN = optionInt("mmCheckOneInN", 1);
quick = optionExists("quick") ? optionInt("quick",QUICK_DEFAULT) : 0;
colorSpace = optionExists("colorSpace") || sameString(type, "csfasta");
+allowOther = optionExists("allowOther");
initArrays();
dnaChars[(int)'.'] = 1;//optionExists("acceptDot"); // I don't think this is worth adding another option. But it could be done.