src/hg/lib/bamFile.c 1.18

1.18 2010/01/11 17:52:10 angie
Changed some errAborts to warns so BAM track connection troubles don't prevent display of other tracks.
Index: src/hg/lib/bamFile.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/bamFile.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -b -B -U 4 -r1.17 -r1.18
--- src/hg/lib/bamFile.c	10 Dec 2009 15:02:12 -0000	1.17
+++ src/hg/lib/bamFile.c	11 Jan 2010 17:52:10 -0000	1.18
@@ -92,9 +92,13 @@
 		return cloneString(fileOrUrl);
 		}
 	    }
 	else
-	    errAbort("Failed to open BAM URL \"%s\" with udc", fileOrUrl);
+	    {
+	    warn("Failed to open BAM URL \"%s\" with udc", fileOrUrl);
+	    freeMem(bamFileName);
+	    return cloneString(fileOrUrl);
+	    }
 	}
     // Look for index file: xxx.bam.bai or xxx.bai.  Look for both in udcFuse,
     // and only open the URL with udc if neither udcFuse file exists.
     int urlLen = strlen(fileOrUrl), fLen = strlen(bamFileName);
@@ -123,14 +127,20 @@
 		strcpy(altIndexUrl+urlLen-1, "i");
 		verbose(2, "going to call udcFileMayOpen(%s).\n", altIndexUrl);
 		udcf = udcFileMayOpen(altIndexUrl, NULL);
 		if (udcf == NULL)
-		    errAbort("Cannot find BAM index file (%s or %s)", indexUrl, altIndexUrl);
+		    {
+		    warn("Cannot find BAM index file (%s or %s)", indexUrl, altIndexUrl);
+		    return cloneString(fileOrUrl);
+		    }
 		udcFileClose(&udcf);
 		freeMem(altIndexUrl);
 		}
 	    else
-		errAbort("Cannot find BAM index file for \"%s\"", fileOrUrl);
+		{
+		warn("Cannot find BAM index file for \"%s\"", fileOrUrl);
+		return cloneString(fileOrUrl);
+		}
 	    freeMem(indexUrl);
 	    }
 	freeMem(altIndexFileName);
 	}
@@ -223,12 +233,12 @@
 setCurrentDir(samDir);
 bam_index_t *idx = bam_index_load(bamFileName);
 setCurrentDir(runDir);
 if (idx == NULL)
-    errAbort("bam_index_load(%s) failed.", bamFileName);
+    warn("bam_index_load(%s) failed.", bamFileName);
 ret = bam_fetch(fh->x.bam, idx, chromId, start, end, callbackData, callbackFunc);
 if (ret != 0)
-    errAbort("bam_fetch(%s, %s (chromId=%d) failed (%d)", bamFileName, position, chromId, ret);
+    warn("bam_fetch(%s, %s (chromId=%d) failed (%d)", bamFileName, position, chromId, ret);
 free(idx); // Not freeMem, freez etc -- sam just uses malloc/calloc.
 samclose(fh);
 }