c62d21f5442cdf3cb285a7a4ada56483c8874686
max
  Fri Mar 7 21:27:07 2014 -0800
Adding possibility to paste URLs of bam/bigWig/bigbed, without acustom track header line, into the hgCustom upload box (refs #12813)

diff --git src/hg/lib/customTrack.c src/hg/lib/customTrack.c
index d8cf923..2c1edd4 100644
--- src/hg/lib/customTrack.c
+++ src/hg/lib/customTrack.c
@@ -646,40 +646,58 @@
     {
     safef(buf,sizeof(buf),"compressed://%s %s", fileName,  cFBin);
     /* cgi functions preserve binary data, cart vars have been
      *  cloneString-ed  which is bad for a binary stream that might
      * contain 0s  */
     }
 else
     {
     char *cF = cartOptionalString(cart, fileVar);
     safef(buf,sizeof(buf),"compressed://%s %lu %lu",
         fileName, (unsigned long) cF, (unsigned long) strlen(cF));
     }
 return cloneString(buf);
 }
 
-static boolean customTrackIsBigData(char *fileName)
+char* customTrackTypeFromBigFile(char *fileName)
+/* return most likely type for a big file name or NULL,
+ * has to be freed */
+{
+// based on udc cache dir analysis by hiram in rm #12813
+if (endsWith(fileName, ".bb") || endsWith(fileName, ".bigBed") || endsWith(fileName, ".bigbed"))
+    return cloneString("bigBed");
+if (endsWith(fileName, ".bw") || endsWith(fileName, ".bigWig") ||  
+            endsWith(fileName, ".bigwig") || endsWith(fileName, ".bwig"))
+    return cloneString("bigWig");
+if (endsWith(fileName, ".bam"))
+    return cloneString("bam");
+if (endsWith(fileName, ".vcf.gz"))
+    return cloneString("vcfTabix");
+return NULL;
+}
+
+boolean customTrackIsBigData(char *fileName)
 /* Return TRUE if fileName has a suffix that we recognize as a bigDataUrl track type. */
 {
 char *fileNameDecoded = cloneString(fileName);
 cgiDecode(fileName, fileNameDecoded, strlen(fileName));
-boolean result =
-    (endsWith(fileNameDecoded,".bb") ||
-     endsWith(fileNameDecoded,".bw")  ||
-     endsWith(fileNameDecoded,".bam") ||
-     endsWith(fileNameDecoded,".vcf.gz"));
+
+boolean result;
+char *type = customTrackTypeFromBigFile(fileNameDecoded);
+result = (type!=NULL);
+
+freeMem(type);
 freeMem(fileNameDecoded);
 return result;
 }
 
 static char *prepBigData(struct cart *cart, char *fileName, char *binVar, char *fileVar)
 /* Pass data's memory offset and size through to customFactory */
 {
 if (!customTrackIsBigData(fileName))
     return NULL;
 char buf[1024];
 char *cFBin = cartOptionalString(cart, binVar);
 if (cFBin)
     {
     // cFBin already contains memory offset and size (search for __binary in cheapcgi.c)
     safef(buf,sizeof(buf),"memory://%s %s", fileName, cFBin);