482d00125fb0fcdf3097ed02cf06fde08331f557 hiram Wed Sep 28 22:48:14 2016 -0700 avoid trouble when there is no RNA sequence for an item in the ncbiRefSeq track refs #13673 diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 77da76f..7659c99 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -7383,34 +7383,41 @@ { rnaSeq = getBaseColorSequence(acc, aliTable); } else { char *cdnaTable = NULL; struct trackDb *tdb = hashFindVal(trackHash, aliTable); if (tdb != NULL) cdnaTable = trackDbSetting(tdb, "cdnaTable"); if (isNotEmpty(cdnaTable) && hTableExists(database, cdnaTable)) rnaSeq = hGenBankGetMrna(database, acc, cdnaTable); else rnaSeq = hRnaSeq(database, acc); } +if (NULL == rnaSeq) + { + printf("RNA sequence not found: '%s'", acc); + } +else + { if (startsWith("xeno", aliTable)) showSomeAlignment(psl, rnaSeq, gftDnaX, 0, rnaSeq->size, NULL, cdsStart, cdsEnd); else showSomeAlignment(psl, rnaSeq, gftDna, 0, rnaSeq->size, NULL, cdsStart, cdsEnd); + } hFreeConn(&conn); } void htcCdnaAliInWindow(char *acc) /* Show part of alignment in browser window for accession. */ { char query[256]; char table[64]; struct sqlConnection *conn; struct sqlResult *sr; char **row; struct psl *wholePsl, *partPsl; struct dnaSeq *rnaSeq; char *aliTable; int start; @@ -11824,64 +11831,80 @@ printf("%s
\n", nrl->name); } } if ((trackVersion != NULL) && !isEmpty(trackVersion->version)) { printf("Annotation Release: %s
", trackVersion->comment, trackVersion->version); } htmlHorizontalLine(); if (differentWord("", nrl->description)) { printf("Summary of %s
\n%s
\n", nrl->name, nrl->description); htmlHorizontalLine(); } +static boolean hasSequence = TRUE; struct psl *pslList = getAlignments(conn, "ncbiRefSeqPsl", itemName); // if the itemName isn't found, it might be found as the nrl->mrnaAcc if (! pslList) pslList = getAlignments(conn, "ncbiRefSeqPsl", nrl->mrnaAcc); if (pslList) { + char query[256]; + /* verify itemName has RNA sequence to work with */ + sqlSafef(query, sizeof(query), "select id from seqNcbiRefSeq where acc='%s' limit 1", itemName); + char * result= sqlQuickString(conn, query); + if (isEmpty(result)) + { + printf ("

there is NO alignment for %s

\n", itemName); + hasSequence = FALSE; + } + else + { + printf("

mRNA/Genomic Alignments (%s)

", itemName); int start = cartInt(cart, "o"); - printf("

mRNA/Genomic Alignments

"); printAlignments(pslList, start, "htcCdnaAli", "ncbiRefSeqPsl", itemName); } + } else { printf ("

there is NO alignment for %s


\n", itemName); } htmlHorizontalLine(); if (!sameString(tdb->track, "ncbiRefSeqPsl")) showGenePos(itemName, tdb); printf("

Links to sequence:

\n"); printf("\n"); printTrackHtml(tdb); hFreeConn(&conn); } void doRefGene(struct trackDb *tdb, char *rnaName) /* Process click on a known RefSeq gene. */ { struct sqlConnection *conn = hAllocConn(database);