7f021aafa6227fd30ed117d1201215c59ccfd98e kate Mon Nov 17 02:27:42 2014 -0800 Try another translate function -- fixes apparent mem problem. refs #14054 diff --git src/hg/hgTracks/peptideAtlasTrack.c src/hg/hgTracks/peptideAtlasTrack.c index 92924a2..f4db865 100644 --- src/hg/hgTracks/peptideAtlasTrack.c +++ src/hg/hgTracks/peptideAtlasTrack.c @@ -43,43 +43,51 @@ *minStart = hChromSize(database, chromName); *maxEnd = 0; struct linkedFeatures *lf; for (lf = (struct linkedFeatures *)tg->items; lf != NULL; lf = lf->next) { *minStart = min(*minStart, lf->start); *maxEnd = max(*maxEnd, lf->end); } } static char *peptideAtlasItemName(struct track *tg, void *item) /* Display peptide sequence translated from genome as item name. * This suffices since all PeptideAtlas peptide mappings (in Aug 2014 human build) * are perfect matches to genome */ { +struct dnaSeq *dnaSeq; if (tg->customPt == NULL) { int minStart, maxEnd; linkedFeaturesRange(tg, &minStart, &maxEnd); struct dnaBuf *dnaBuf; AllocVar(dnaBuf); - struct dnaSeq *dnaSeq = hDnaFromSeq(database, chromName, minStart, maxEnd, dnaLower); + dnaSeq = hDnaFromSeq(database, chromName, minStart, maxEnd, dnaLower); dnaBuf->dna = dnaSeq->dna; dnaBuf->chromStart = minStart; dnaBuf->chromEnd = maxEnd; tg->customPt = dnaBuf; } struct linkedFeatures *lf = (struct linkedFeatures *)item; DNA *dna = dnaForLinkedFeature(lf, (struct dnaBuf *)tg->customPt); -int size = strlen(dna)/3 + 1; -AA *peptide = needMem(size); -dnaTranslateSome(dna, peptide, size); -return peptide; + +/* Too bad this lib function fails here, so a bit more code needed */ +//AA *peptide = needMem(size); +//dnaTranslateSome(dna, peptide, size); + +AllocVar(dnaSeq); +dnaSeq->dna = dna; +dnaSeq->size = (int)strlen(dna); +dnaSeq->name = ""; +aaSeq *peptide = translateSeqN(dnaSeq, 0, 0, FALSE); +return peptide->dna; } void peptideAtlasMethods(struct track *tg) /* Item label is peptide sequence translated from genome */ { tg->itemName = peptideAtlasItemName; }