563adc90807da9003fd6c31c872a503f2e07693e
galt
  Thu Mar 10 14:00:46 2016 -0800
Fixes #16975. hgc: we need to only use nonVirtPosition in certain more-specific conditions.

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 5764325..142d695 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -24702,51 +24702,55 @@
     {
     validateGisaidUser(cart);
     }
 
 /*	database and organism are global variables used in many places	*/
 getDbAndGenome(cart, &database, &genome, NULL);
 organism = hOrganism(database);
 scientificName = hScientificName(database);
 
 initGenbankTableNames(database);
 
 dbIsFound = trackHubDatabase(database) || sqlDatabaseExists(database);
 
 // Try to deal with virt chrom position used by hgTracks.
 // Hack the cart vars to set to a non virtual chrom mode position
-if (startsWith("virt:", cartUsualString(cart, "position", "")))
+if (sameString("virt", cartString(cart, "c"))
+ || sameString("getDna", cartUsualString(cart, "g", "")) )
     {
-    char *nvPos = cartUsualString(cart, "nonVirtPosition", "");
-    /* parse non-virtual position */
+    char *nvPos = cartUsualString(cart, "nonVirtPosition", NULL);
+    if (nvPos)
+	{
+	// parse non-virtual position 
 	char *pos = cloneString(nvPos);
 	char *colon = strchr(pos, ':');
 	if (!colon)
 	errAbort("position has no colon");
 	char *dash = strchr(pos, '-');
 	if (!dash)
 	errAbort("position has no dash");
 	*colon = 0;
 	*dash = 0;
 	char *chromName = cloneString(pos);
 	int winStart = atol(colon+1) - 1;
 	int winEnd = atol(dash+1);
 	cartSetString(cart, "position", nvPos);
 	cartSetString(cart, "c", chromName);
 	cartSetInt(cart, "l", winStart);
 	cartSetInt(cart, "r", winEnd);
 	}
+    }
 
 
 if (dbIsFound)
     seqName = hgOfficialChromName(database, cartString(cart, "c"));
 else
     seqName = cartString(cart, "c");
 
 winStart = cartUsualInt(cart, "l", 0);
 winEnd = cartUsualInt(cart, "r", 0);
 
 /* Allow faked-out c=0 l=0 r=0 (e.g. for unaligned mRNAs) but not just any
  * old bogus position: */
 if (seqName == NULL)
     {
     if (winStart != 0 || winEnd != 0)