173bacbf6c28737266ef93048446902620b49330 braney Mon Dec 14 12:33:16 2015 -0800 some tweaks to CRAM support #14717 diff --git src/hg/lib/hgBam.c src/hg/lib/hgBam.c index b59ab97..3dd36e3 100644 --- src/hg/lib/hgBam.c +++ src/hg/lib/hgBam.c @@ -1,27 +1,41 @@ /* bamFile -- interface to binary alignment format files using Heng Li's samtools lib. */ /* Copyright (C) 2014 The Regents of the University of California * See README in this or parent directory for licensing information. */ #include "common.h" #include "hdb.h" #include "hgBam.h" #ifdef USE_BAM #include "htmshell.h" #include "samAlignment.h" +#include "hgConfig.h" + +void cramInit(struct trackDb *tdb) +/* Initialize variables needed for CRAM parsing. */ +{ +char *cramRef; +if ((cramRef = cfgOption("cramRef")) != NULL) + { + setenv("REF_CACHE", cramRef, TRUE); + } +char *refPath = trackDbSetting(tdb, "refPath"); +if (refPath != NULL) + setenv("REF_PATH", refPath, TRUE); +} char *bamFileNameFromTable(struct sqlConnection *conn, char *table, char *bamSeqName) /* Return file name from table. If table has a seqName column, then grab the * row associated with bamSeqName (which can be e.g. '1' not 'chr1' if that is the * case in the bam file). */ { boolean checkSeqName = (sqlFieldIndex(conn, table, "seqName") >= 0); if (checkSeqName && bamSeqName == NULL) errAbort("bamFileNameFromTable: table %s has seqName column, but NULL seqName passed in", table); char query[512]; if (checkSeqName) sqlSafef(query, sizeof(query), "select fileName from %s where seqName = '%s'", table, bamSeqName); else