ac6fd0ed90d96f059fabcd906969363e68aaba2e aamp Mon Jul 11 07:33:38 2011 -0700 compile-error fixed: unused var diff --git src/lib/bamUdc.c src/lib/bamUdc.c index 3eead98..60dfc86 100644 --- src/lib/bamUdc.c +++ src/lib/bamUdc.c @@ -118,31 +118,32 @@ { mkdirTrashDirectory(dirName); size_t len = strlen(trashDir()) + 1 + strlen(dirName) + 1; samDir = needMem(len); safef(samDir, len, "%s/%s", trashDir(), dirName); } return samDir; } #endif//ndef KNETFILE_HOOKS boolean bamFileExistsUdc(char *fileOrUrl, char *udcFuseRoot) /* Return TRUE if we can successfully open the bam file and its index file. */ { char *bamFileName = samtoolsFileNameUdcFuse(fileOrUrl, udcFuseRoot); samfile_t *fh = samopen(bamFileName, "rb", NULL); -boolean usingUrl = (strstr(fileOrUrl, "tp://") || strstr(fileOrUrl, "https://")); +boolean usingUrl = TRUE; +usingUrl = (strstr(fileOrUrl, "tp://") || strstr(fileOrUrl, "https://")); if (fh != NULL) { #ifndef KNETFILE_HOOKS // When file is an URL, this caches the index file in addition to validating: // Since samtools's url-handling code saves the .bai file to the current directory, // chdir to a trash directory before calling bam_index_load, then chdir back. char *runDir = getCurrentDir(); char *samDir = getSamDir(); if (usingUrl) setCurrentDir(samDir); #endif//ndef KNETFILE_HOOKS bam_index_t *idx = bam_index_load(bamFileName); #ifndef KNETFILE_HOOKS if (usingUrl) setCurrentDir(runDir); @@ -193,31 +194,32 @@ samclose(*pSamFile); *pSamFile = NULL; } } void bamFetchUdc(char *fileOrUrl, char *position, bam_fetch_f callbackFunc, void *callbackData, samfile_t **pSamFile, char *udcFuseRoot) /* Open the .bam file, fetch items in the seq:start-end position range, * and call callbackFunc on each bam item retrieved from the file plus callbackData. * This handles BAM files with "chr"-less sequence names, e.g. from Ensembl. * The pSamFile parameter is optional. If non-NULL it will be filled in, just for * the benefit of the callback function, with the open samFile. */ { char *bamFileName = NULL; samfile_t *fh = bamOpenUdc(fileOrUrl, &bamFileName, udcFuseRoot); -boolean usingUrl = (strstr(fileOrUrl, "tp://") || strstr(fileOrUrl, "https://")); +boolean usingUrl = TRUE; +usingUrl = (strstr(fileOrUrl, "tp://") || strstr(fileOrUrl, "https://")); if (pSamFile != NULL) *pSamFile = fh; int chromId, start, end; int ret = bam_parse_region(fh->header, position, &chromId, &start, &end); if (ret != 0 && startsWith("chr", position)) ret = bam_parse_region(fh->header, position+strlen("chr"), &chromId, &start, &end); if (ret != 0) // If the bam file does not cover the current chromosome, OK return; #ifndef KNETFILE_HOOKS // Since samtools' url-handling code saves the .bai file to the current directory, // chdir to a trash directory before calling bam_index_load, then chdir back. char *runDir = getCurrentDir(); char *samDir = getSamDir(); if (usingUrl)