static int containedLocus ( MrfEntry* query, Locus* target ) { int overlap=0; if( query->isPairedEnd ) { // do this only if paired end int i; for( i=0; i<arrayMax( (query->read1).blocks ); i++) { MrfBlock* qBlock = arrp( (query->read1).blocks, i, MrfBlock); if( !strcmp( qBlock->targetName, target->chromosome) ) { if( positiveRangeIntersection( qBlock->targetStart, qBlock->targetEnd, target->start, target->end ) > 0 ) { overlap = 1; // found i = arrayMax( (query->read1).blocks ); // found, then stop } } } if( overlap == 0 ) { // not found in read 1, let's check read 2 for( i=0; i<arrayMax( (query->read2).blocks ); i++) { MrfBlock* qBlock = arrp( (query->read2).blocks, i, MrfBlock); if( !strcmp( qBlock->targetName, target->chromosome) ) { if( positiveRangeIntersection( qBlock->targetStart, qBlock->targetEnd, target->start, target->end ) > 0 ) { overlap = 1; // found i = arrayMax( (query->read2).blocks ); // found, then stop } } } } } return overlap; }
void fakeCdsToMrna(struct bed *bed, FILE *f) /* Generate a psl that mimics a perfect, single block alignment * between a CDS and the RNA it is part of. */ { /* Figure out sizes of all components. */ int cdsSize = 0, rnaSize = 0, startUtrSize = 0, endUtrSize = 0; int i; for (i=0; i<bed->blockCount; ++i) { int start = bed->chromStart + bed->chromStarts[i]; int end = start + bed->blockSizes[i]; startUtrSize += positiveRangeIntersection(bed->chromStart, bed->thickStart, start, end); cdsSize += positiveRangeIntersection(bed->thickStart, bed->thickEnd, start, end); endUtrSize += positiveRangeIntersection(bed->thickEnd, bed->chromEnd, start, end); rnaSize += end - start; } /* Figure out CDS start position. */ int cdsStart = (bed->strand[0] == '-' ? endUtrSize : startUtrSize); /* Output the 21 fields of a psl. */ fprintf(f, "%d\t0\t0\t0\t", cdsSize); fprintf(f, "0\t0\t0\t0\t"); fprintf(f, "+\t%s\t%d\t0\t%d\t", bed->name, cdsSize, cdsSize); fprintf(f, "%s\t%d\t%d\t%d\t", bed->name, rnaSize, cdsStart, cdsStart + cdsSize); fprintf(f, "1\t%d,\t0,\t%d,\n", cdsSize, cdsStart); }
static void addOverlap(void *v) /* Callback to add item to range list. */ { struct range *r = v; totalOverlap += positiveRangeIntersection(r->start, r->end, overlapStart, overlapEnd); }
static boolean isHapRegionAln(struct hapRegions *hr, struct hapChrom *hapChrom, struct cDnaAlign *refAln) /* test if aln overlaps the hap region for the specified hapChrom */ { return alnInHapRegion(hr, refAln) && sameString(refAln->psl->tName, hapChrom->refChrom->chrom) && positiveRangeIntersection(refAln->psl->tStart, refAln->psl->tEnd, hapChrom->refStart, hapChrom->refEnd); }
void bedIntersect(char *aFile, char *bFile, char *outFile) /* bedIntersect - Intersect two bed files. */ { struct lineFile *lf = lineFileOpen(aFile, TRUE); struct hash *bHash = readBed(bFile); FILE *f = mustOpen(outFile, "w"); char *row[40]; int wordCount; while ((wordCount = (strictTab ? lineFileChopTab(lf, row) : lineFileChop(lf, row))) != 0) { char *chrom = row[0]; int start = lineFileNeedNum(lf, row, 1); int end = lineFileNeedNum(lf, row, 2); if (start > end) errAbort("start after end line %d of %s", lf->lineIx, lf->fileName); if (start == end && !allowStartEqualEnd) lineFileAbort(lf, "start==end (if this is legit, use -allowStartEqualEnd)"); struct binKeeper *bk = hashFindVal(bHash, chrom); if (bk != NULL) { struct binElement *hitList = NULL, *hit; if (allowStartEqualEnd && start == end) hitList = binKeeperFind(bk, start-1, end+1); else hitList = binKeeperFind(bk, start, end); if (aHitAny) { for (hit = hitList; hit != NULL; hit = hit->next) { float cov = getCov(start, end, hit->val); if (cov >= minCoverage) { outputBed(f, row, wordCount, start, end, hit->val); break; } else { struct bed5 *b = hit->val; verbose(1, "filter out %s %d %d %d %d overlap %d %d %d %.3f\n", chrom, start, end, b->start, b->end, positiveRangeIntersection(start, end, b->start, b->end), end-start, b->end-b->start, cov); } } } else { for (hit = hitList; hit != NULL; hit = hit->next) { if (getCov(start, end, hit->val) >= minCoverage) outputBed(f, row, wordCount, start, end, hit->val); } } slFreeList(&hitList); } } }
int chainBaseCountSubQ(struct chain *chain, int qMin, int qMax) /* Return number of bases in gap free alignments in chain between * tMin and tMax. */ { struct cBlock *b; int total = 0; for (b = chain->blockList; b != NULL; b = b->next) total += positiveRangeIntersection(b->qStart, b->qEnd, qMin, qMax); return total; }
void gpPartOutAsCds(struct genePred *gp, int partStart, int partEnd, FILE *f, char *type, int id) /* Write out CDS region of this fragment of gp. It may in fact be empty, * which we'll represent as start=0, end=0 */ { /* Truncate cds to fit inside of the interval we're actually outputting. * If this results in us losing the CDS, just output a stub quickly. */ fprintf(f, "%s_%d_%s\t", type, id, gp->name); int genoCdsStart = max(partStart, gp->cdsStart); int genoCdsEnd = min(partEnd, gp->cdsEnd); if (genoCdsStart >= genoCdsEnd) { fprintf(f, "0\t0\n"); return; } /* Figure out amount of exonic sequence that is inside of our part * and also in the first UTR or the CDS. */ int i; int cdnaUtrUpSize = 0; int cdnaUtrDownSize = 0; int cdnaCdsSize = 0; for (i=0; i<gp->exonCount; ++i) { int exonStart = gp->exonStarts[i]; int exonEnd = gp->exonEnds[i]; int utrUpStart = max(gp->txStart, exonStart); int utrUpEnd = min(gp->cdsStart, exonEnd); int utrDownStart = max(gp->cdsEnd, exonStart); int utrDownEnd = min(gp->txEnd, exonEnd); int cdsStart = max(gp->cdsStart, exonStart); int cdsEnd = min(gp->cdsEnd, exonEnd); cdnaUtrUpSize += positiveRangeIntersection(utrUpStart, utrUpEnd, partStart, partEnd); cdnaUtrDownSize += positiveRangeIntersection(utrDownStart, utrDownEnd, partStart, partEnd); cdnaCdsSize += positiveRangeIntersection(cdsStart, cdsEnd, partStart, partEnd); } /* Output CDS start/end. */ if (gp->strand[0] == '+') fprintf(f, "%d\t%d\n", cdnaUtrUpSize, cdnaUtrUpSize+cdnaCdsSize); else fprintf(f, "%d\t%d\n", cdnaUtrDownSize, cdnaUtrDownSize+cdnaCdsSize); }
float getCov(int aStart, int aEnd, struct bed5 *b) /* Compute coverage of a's start and end vs. b's, taking aHitAny and * allowStartEqualEnd into account. */ { float overlap = positiveRangeIntersection(aStart, aEnd, b->start, b->end); float denominator = aHitAny ? (aEnd - aStart) : (b->end - b->start); float cov = (denominator == 0) ? 0.0 : overlap/denominator; if (allowStartEqualEnd && (aStart == aEnd || b->start == b->end)) cov = 1.0; return cov; }
int gpRangeIntersection(struct genePred *gp, int start, int end) /* Return number of bases range start,end shares with genePred. */ { int intersect = 0; int i, exonCount = gp->exonCount; for (i=0; i<exonCount; ++i) { intersect += positiveRangeIntersection(gp->exonStarts[i], gp->exonEnds[i], start, end); } return intersect; }
static struct bed *getClickedPar(char *item, struct bed **pars) /* find par record that was clicked on, removing it from the list d*/ { struct bed *clickedPar = NULL, *otherPars = NULL, *par; while ((par = slPopHead(pars)) != NULL) { if (sameString(par->chrom, seqName) && sameString(par->name, item) && positiveRangeIntersection(par->chromStart, par->chromEnd, winStart, winEnd)) { if (clickedPar != NULL) errAbort("multiple par rows named %s overlapping %s:%d-%d", item, seqName, winStart, winEnd); clickedPar = par; } else slAddHead(&otherPars, par); } if (clickedPar == NULL) errAbort("no par row %s overlapping %s:%d-%d", item, seqName, winStart, winEnd); *pars = otherPars; return clickedPar; }
/* get overlap with psl and set the number of overlapping blocks to numBlocks */ int getOverlap(struct psl *psl, int start, int end, int *numBlocks) { int total = 0; int i; int blocks = 0; for (i = 0 ; i < psl->blockCount ; i++) { int qs = psl->qStarts[i]; int qe = psl->qStarts[i] + psl->blockSizes[i]; int overlap = 0; float coverage = 0; if (psl->strand[0] == '-') reverseIntRange(&qs, &qe, psl->qSize); overlap = positiveRangeIntersection(start, end, qs, qe); coverage = (float)overlap/(float)(qe-qe); total += overlap; if (overlap > 25 || coverage > 0.4) blocks++; } *numBlocks = blocks; return total; }
void chainStrands(struct strandHead *strandHead, struct hash *bedHash) { for(; strandHead ; strandHead = strandHead->next) { struct linkBlock *link, *prevLink; struct hashEl *hel = hashLookup(bedHash, strandHead->species); struct hash *chromHash = (hel != NULL) ? hel->val : NULL; struct bedHead *bedHead = (chromHash != NULL) ? hashFindVal(chromHash, strandHead->qName): NULL; slReverse(&strandHead->links); prevLink = strandHead->links; prevLink->mc->leftStatus = MAF_NEW_STATUS; for(link = prevLink->next; link; prevLink = link, link = link->next) { int tDiff = link->cb.tStart - prevLink->cb.tEnd; int qDiff = link->cb.qStart - prevLink->cb.qEnd; int nCount = 0; int nStart, nEnd; struct bed *bed; if (strandHead->strand == '+') { nStart = prevLink->cb.qEnd; nEnd = link->cb.qStart; } else { nEnd = strandHead->qSize - prevLink->cb.qEnd; nStart = strandHead->qSize - link->cb.qStart; } /* a very inefficient search for an N bed */ if ((nEnd - nStart > 0) && (bedHead)) { for(bed = bedHead->list; bed; bed = bed->next) { if (bed->chromStart >= nEnd) break; if ( bed->chromEnd > nStart) { nCount += positiveRangeIntersection(nStart, nEnd, bed->chromStart, bed->chromEnd); } } } if ((qDiff && (100 * nCount / qDiff > 95)) && (tDiff && (100 * nCount / tDiff > 10))) { prevLink->mc->rightStatus = link->mc->leftStatus = MAF_MISSING_STATUS; prevLink->mc->rightLen = link->mc->leftLen = nCount; } else if ((tDiff > 100000) || (qDiff > 100000) || (qDiff < -100000)) { prevLink->mc->rightStatus = link->mc->leftStatus = MAF_NEW_STATUS; prevLink->mc->rightLen = link->mc->leftLen = 0; } else if (qDiff < 0) { prevLink->mc->rightStatus = link->mc->leftStatus = MAF_TANDEM_STATUS; prevLink->mc->rightLen = link->mc->leftLen = -qDiff; } else if (qDiff == 0) { prevLink->mc->rightStatus = link->mc->leftStatus = MAF_CONTIG_STATUS; prevLink->mc->rightLen = link->mc->leftLen = 0; } else { prevLink->mc->rightStatus = link->mc->leftStatus = MAF_INSERT_STATUS; prevLink->mc->rightLen = link->mc->leftLen = qDiff; } } prevLink->mc->rightStatus = MAF_NEW_STATUS; } }
boolean isNonsenseMediatedDecayTarget(struct bed *bed) /* Return TRUE if there's an intron more than 55 bases past * end of CDS. */ { const int nmdMax = 55; if (bed->thickStart >= bed->thickEnd) return FALSE; /* Not even coding! */ int blockCount = bed->blockCount; if (blockCount == 1) return FALSE; /* No introns at all. */ if (bed->strand[0] == '+') { /* ----=== ==== ====---- NMD FALSE */ /* ----=== ===- -------- NMD FALSE */ /* ----=== =--- -------- NMD TRUE */ /* ----=== == - -------- NMD FALSE */ /* Step backwards looking for first real intron (> 3 bases) */ int i; for (i=bed->blockCount-2; i>=0; --i) { int gapStart = bed->chromStarts[i] + bed->blockSizes[i] + bed->chromStart; int gapEnd = bed->chromStarts[i+1] + bed->chromStart; int gapSize = gapEnd - gapStart; if (gapSize > 16) { int nmdStart = bed->thickEnd; int nmdEnd = gapStart; if (nmdStart < nmdEnd) { int nmdBases = 0; int j; for (j=0; j<bed->blockCount; ++j) { int start = bed->chromStart + bed->chromStarts[j]; int end = start + bed->blockSizes[j]; nmdBases += positiveRangeIntersection(nmdStart, nmdEnd, start, end); } return nmdBases >= nmdMax; } } } } else { /* Step forward looking for first gap big enough to be an intron*/ int i; int lastBlock = bed->blockCount-1; for (i=0; i<lastBlock; ++i) { int gapStart = bed->chromStarts[i] + bed->blockSizes[i] + bed->chromStart; int gapEnd = bed->chromStarts[i+1] + bed->chromStart; int gapSize = gapEnd - gapStart; if (gapSize > 16) { /* -----=== ==== ====---- NMD FALSE */ /* ----- -=== === ====------ NMD FALSE */ /* ----- ---= === ====------ NMD TRUE */ int nmdStart = gapEnd; int nmdEnd = bed->thickStart; if (nmdStart < nmdEnd) { int nmdBases = 0; int j; for (j=0; j<bed->blockCount; ++j) { int start = bed->chromStart + bed->chromStarts[j]; int end = start + bed->blockSizes[j]; nmdBases += positiveRangeIntersection(nmdStart, nmdEnd, start, end); } return nmdBases >= nmdMax; } } } } return FALSE; }
struct genePred *getOverlappingGeneDb(struct genePred **list, char *table, char *chrom, int cStart, int cEnd, char *name, int *retOverlap, char *db) { /* read all genes from a table find the gene with the biggest overlap. Cache the list of genes to so we only read it once */ struct genePred *el = NULL, *bestMatch = NULL, *gp = NULL; int overlap = 0 , bestOverlap = 0, i; int *eFrames; if (list == NULL) return NULL; if (*list == NULL) { struct genePred *gpList = NULL; struct sqlConnection *conn = sqlConnect(db); struct genePredReader *gpr = NULL; if (!hTableExistsDb(db,table)) table = altTable; if (!hTableExistsDb(db,table)) { verbose(2,"no table %s in %s\n",table, db); return NULL; } gpr = genePredReaderQuery(conn, table, NULL); verbose(1,"Loading Predictions from %s in %s\n",table, db); gpList = genePredReaderAll(gpr); if (gpList != NULL) { hashAdd(geneListHash, db, gpList); *list = gpList; } sqlDisconnect(&conn); } for (el = *list; el != NULL; el = el->next) { if (chrom != NULL && el->chrom != NULL) { overlap = 0; if ( sameString(chrom, el->chrom)) { for (i = 0 ; i<(el->exonCount); i++) { overlap += positiveRangeIntersection(cStart,cEnd, el->exonStarts[i], el->exonEnds[i]) ; } if (overlap > 20 && sameString(name, el->name)) { bestMatch = el; bestOverlap = overlap; *retOverlap = bestOverlap; } if (overlap > bestOverlap) { bestMatch = el; bestOverlap = overlap; *retOverlap = bestOverlap; } } } } if (bestMatch != NULL) { /* Allocate genePred and fill in values. */ AllocVar(gp); gp->name = cloneString(bestMatch->name); gp->chrom = cloneString(bestMatch->chrom); gp->strand[1] = bestMatch->strand[1]; gp->strand[0] = bestMatch->strand[0]; gp->txStart = bestMatch->txStart; gp->txEnd = bestMatch->txEnd; gp->cdsStart = bestMatch->cdsStart; gp->cdsEnd = bestMatch->cdsEnd; gp->exonCount = bestMatch->exonCount; AllocArray(gp->exonStarts, bestMatch->exonCount); AllocArray(gp->exonEnds, bestMatch->exonCount); for (i=0; i<bestMatch->exonCount; ++i) { gp->exonStarts[i] = bestMatch->exonStarts[i] ; gp->exonEnds[i] = bestMatch->exonEnds[i] ; } gp->optFields = bestMatch->optFields; gp->id = bestMatch->id; if (bestMatch->optFields & genePredName2Fld) gp->name2 = cloneString(bestMatch->name2); else gp->name2 = NULL; if (bestMatch->optFields & genePredCdsStatFld) { gp->cdsStartStat = bestMatch->cdsStartStat; gp->cdsEndStat = bestMatch->cdsEndStat; } if (bestMatch->optFields & genePredExonFramesFld) { gp->exonFrames = AllocArray(eFrames, bestMatch->exonCount); for (i = 0; i < bestMatch->exonCount; i++) gp->exonFrames[i] = bestMatch->exonFrames[i]; } eFrames = gp->exonFrames; } return gp; }
void checkExp(char *bedFileName, char *tNibDir, char *nibList) { struct lineFile *bf = lineFileOpen(bedFileName , TRUE), *af = NULL; char *row[PSEUDOGENELINK_NUM_COLS] ; struct pseudoGeneLink *ps; char *tmpName[512], cmd[512]; struct axt *axtList = NULL, *axt, *mAxt = NULL; struct dnaSeq *qSeq = NULL, *tSeq = NULL, *seqList = NULL; struct nibInfo *qNib = NULL, *tNib = NULL; FILE *op; int ret; if (nibHash == NULL) nibHash = hashNew(0); while (lineFileNextRow(bf, row, ArraySize(row))) { struct misMatch *misMatchList = NULL; struct binKeeper *bk = NULL; struct binElement *el, *elist = NULL; struct psl *mPsl = NULL, *rPsl = NULL, *pPsl = NULL, *psl ; struct misMatch *mf = NULL; ps = pseudoGeneLinkLoad(row); tmpName[0] = cloneString(ps->name); chopByChar(tmpName[0], '.', tmpName, sizeof(tmpName)); verbose(2,"name %s %s:%d-%d\n", ps->name, ps->chrom, ps->chromStart,ps->chromEnd); /* get expressed retro from hash */ bk = hashFindVal(mrnaHash, ps->chrom); elist = binKeeperFindSorted(bk, ps->chromStart, ps->chromEnd ) ; for (el = elist; el != NULL ; el = el->next) { rPsl = el->val; verbose(2,"retroGene %s %s:%d-%d\n",rPsl->qName, ps->chrom, ps->chromStart,ps->chromEnd); } /* find mrnas that overlap parent gene */ bk = hashFindVal(mrnaHash, ps->gChrom); elist = binKeeperFindSorted(bk, ps->gStart , ps->gEnd ) ; for (el = elist; el != NULL ; el = el->next) { pPsl = el->val; verbose(2,"parent %s %s:%d %d,%d\n", pPsl->qName, pPsl->tName,pPsl->tStart, pPsl->match, pPsl->misMatch); } /* find self chain */ bk = hashFindVal(chainHash, ps->chrom); elist = binKeeperFind(bk, ps->chromStart , ps->chromEnd ) ; slSort(&elist, chainCmpScoreDesc); for (el = elist; el != NULL ; el = el->next) { struct chain *chain = el->val, *subChain, *retChainToFree, *retChainToFree2; int qs = chain->qStart; int qe = chain->qEnd; int id = chain->id; if (chain->qStrand == '-') { qs = chain->qSize - chain->qEnd; qe = chain->qSize - chain->qStart; } if (!sameString(chain->qName , ps->gChrom) || !positiveRangeIntersection(qs, qe, ps->gStart, ps->gEnd)) { verbose(2," wrong chain %s:%d-%d %s:%d-%d parent %s:%d-%d\n", chain->qName, qs, qe, chain->tName,chain->tStart,chain->tEnd, ps->gChrom,ps->gStart,ps->gEnd); continue; } verbose(2,"chain id %d %4.0f",chain->id, chain->score); chainSubsetOnT(chain, ps->chromStart+7, ps->chromEnd-7, &subChain, &retChainToFree); if (subChain != NULL) chain = subChain; chainSubsetOnQ(chain, ps->gStart, ps->gEnd, &subChain, &retChainToFree2); if (subChain != NULL) chain = subChain; if (chain->qStrand == '-') { qs = chain->qSize - chain->qEnd; qe = chain->qSize - chain->qStart; } verbose(2," %s:%d-%d %s:%d-%d ", chain->qName, qs, qe, chain->tName,chain->tStart,chain->tEnd); if (subChain != NULL) verbose(2,"subChain %s:%d-%d %s:%d-%d\n", subChain->qName, subChain->qStart, subChain->qEnd, subChain->tName,subChain->tStart,subChain->tEnd); qNib = nibInfoFromCache(nibHash, tNibDir, chain->qName); tNib = nibInfoFromCache(nibHash, tNibDir, chain->tName); tSeq = nibInfoLoadStrand(tNib, chain->tStart, chain->tEnd, '+'); qSeq = nibInfoLoadStrand(qNib, chain->qStart, chain->qEnd, chain->qStrand); axtList = chainToAxt(chain, qSeq, chain->qStart, tSeq, chain->tStart, maxGap, BIGNUM); verbose(2,"axt count %d misMatch cnt %d\n",slCount(axtList), slCount(misMatchList)); for (axt = axtList; axt != NULL ; axt = axt->next) { addMisMatch(&misMatchList, axt, chain->qSize); } verbose(2,"%d in mismatch list %s id %d \n",slCount(misMatchList), chain->qName, id); chainFree(&retChainToFree); chainFree(&retChainToFree2); break; } /* create axt of each expressed retroGene to parent gene */ /* get alignment for each mrna overlapping retroGene */ bk = hashFindVal(mrnaHash, ps->chrom); elist = binKeeperFindSorted(bk, ps->chromStart , ps->chromEnd ) ; { char queryName[512]; char axtName[512]; char pslName[512]; safef(queryName, sizeof(queryName), "/tmp/query.%s.fa", ps->chrom); safef(axtName, sizeof(axtName), "/tmp/tmp.%s.axt", ps->chrom); safef(pslName, sizeof(pslName), "/tmp/tmp.%s.psl", ps->chrom); op = fopen(pslName,"w"); for (el = elist ; el != NULL ; el = el->next) { psl = el->val; pslOutput(psl, op, '\t','\n'); qSeq = twoBitReadSeqFrag(twoBitFile, psl->qName, 0, 0); if (qSeq != NULL) slAddHead(&seqList, qSeq); else errAbort("seq %s not found \n", psl->qName); } fclose(op); faWriteAll(queryName, seqList); safef(cmd,sizeof(cmd),"pslPretty -long -axt %s %s %s %s",pslName , nibList, queryName, axtName); ret = system(cmd); if (ret != 0) errAbort("ret is %d %s\n",ret,cmd); verbose(2, "ret is %d %s\n",ret,cmd); af = lineFileOpen(axtName, TRUE); while ((axt = axtRead(af)) != NULL) slAddHead(&mAxt, axt); lineFileClose(&af); } slReverse(&mAxt); /* for each parent/retro pair, count bases matching retro and parent better */ for (el = elist; el != NULL ; el = el->next) { int i, scoreRetro=0, scoreParent=0, scoreNeither=0; struct dyString *parentMatch = newDyString(16*1024); struct dyString *retroMatch = newDyString(16*1024); mPsl = el->val; if (mAxt != NULL) { verbose(2,"mrna %s %s:%d %d,%d axt %s\n", mPsl->qName, mPsl->tName,mPsl->tStart, mPsl->match, mPsl->misMatch, mAxt->qName); assert(sameString(mPsl->qName, mAxt->qName)); for (i = 0 ; i< (mPsl->tEnd-mPsl->tStart) ; i++) { int j = mAxt->tStart - mPsl->tStart; verbose(5, "listLen = %d\n",slCount(&misMatchList)); if ((mf = matchFound(&misMatchList, (mPsl->tStart)+i)) != NULL) { if (toupper(mf->retroBase) == toupper(mAxt->qSym[j+i])) { verbose (3,"match retro[%d] %d %c == %c parent %c %d\n", i,mf->retroLoc, mf->retroBase, mAxt->qSym[j+i], mf->parentBase, mf->parentLoc); dyStringPrintf(retroMatch, "%d,", mf->retroLoc); scoreRetro++; } else if (toupper(mf->parentBase) == toupper(mAxt->qSym[j+i])) { verbose (3,"match parent[%d] %d %c == %c retro %c %d\n", i,mf->parentLoc, mf->parentBase, mAxt->qSym[j+i], mf->retroBase, mf->retroLoc); dyStringPrintf(parentMatch, "%d,", mf->parentLoc); scoreParent++; } else { verbose (3,"match neither[%d] %d %c != %c retro %c %d\n", i,mf->parentLoc, mf->parentBase, mAxt->tSym[j+i], mf->retroBase, mf->retroLoc); scoreNeither++; } } } verbose(2,"final score %s parent %d retro %d neither %d\n", mPsl->qName, scoreParent, scoreRetro, scoreNeither); fprintf(outFile,"%s\t%d\t%d\t%s\t%d\t%s\t%d\t%d\t%s\t%d\t%d\t%d\t%s\t%s\n", ps->chrom, ps->chromStart, ps->chromEnd, ps->name, ps->score, mPsl->tName, mPsl->tStart, mPsl->tEnd, mPsl->qName, scoreParent, scoreRetro, scoreNeither, parentMatch->string, retroMatch->string); mAxt = mAxt->next; } dyStringFree(&parentMatch); dyStringFree(&retroMatch); } } }