src/hg/hgc/hgc.c 1.1516

1.1516 2009/03/09 21:43:44 angie
Added support for hapmapSnpsPhaseII track (replaced by the new PhaseIII track in 18, but kept around in case folks relied on its het. calcs).
Index: src/hg/hgc/hgc.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/hgc.c,v
retrieving revision 1.1515
retrieving revision 1.1516
diff -b -B -U 4 -r1.1515 -r1.1516
--- src/hg/hgc/hgc.c	9 Mar 2009 18:59:59 -0000	1.1515
+++ src/hg/hgc/hgc.c	9 Mar 2009 21:43:44 -0000	1.1516
@@ -18570,9 +18570,11 @@
 int majorCount = 0;
 int minorCount = 0;
 char *majorAllele = NULL;
 char *minorAllele = NULL;
-char *popCode = table + strlen("hapmapSnps");
+char popCode[4];
+safencpy(popCode, sizeof(popCode), table + strlen("hapmapSnps"), 3);
+popCode[3] = '\0';
 
 genericHeader(tdb, itemName);
 
 safef(query, sizeof(query),
@@ -18655,14 +18657,14 @@
     printf("<B>Human Strand: </B> %s\n", ortho->strand);
     printf("<BR>");
     printf("<B>Polymorphism type:</B> %s<BR>\n", ortho->observed);
 
-    if (sameString(table, "hapmapAllelesChimp"))
+    if (startsWith("hapmapAllelesChimp", table))
         {
         otherDb = "panTro2";
 	otherDbName = "Chimp";
 	}
-    if (sameString(table, "hapmapAllelesMacaque"))
+    if (startsWith("hapmapAllelesMacaque", table))
         {
         otherDb = "rheMac2";
 	otherDbName = "Macaque";
 	}
@@ -21873,14 +21875,16 @@
 else if (sameString("dvBed", track))
     {
     doDv(tdb, item);
     }
-else if (startsWith("hapmapSnps", track) && strlen(track) == 13)
+else if (startsWith("hapmapSnps", track) &&
+	 (strlen(track) == 13 ||
+	  (endsWith(track, "PhaseII") && strlen(track) == 20)))
     {
     doHapmapSnps(tdb, item);
     }
-else if (sameString("hapmapAllelesChimp", track) ||
-         sameString("hapmapAllelesMacaque", track))
+else if (startsWith("hapmapAllelesChimp", track) ||
+         startsWith("hapmapAllelesMacaque", track))
     {
     doHapmapOrthos(tdb, item);
     }
 else if (sameString("snpArrayAffy250Nsp", track) ||