f5e5acfc5f061832ca18782ebe560a285037ccf8 angie Wed Feb 12 11:40:12 2014 -0800 Use a little more smarts in looking for snpNNNSeq.fa file so it's notalways necessary to add snpSeqFile settings for snpNNN{Common,Mult,Flagged} tracks. refs #12490 diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index a986afc..34bfafb 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -15218,46 +15218,49 @@ } } sqlSafef(query, sizeof(query), "select file_offset from %s where acc='%s'", snpSeqTable, snp->name); sr = sqlGetResult(conn, query); row = sqlNextRow(sr); if (row == NULL) return -1; offset = sqlLongLong(row[0]); sqlFreeResult(&sr); hFreeConn(&conn); return offset; } -char *getSnpSeqFile(struct trackDb *tdb) +char *getSnpSeqFile(struct trackDb *tdb, int version) /* find location of snp.fa and test existence. */ { char *seqFile = trackDbSetting(tdb, "snpSeqFile"); if (isNotEmpty(seqFile)) { if (fileExists(seqFile)) return cloneString(seqFile); else return NULL; } char seqFileBuf[512]; safef(seqFileBuf, sizeof(seqFileBuf), "/gbdb/%s/snp/%s.fa", database, tdb->table); if (fileExists(seqFileBuf)) return cloneString(seqFileBuf); +safef(seqFileBuf, sizeof(seqFileBuf), "/gbdb/%s/snp/snp%d.fa", database, version); +if (fileExists(seqFileBuf)) + return cloneString(seqFileBuf); safef(seqFileBuf, sizeof(seqFileBuf), "/gbdb/%s/snp/snp.fa", database); if (fileExists(seqFileBuf)) return cloneString(seqFileBuf); return NULL; } void printNullAlignment(int l, int r, int q) /* Print out a double-sided gap for unaligned insertion SNP. */ { int digits = max(digitsBaseTen(r), digitsBaseTen(q)); printf("%0*d - %0*d\n" "%*s" " (dbSNP-annotated position was not re-aligned to " "observed allele code -- see adjacent alignments)\n" @@ -15349,31 +15352,31 @@ "dbSNP sequence (%s; %d bp)\n", tSeq->name, (tIsRc ? '-' : '+'), tSeq->size, qSeq->name, qSeq->size); for (axtBlock=axt; axtBlock !=NULL; axtBlock = axtBlock->next) { printf("ID (including gaps) %3.1f%%, coverage (of both) %3.1f%%\n\n", axtIdWithGaps(axtBlock)*100, axtCoverage(axtBlock, qSeq->size, tSeq->size)*100); printOffsetAndBoldAxt(axtBlock, lineWidth, ss, tOffset, qOffset, boldStart, boldEnd, tIsRc, tSeq->size, qSeq->size); } axtFree(&axt); hPrintf(""); } -void printSnpAlignment(struct trackDb *tdb, struct snp *snp) +void printSnpAlignment(struct trackDb *tdb, struct snp *snp, int version) /* Get flanking sequences from table; align and print */ { char *fileName = NULL; char *variation = NULL; char *line; struct lineFile *lf = NULL; int lineSize; static int maxFlank = 1000; static int lineWidth = 100; boolean gotVar = FALSE; boolean isNucleotide = TRUE; boolean leftFlankTrimmed = FALSE; boolean rightFlankTrimmed = FALSE; @@ -15388,31 +15391,31 @@ struct dnaSeq *dnaSeqDbSnp5 = NULL; struct dnaSeq *dnaSeqDbSnpO = NULL; struct dnaSeq *dnaSeqDbSnp3 = NULL; struct dnaSeq *seqDbSnp = NULL; struct dnaSeq *seqNib = NULL; int spaces = 0; int len5 = 0; int len3 = 0; int start = 0; int end = 0; int skipCount = 0; off_t offset = 0; -fileName = getSnpSeqFile(tdb); +fileName = getSnpSeqFile(tdb, version); if (!fileName) return; offset = getSnpSeqFileOffset(tdb, snp); if (offset == -1) return; lf = lineFileOpen(fileName, TRUE); lineFileSeek(lf, offset, SEEK_SET); /* skip the header line */ lineFileNext(lf, &line, &lineSize); if (!startsWith(">rs", line)) errAbort("Expected FASTA header, got this line:\n%s\nat offset %lld " "in file %s", line, (long long)offset, fileName); @@ -17548,31 +17551,31 @@ printSnp125Info(tdb, snp, version); doSnpEntrezGeneLink(tdb, itemName); } else errAbort("SNP %s not found at %s base %d", itemName, seqName, start); sqlFreeResult(&sr); printOtherSnpMappings(table, itemName, start, conn, rowOffset); puts("
"); // Make table for collapsible sections: puts(""); checkForGwasCatalog(conn, tdb, itemName); checkForHgdpGeo(conn, tdb, itemName, start); checkForHapmap(conn, tdb, itemName); checkForLsSnpMappings(conn, tdb->track, itemName); -printSnpAlignment(tdb, snpAlign); +printSnpAlignment(tdb, snpAlign, version); puts("
"); printTrackHtml(tdb); hFreeConn(&conn); } void doTigrGeneIndex(struct trackDb *tdb, char *item) /* Put up info on tigr gene index item. */ { char *animal = cloneString(item); char *id = strchr(animal, '_'); char buf[128]; if (id == NULL) {