957e6639419c3faf3ca76d891903ea3023681555
kent
Tue Jun 28 18:02:27 2022 -0700
Making 'View details of parts of alignment within browser window.' link on bigPsl and psl work better when query sequence is big.
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 0c22794..6dc9a51 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -6435,31 +6435,30 @@
/* Print list of mRNA alignments with special "in window" alignment function. */
{
if (pslList == NULL || tableName == NULL)
return;
printAlignmentsSimple(pslList, startFirst, hgcCommand, tableName, itemIn);
struct psl *psl = pslList;
for (psl = pslList; psl != NULL; psl = psl->next)
{
if ( pslTrimToTargetRange(psl, winStart, winEnd) != NULL
&&
!startsWith("xeno", tableName)
&& !(startsWith("user", tableName) && pslIsProtein(psl))
&& psl->tStart == startFirst
&& sameString(psl->tName, seqName)
- && psl->qSize <= MAX_DISPLAY_QUERY_SEQ_SIZE
)
{
char otherString[512];
safef(otherString, sizeof(otherString), "%d&aliTable=%s",
psl->tStart, tableName);
hgcAnchorSomewhere(hgcCommandInWindow, itemIn, otherString, psl->tName);
printf("
View details of parts of alignment within browser window.
\n");
}
}
}
void printAlignments(struct psl *pslList, int startFirst, char *hgcCommand,
char *tableName, char *itemIn)
/* Print list of mRNA alignments. */
{
@@ -7530,31 +7529,31 @@
fprintf(f, "
Cannot display alignment. Size of rna %s is %d has changed since alignment was performed when it was %d.\n", + wholePsl->qName, rnaSize, wholePsl->qSize); + return 0; + } + +/* Possibly just do smaller subset that is within window. */ +struct psl *psl = wholePsl; +if (restrictToWindow) + { + psl = pslTrimToTargetRange(wholePsl, winStart, winEnd); + if (psl == NULL) + fprintf(body, "
No alignment of %s within browser window.", wholePsl->qName); + } + struct dnaSeq *dnaSeq; int wholeTStart; -int partTStart = wholePsl->tStart, partTEnd = wholePsl->tEnd; -DNA *rna; -int rnaSize; +int partTStart = psl->tStart, partTEnd = psl->tEnd; +DNA *rna = rnaSeq->dna; boolean isRc = FALSE; -struct ffAli *wholeFfAli; +struct ffAli *ffAli; int blockCount; -/* Get RNA sequence and convert psl to ffAli. */ -rna = rnaSeq->dna; -rnaSize = rnaSeq->size; - -/* Don't forget -- this may change wholePsl! */ -wholeFfAli = pslToFfAliAndSequence(wholePsl, rnaSeq, &isRc, &dnaSeq, +/* Don't forget -- this may change psl if on reverse strand! */ +ffAli = pslToFfAliAndSequence(psl, rnaSeq, &isRc, &dnaSeq, &wholeTStart); +int rnaStart = 0; +int rnaEnd = rnaSize; + if (restrictToWindow) { - partTStart = max(wholePsl->tStart, winStart); - partTEnd = min(wholePsl->tEnd, winEnd); + /* Find start/end in ffAli, which is clipped to target from PSL and maybe RC'd */ + ffStartEndQ(rna, ffAli, &rnaStart, &rnaEnd); + + /* Add 100 bases either side if possible */ + if (rnaStart >= 100) rnaStart -= 100; + if (rnaEnd + 100 <= rnaSize) rnaEnd += 100; } /* Write body heading info. */ fprintf(body, "
Cannot display alignment. Size of rna %s is %d has changed since alignment was performed when it was %d.\n", - wholePsl->qName, rnaSize, wholePsl->qSize); - return 0; - } - -blockCount = ffShAliPart(body, wholeFfAli, wholePsl->qName, - rna, rnaSize, 0, +blockCount = ffShAliPart(body, ffAli, wholePsl->qName, + rna + rnaStart, rnaEnd - rnaStart, rnaStart, dnaSeq->name, dnaSeq->dna, dnaSeq->size, wholeTStart, 8, FALSE, isRc, FALSE, TRUE, TRUE, TRUE, TRUE, cdsS, cdsE, partTStart, partTEnd); return blockCount; } void showSomeAlignment(struct psl *psl, bioSeq *oSeq, enum gfType qType, int qStart, int qEnd, char *qName, int cdsS, int cdsE) /* Display protein or DNA alignment in a frame. */ { int blockCount, i; struct tempName indexTn, bodyTn; FILE *index, *body;