/* filters out all of psl with below a given percent */ struct psl *filterByBasePct(float percent, struct psl *pslList) { struct psl *psl=NULL, *ret=NULL; int count=0, startCount=0, stopCount=0; char buff[256]; startCount = slCount( pslList ); msg("filtering by seqId"); for(psl = pslList; psl != NULL; psl = psl->next) { float tmp = (float)(psl->match +psl->repMatch) / (psl->qSize - psl->nCount); if(tmp >= percent) { struct psl *tmpPsl = copyPsl(psl); slAddHead(&ret, tmpPsl); } /* let the user know we're making progress */ if(count % TICS == 0) { count = 0; msg("."); } count++; } msg("\tDone.\n"); if(ret != NULL) stopCount = slCount(ret); sprintf(buff, "%d of %d had a basePct of %g or better.\n", stopCount, startCount, percent); msg(buff); slReverse(&ret); return ret; }
void outputAlignmentForStan(struct sqlConnection *conn, struct stanMad *sm, struct hash *iHash, FILE *out) { struct psl *pslList, *bestPsl = NULL; char buff[1024]; int i; struct imageClone *ic = NULL; sprintf(buff, "%d", sm->clid); printf("Looking for %s\n", buff); ic = hashFindVal(iHash, buff); if(ic != NULL) { /* first try looking for the image clones themselves... */ for(i=0; i<ic->numGenbank; i++) { char query[1024]; sqlSafef(query, sizeof query, "select * from all_est where qName='%s'", ic->genbankIds[i]); pslList = pslLoadByQuery(conn, buff); if(pslList != NULL) { slSort(&pslList, pslCmpScore); if(bestPsl == NULL || (pslScore(pslList) > pslScore(bestPsl))) pslFree(&bestPsl); bestPsl = copyPsl(pslList); } pslFreeList(&pslList); } if(bestPsl != NULL) { freez(&bestPsl->qName); sprintf(buff, "%d", sm->clid); bestPsl->qName = cloneString(buff); pslTabOut(bestPsl,out); } else { fprintf(out, "%d\talignment unknown\n", sm->clid); } } else { fprintf(out, "%d\tunknown\n", sm->clid); } }
void copyPsls(struct gbSelect* select, unsigned pslFileType, FILE* outPslFh, struct gbEntryCnts* counts) /* Copy a PSL file from the work directory if it exists, count alignments * for index. */ { char inPsl[PATH_LEN]; struct lineFile* inPslLf; struct psl* psl; gbAlignedGetPath(select, gPslFileExt[pslFileType], gWorkDir, inPsl); if (fileExists(inPsl)) { gbVerbEnter(2, "installing from %s", inPsl); inPslLf = gzLineFileOpen(inPsl); while ((psl = pslNext(inPslLf)) != NULL) { copyPsl(select, pslFileType, psl, inPsl, outPslFh, counts); pslFree(&psl); } gzLineFileClose(&inPslLf); gbVerbLeave(2, "installing from %s", inPsl); } }