15d0836b4dba65919e83ce5ef0aaafe5a0edc72f
angie
  Wed Apr 17 12:49:53 2013 -0700
Making annoGratorGpVar able to handle VCF input too.  In order for a grator tosee what type of input is coming from the primary source, the streamer should
be passed in along with the primary row, as it is for formatters now.
refs #6152

diff --git src/lib/vcf.c src/lib/vcf.c
index ced7d64..5f55c5d 100644
--- src/lib/vcf.c
+++ src/lib/vcf.c
@@ -1069,15 +1069,38 @@
                                   "semicolon-separated list of codes for filters that fail\""
         "    string info;       \"Additional information encoded as a semicolon-separated series "
                                  "of short keys with optional comma-separated values\""
         "    string format;     \"If genotype columns are specified in header, a "
                                  "semicolon-separated list of of short keys starting with GT\""
         "    string genotypes;  \"If genotype columns are specified in header, a tab-separated "
                                  "set of genotype column values; each value is a colon-separated "
                                  "list of values corresponding to keys in the format column\""
         "    )";
 
 struct asObject *vcfAsObj()
 // Return asObject describing fields of VCF
 {
 return asParseText(vcfDataLineAutoSqlString);
 }
+
+char *vcfGetSlashSepAllelesFromWords(char **words, struct dyString *dy)
+/* Overwrite dy with a /-separated allele string from VCF words;
+ * return dy->string for convenience. */
+{
+dyStringClear(dy);
+// VCF reference allele gets its own column:
+dyStringAppend(dy, words[3]);
+// VCF alternate alleles are comma-separated, make them /-separated:
+if (isNotEmpty(words[4]))
+    {
+    char *altAlleles = words[4], *p;
+    while ((p = strchr(altAlleles, ',')) != NULL)
+	{
+	dyStringAppendC(dy, '/');
+	dyStringAppendN(dy, altAlleles, p-altAlleles);
+	altAlleles = p+1;
+	}
+    dyStringAppendC(dy, '/');
+    dyStringAppend(dy, altAlleles);
+    }
+return dy->string;
+}