3036016babe8c590902a2d7ca40215fff793b429 angie Mon Jul 28 15:33:49 2014 -0700 When showing SNPs' alleles on the reference genome + strand, if the userclicks "reverse" (revCmplDisp) show them on the - strand like other base displays (Base Position track, pgSnp/VCF, multiz). refs #13694 diff --git src/hg/hgTracks/variation.c src/hg/hgTracks/variation.c index 4b85511..bcfac14 100644 --- src/hg/hgTracks/variation.c +++ src/hg/hgTracks/variation.c @@ -497,31 +497,31 @@ dyStringPrintf(dy, "%s", al); } } else dyStringPrintf(dy, "%s", observedAlleles); return dyStringCannibalize(&dy); } static void setSnp125ExtendedNameObserved(struct snp125 *snpList, boolean useRefStrand) /* Append observed alleles to each snp's name, possibly reverse-complementing alleles * that were reported on the - strand. */ { struct snp125 *snpItem = snpList; for (; snpItem != NULL; snpItem = snpItem->next) { - boolean doRc = useRefStrand && snpItem->strand[0] == '-'; + boolean doRc = useRefStrand && ((snpItem->strand[0] == '-') ^ revCmplDisp); snpItem->name = snp125ExtendName(snpItem->name, NULL, snpItem->observed, doRc); } } void setSnp125ExtendedNameExtra(struct track *tg) /* add extra text to be drawn in snp name field. This works by walking through two sorted lists and updating the name value for the SNP list with data from a table of orthologous state information */ { char cartVar[512]; safef(cartVar, sizeof(cartVar), "%s.extendedNames", tg->tdb->track); boolean enabled = cartUsualBoolean(cart, cartVar, // Check old cart var name for backwards compatibility w/ old sessions: cartUsualBoolean(cart, "snp125ExtendedNames", FALSE)); @@ -555,31 +555,31 @@ if (orthoItem) slAddHead(&orthoItemList, orthoItem); } /* List of SNPs is already sorted, so sort list of Ortho info */ slSort(&orthoItemList, snpOrthoCmp); /* Walk through two sorted lists together */ struct snp125 *snpItem = tg->items; orthoItem = orthoItemList; while (snpItem!=NULL && orthoItem!=NULL) { /* check to see that we're not at the end of either list and that * the two list elements represent the same human position */ cmp = snpOrthoCmp(&snpItem, &orthoItem); - boolean doRc = useRefStrand && snpItem->strand[0] == '-'; + boolean doRc = useRefStrand && ((snpItem->strand[0] == '-') ^ revCmplDisp) ; if (cmp < 0) { // Update snp->name with observed alleles even if we don't have ortho data snpItem->name = snp125ExtendName(snpItem->name, NULL, snpItem->observed, doRc); snpItem = snpItem->next; continue; } if (cmp > 0) { orthoItem = orthoItem->next; continue; } /* update the snp->name with the ortho data */ snpItem->name = snp125ExtendName(snpItem->name, orthoItem->chimp, snpItem->observed, doRc); /* increment the list pointers */