8d9367da0e57755641dbbf6498093f7e44f14f12
angie
  Sat Jun 20 13:27:08 2020 -0700
VCF: support up to 64k genotypes, including haplotype+tree display.  sorta refs #25278
The VCF parser currently has a hardcoded upper limit on the number of genotype columns.
I increased that from 16k to 64k to support Rob Lanfear's SARS-CoV-2 tree w/40k nodes.
It will keep growing, so I will probably want to revisit so that we allocate the array
size needed instead of a hardcoded huge size when most VCF tracks don't have anywhere
near that many.
In vcfTracks.c, using 'unsigned short' for the gtHapOrder array limits the number of
samples to 32k because the index into gtHapOrder is gtIx<<1+hapIx.  Changed all the
shorts to ints because we now have VCF with more than 32k genotype columns.

diff --git src/lib/vcf.c src/lib/vcf.c
index b19c904..511315e 100644
--- src/lib/vcf.c
+++ src/lib/vcf.c
@@ -391,31 +391,31 @@
 {
 if (! sameString(exp1, words[ix]))
     {
     if (exp2 == NULL)
 	vcfFileErr(vcff, "Expected column %d's name in header to be \"%s\" but got \"%s\"",
 		   ix+1, exp1, words[ix]);
     else if (! sameString(exp2, words[ix]))
 	vcfFileErr(vcff, "Expected column %d's name in header to be \"%s\"  or \"%s\" "
 		   "but got \"%s\"", ix+1, exp1, exp2, words[ix]);
     }
 }
 
 #define expectColumnName(vcff, exp, words, ix) expectColumnName2(vcff, exp, NULL, words, ix)
 
 // There might be a whole lot of genotype columns...
-#define VCF_MAX_COLUMNS 16 * 1024
+#define VCF_MAX_COLUMNS 64 * 1024
 #define VCF_MIN_COLUMNS 8
 
 char *vcfDefaultHeader = "#CHROM POS ID REF ALT QUAL FILTER INFO";
 /* Default header if we have none. */
 
 static void parseColumnHeaderRow(struct vcfFile *vcff, char *line)
 /* Make sure column names are as we expect, and store genotype sample IDs if any are given. */
 {
 char *words[VCF_MAX_COLUMNS];
 int wordCount = chopLine(line+1, words);
 if (wordCount >= VCF_MAX_COLUMNS)
     vcfFileErr(vcff, "header contains at least %d columns; "
 	       "VCF_MAX_COLUMNS may need to be increased in vcf.c!", VCF_MAX_COLUMNS);
 if (wordCount < VCF_MIN_COLUMNS)
     errAbort("VCF header missing at least one of the required VCF fields");