void musAliAt(char *database, char *chrom, char *humanFa, char *mouseFa) /* musAliAt - Produce .fa files where mouse alignments hit on chr22. */ { char query[256], **row; struct sqlResult *sr; struct sqlConnection *conn; struct dnaSeq *musSeq, *homoSeq; struct psl *psl; struct hash *musHash = newHash(10); FILE *musOut = mustOpen(mouseFa, "w"); hSetDb(database); conn = hAllocConn(); sqlSafef(query, sizeof query, "select * from blatMouse where tName = '%s'", chrom); sr = sqlGetResult(conn, query); while ((row = sqlNextRow(sr)) != NULL) { psl = pslLoad(row); if ((musSeq = hashFindVal(musHash, psl->qName)) == NULL) { musSeq = hExtSeq(psl->qName); hashAdd(musHash, psl->qName, NULL); faWriteNext(musOut, musSeq->name, musSeq->dna, musSeq->size); freeDnaSeq(&musSeq); } pslFree(&psl); } }
void retroShowCdnaAli(char *mappedId) /* Show alignment for accession, mostly ripped off from htcCdnaAli */ { char *track = cartString(cart, "aliTable"); struct trackDb *tdb = hashMustFindVal(trackHash, track); char *table = cartString(cart, "table"); int start = cartInt(cart, "o"); struct sqlConnection *conn = hAllocConn(database); struct sqlConnection *defDbConn = NULL; struct mappingInfo *mi = mappingInfoNew(conn, table, mappedId); struct genbankCds cds = getCds(conn, mi); struct psl *psl; struct dnaSeq *rnaSeq = NULL; char *spec = trackDbRequiredSetting(tdb, BASE_COLOR_USE_SEQUENCE); char *specCopy = cloneString(spec); char *words[3]; int nwords = chopByWhite(specCopy, words, ArraySize(words)); char acc[512]; /* Print start of HTML. */ writeFramesetType(); puts("<HTML>"); printf("<HEAD>\n<TITLE>%s vs Genomic [%s]</TITLE>\n</HEAD>\n\n", mi->seqId, track); /* Look up alignment and sequence in database. Always get sequence * from defaultDb */ psl = loadAlign(conn, mi, start); if (startsWith("August",mi->geneSet)) safef(acc, sizeof(acc), "aug-%s.T1",mi->seqId); else safef(acc, sizeof(acc), "%s",mi->seqId); // value is: extFile seqTbl extFileTbl if ((nwords != (int)ArraySize(words)) || !sameString(words[0], "extFile")) errAbort("invalid %s track setting: %s ", BASE_COLOR_USE_SEQUENCE, spec); char *seqTable = words[1]; char *extTable = words[2]; rnaSeq = hDnaSeqGet(database, acc, seqTable, extTable); if (rnaSeq == NULL) { char *acc = mi->seqId; rnaSeq = hExtSeq(database, acc); if (rnaSeq == NULL) errAbort("can't get mRNA sequence from %s prefix %s for %s from %s mappedId %s", database, mi->geneSet, acc, track, mappedId); } sqlDisconnect(&defDbConn); showSomeAlignment(psl, rnaSeq, gftDna, 0, rnaSeq->size, NULL, cds.start, cds.end); pslFree(&psl); dnaSeqFree(&rnaSeq); mappingInfoFree(&mi); hFreeConn(&conn); }