ed496d15c35f690988929b82c11201336318183b max Tue Mar 27 12:37:43 2012 -0700 handling split codons and reverse strands diff --git src/hg/hgc/pubs.c src/hg/hgc/pubs.c index c7cca09..5ff910b 100644 --- src/hg/hgc/pubs.c +++ src/hg/hgc/pubs.c @@ -598,37 +598,52 @@ struct psl *psl = getAlignments(conn, pslTable, item); if (psl == NULL) errAbort("Couldn't find alignment at %s:%s", pslTable, item); oSeq = getSeq(conn, seqTable, item); if (oSeq == NULL) errAbort("%s is in pslTable but not in sequence table. Internal error.", item); enum gfType qt; if (psl->qSize!=oSeq->size) { qt = gftProt; // trying to correct pslMap's changes to qSize/qStarts and blockSizes + psl->strand[1]=psl->strand[0]; + psl->strand[0]='+'; + psl->strand[2]=0; psl->qSize = psl->qSize/3; psl->match = psl->match/3; + // Take care of codons that go over block boundaries: + // Convert a block with blockSizes=58,32 and qStarts=0,58, + // to blockSizes=19,11 and qStarts=0,19 int i; + int remaind = 0; for (i=0; iblockCount; i++) { psl->qStarts[i] = psl->qStarts[i]/3; - psl->blockSizes[i] = psl->blockSizes[i]/3; + + int bs = psl->blockSizes[i]; + remaind += (bs % 3); + if (remaind>=3) + { + bs += 1; + remaind -= 3; + } + psl->blockSizes[i] = bs/3; } } else qt = gftDna; showSomeAlignment(psl, oSeq, qt, 0, oSeq->size, NULL, 0, 0); } void doPubsDetails(struct trackDb *tdb, char *item) /* publications custom display */ { int start = cgiInt("o"); int end = cgiOptionalInt("t", 0);