e1ed9bc2135623e47714e0bcc69bbadf971a299a angie Wed Sep 14 14:24:48 2011 -0700 Track #34 (dbVar for human): Split ISCA Retrospective into 3subtracks by clinical interpretation (Benign, Pathogenic, Uncertain). Data update required code update because of changes in keywords. diff --git src/hg/hgTracks/gvfTrack.c src/hg/hgTracks/gvfTrack.c index f645dcc..5b1e99a 100644 --- src/hg/hgTracks/gvfTrack.c +++ src/hg/hgTracks/gvfTrack.c @@ -4,82 +4,83 @@ #include "hgTracks.h" #include "imageV2.h" #include "hdb.h" #include "bed8Attrs.h" static Color gvfColor(struct track *tg, void *item, struct hvGfx *hvg) /* Color item by var_type attribute, according to Deanna Church's document * SvRepresentation2.doc attached to redmine #34. */ { struct bed8Attrs *gvf = item; Color dbVarUnknown = hvGfxFindColorIx(hvg, 0xb2, 0xb2, 0xb2); int ix = stringArrayIx("var_type", gvf->attrTags, gvf->attrCount); if (ix < 0) return dbVarUnknown; char *varType = gvf->attrVals[ix]; -if (sameString(varType, "CNV")) +if (sameString(varType, "CNV") || sameString(varType, "copy_number_variation")) return MG_BLACK; -else if (sameString(varType, "Gain")) +else if (strstrNoCase(varType, "Gain")) return hvGfxFindColorIx(hvg, 0x00, 0x00, 0xff); -else if (sameString(varType, "Loss")) +else if (strstrNoCase(varType, "Loss")) return hvGfxFindColorIx(hvg, 0xff, 0x00, 0x00); -else if (sameString(varType, "Insertion")) +else if (strstrNoCase(varType, "Insertion")) return hvGfxFindColorIx(hvg, 0xff, 0xcc, 0x00); -else if (sameString(varType, "Complex")) +else if (strstrNoCase(varType, "Complex")) return hvGfxFindColorIx(hvg, 0x99, 0xcc, 0xff); -else if (sameString(varType, "Unknown")) +else if (strstrNoCase(varType, "Unknown")) return dbVarUnknown; -else if (sameString(varType, "Other")) +else if (strstrNoCase(varType, "Other")) return hvGfxFindColorIx(hvg, 0xcc, 0x99, 0xff); -else if (sameString(varType, "Inversion")) +else if (strstrNoCase(varType, "Inversion")) return hvGfxFindColorIx(hvg, 0x99, 0x33, 0xff); // Needs pattern -else if (sameString(varType, "LOH")) +else if (strstrNoCase(varType, "LOH")) return hvGfxFindColorIx(hvg, 0x00, 0x00, 0xff); // Needs pattern -else if (sameString(varType, "Everted")) +else if (strstrNoCase(varType, "Everted")) return hvGfxFindColorIx(hvg, 0x66, 0x66, 0x66); // Needs pattern -else if (sameString(varType, "Transchr")) +else if (strstrNoCase(varType, "Transchr")) return hvGfxFindColorIx(hvg, 0xb2, 0xb2, 0xb2); // Plus black vert. bar at broken end -else if (sameString(varType, "UPD")) +else if (strstrNoCase(varType, "UPD")) return hvGfxFindColorIx(hvg, 0x00, 0xff, 0xff); // Needs pattern return dbVarUnknown; } // Globals used for sorting: static struct hash *nameHash = NULL; static char *getAttributeVal(const struct bed8Attrs *gvf, char *tag) /* Return value corresponding to tag or NULL. Don't free result. */ { int ix = stringArrayIx(tag, gvf->attrTags, gvf->attrCount); if (ix >= 0) return(gvf->attrVals[ix]); return NULL; } static int gvfHierCmp(const void *va, const void *vb) /* Sort GVF so that children follow their parents, and children of the same parent * are sorted by var_type -- otherwise things are sorted by size,chromStart,name. */ { const struct bed8Attrs *a = *((struct bed8Attrs **)va); const struct bed8Attrs *b = *((struct bed8Attrs **)vb); char *aParentName = getAttributeVal(a, "Parent"); char *bParentName = getAttributeVal(b, "Parent"); if (bParentName != NULL && sameString(bParentName, a->name)) return -1; else if (aParentName != NULL && sameString(aParentName, b->name)) return 1; -else if (aParentName != NULL && bParentName != NULL && sameString(aParentName, bParentName)) +else if (aParentName != NULL && bParentName != NULL && sameString(aParentName, bParentName) && + getAttributeVal(a, "var_type") != NULL && getAttributeVal(b, "var_type") != NULL) return strcmp(getAttributeVal(a, "var_type"), getAttributeVal(b, "var_type")); else { const struct bed8Attrs *bedCmpA = a, *bedCmpB = b; if (aParentName != NULL) bedCmpA = hashFindVal(nameHash, aParentName); if (bParentName != NULL) bedCmpB = hashFindVal(nameHash, bParentName); int diff = 0; if (bedCmpA != NULL && bedCmpB != NULL) { // no need to compare chrom here diff = ((bedCmpB->chromEnd - bedCmpB->chromStart) - (bedCmpA->chromEnd - bedCmpA->chromStart)); if (diff == 0)