1f113a15a2cbcbdfeb4040188432cd3d013a57be
hiram
  Mon Jun 27 14:56:13 2016 -0700
allow chain/net coloring of contig based assemblies with WGS naming schemes refs #17580

diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index 64e00c6..1d256b8 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -26,30 +26,31 @@
 #include "wiggle.h"
 #include "lfs.h"
 #include "grp.h"
 #include "chromColors.h"
 #include "hgTracks.h"
 #include "subText.h"
 #include "cds.h"
 #include "mafTrack.h"
 #include "wigCommon.h"
 #include "hui.h"
 #include "imageV2.h"
 #include "bigBed.h"
 #include "htmshell.h"
 #include "kxTok.h"
 #include "hash.h"
+#include "regexHelper.h"
 
 #ifndef GBROWSE
 #include "encode.h"
 #include "expRatioTracks.h"
 #include "hapmapTrack.h"
 #include "retroGene.h"
 #include "switchGear.h"
 #include "variation.h"
 #include "wiki.h"
 #include "wormdna.h"
 #include "aliType.h"
 #include "agpGap.h"
 #include "cgh.h"
 #include "bactigPos.h"
 #include "genePred.h"
@@ -9018,30 +9019,39 @@
 char *maybeSkipPrefix(char *name, char *prefixes[])
 /* Return a pointer into name just past the first matching string from
  * prefixes[], if found.  If none are found, return NULL. */
 {
 char *skipped = NULL;
 int i = 0;
 for (i = 0;  prefixes[i] != NULL;  i++)
     {
     skipped = stringIn(prefixes[i], name);
     if (skipped != NULL)
 	{
 	skipped += strlen(prefixes[i]);
 	break;
 	}
     }
+/* perhaps a contig name of some other prefix */
+if (NULL == skipped && scaffoldPrefixes == prefixes)
+    {
+    skipped = cloneString(name);
+    chopSuffixAt(skipped, 'v');  /* remove the vNN version, usually v1 */
+    eraseNonDigits(skipped);  /* strip characters, leave digits only */
+    if (0 == strlen(skipped))  /* if none left, did not work */
+       skipped = NULL;
+    }
 return skipped;
 }
 
 Color getScaffoldColor(char *scaffoldNum, struct hvGfx *hvg)
 /* assign fake chrom color to scaffold/contig, based on number */
 {
 int chromNum = atoi(scaffoldNum) % CHROM_COLORS;
 if (!chromosomeColorsMade)
     makeChromosomeShades(hvg);
 if (chromNum < 0 || chromNum > CHROM_COLORS)
     chromNum = 0;
 return chromColor[chromNum];
 }
 
 Color getSeqColorDefault(char *seqName, struct hvGfx *hvg, Color defaultColor)