0c99ac971d0e20bfbacfdf967c8e495966fe83b0
angie
  Thu Nov 21 10:11:52 2013 -0800
Include gene track in trash file name for hgVai's Artificial ExampleVariants, because example variants built with one gene track might
not have any hits in another.

diff --git src/hg/hgVai/hgVai.c src/hg/hgVai/hgVai.c
index 10c61a2..72e13fe 100644
--- src/hg/hgVai/hgVai.c
+++ src/hg/hgVai/hgVai.c
@@ -1163,39 +1163,41 @@
 	updateGratorList(grator, pGratorList);
 	}
     else
 	grator->setOverlapRule(grator, agoMustOverlap);
     }
 }
 
 static void getCartPosOrDie(char **retChrom, uint *retStart, uint *retEnd)
 /* Get chrom:start-end from cart, errAbort if any problems. */
 {
 char *position = cartString(cart, hgvaRange);
 if (! parsePosition(position, retChrom, retStart, retEnd))
     errAbort("Expected position to be chrom:start-end but got '%s'", position);
 }
 
-static char *sampleVariantsPath(struct annoAssembly *assembly)
-/* Construct a path for a trash file of contrived example variants for this assembly. */
+static char *sampleVariantsPath(struct annoAssembly *assembly, char *geneTrack)
+/* Construct a path for a trash file of contrived example variants for this assembly
+ * and gene track. */
 {
 char *chrom = NULL;
 uint start = 0, end = 0;
 getCartPosOrDie(&chrom, &start, &end);
 char *subDir = "hgv";
 mkdirTrashDirectory(subDir);
-struct dyString *dy = dyStringCreate("%s/%s/%s_%s_%u-%u.vcf", trashDir(), subDir, assembly->name,
+struct dyString *dy = dyStringCreate("%s/%s/%s_%s_%s_%u-%u.vcf",
+				     trashDir(), subDir, assembly->name, geneTrack,
 				     chrom, start, end);
 return dyStringCannibalize(&dy);
 }
 
 static void writeMinimalVcfHeader(FILE *f, char *db)
 /* Write header for VCF with no meaningful qual, filter, info or genotype data. */
 {
 fputs("##fileformat=VCFv4.1\n", f);
 fprintf(f, "##reference=%s\n", db);
 fputs("#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n", f);
 }
 
 static void mutateBase(char *pBase)
 /* Change *pBase into a different base. */
 {
@@ -1387,31 +1389,31 @@
     }
 if (!exonOnly && basesRight > 0)
     // SNV, up/downstream to the left
     addSnv(&bedList, gp->chrom, gp->txEnd + 1, "ex_updownRight");
 return bedList;
 }
 
 // margin for intergenic variants around transcript:
 #define IGFUDGE 5
 
 static struct annoStreamer *makeSampleVariantsStreamer(struct annoAssembly *assembly,
 						       struct trackDb *geneTdb, int maxOutRows)
 /* Construct a VCF file of example variants for db (unless it already exists)
  * and return an annoStreamer for that file.  If possible, make the variants hit a gene. */
 {
-char *sampleFile = sampleVariantsPath(assembly);
+char *sampleFile = sampleVariantsPath(assembly, geneTdb->track);
 boolean forceRebuild = cartUsualBoolean(cart, "hgva_rebuildSampleVariants", FALSE);
 if (! fileExists(sampleFile) || forceRebuild)
     {
     struct annoStreamer *geneStream = streamerFromTrack(assembly, geneTdb->table, geneTdb, NULL,
 							NO_MAXROWS);
     boolean gotCoding = FALSE, gotNonCoding = FALSE;
     struct genePred *gpList = genesFromPosition(geneStream, &gotCoding, &gotNonCoding);
     FILE *f = mustOpen(sampleFile, "w");
     writeMinimalVcfHeader(f, assembly->name);
     if (gpList == NULL)
 	{
 	warn("Unable to find any gene transcripts in '%s' (%s)",
 	     geneTdb->shortLabel, geneTdb->track);
 	writeArbitraryVariants(f, assembly);
 	}