216820a8ff1f917b2697c2611afde25722f57192 ceisenhart Tue Mar 8 11:42:50 2016 -0800 Changing variable names, refs #16216 diff --git src/hg/expMatrixToJson/expMatrixToJson.c src/hg/expMatrixToJson/expMatrixToJson.c index f5aae6e..8bea130 100644 --- src/hg/expMatrixToJson/expMatrixToJson.c +++ src/hg/expMatrixToJson/expMatrixToJson.c @@ -380,70 +380,69 @@ if (el->vector[i] > el->topGeneIndeces->val){ slPopHead(el->topGeneIndeces); struct slDoubleInt *newGene = slDoubleIntNew(diff, index); slAddHead(&el->topGeneIndeces, newGene); slSort(&el->topGeneIndeces, slDoubleIntCmp); } } } } slReverse(&el->topGeneIndeces); el->mergeCount = mergeCount; el->children = kid1->children + kid2->children; return (struct slList *)(el); } -int tempC = 0; -const struct slList *temp = NULL; +const struct slList *lastLeaf = NULL; bool slBioExpVectorCmp(const struct slList *item1, const struct slList *item2, void *unusedExtraData) /* Compare two bioExpVectors to decide which one becomes the left child and which becomes the right. * Return TRUE if item 1 is left child and item 2 is right child. */ { const struct bioExpVector *kid1 = (const struct bioExpVector *)item1; const struct bioExpVector *kid2 = (const struct bioExpVector *)item2; - if (kid1->children !=1 && kid2->children ==1) temp = item2; - if (kid1->children ==1 && kid2->children !=1) temp = item1; + if (kid1->children !=1 && kid2->children ==1) lastLeaf = item2; + if (kid1->children ==1 && kid2->children !=1) lastLeaf = item1; if (kid1->children > kid2->children) { return TRUE; // Whoever has more kids gets to be first born } else if (kid1->children < kid2->children)return FALSE; else{ if (kid1->mergeCount < kid2->mergeCount) return TRUE; else if (kid1->mergeCount > kid2->mergeCount) return FALSE; else{ // These are two leaf siblings, things get a bit tricky here... // First we find the closest neighbor (who should be a firstborn) - if (temp == NULL) + if (lastLeaf == NULL) { // This is the very first merge, not certain how to handle it so lets just return True for now - temp = item1; + lastLeaf = item1; return TRUE; } else{ - double score1 = slBioExpVectorDistance(item1, temp, NULL); - double score2 = slBioExpVectorDistance(item2, temp, NULL); + double score1 = slBioExpVectorDistance(item1, lastLeaf, NULL); + double score2 = slBioExpVectorDistance(item2, lastLeaf, NULL); if (score1 < score2) { - temp = item2; + lastLeaf = item2; return TRUE; } else{ - temp = item1; + lastLeaf = item1; return FALSE; } } } } } void colorLeaves(struct slRef *leafList) /* Assign colors to leaves. I am very unhappy with the inconsistencies here. Namely the when you have two leaf siblings * they are essentially assigned at random, which makes this metric fairly useless? Im less than stoked*/ { float total = 0.0; struct slRef *el, *nextEl; /* Loop through list once to figure out the longest distance since we need to normalize */