Ejemplo n.º 1
0
void chainToPsl(char *inName, char *tSizeFile, char *qSizeFile,  char *targetList, char *queryList, char *outName)
/* chainToPsl - Convert chain file to psl format. */
{
struct hash *tSizeHash = readSizes(tSizeFile);
struct hash *qSizeHash = readSizes(qSizeFile);
struct lineFile *lf = lineFileOpen(inName, TRUE);
FILE *f = mustOpen(outName, "w");
struct hash *fileHash = newHash(0);  /* No value. */
struct hash *tHash = newHash(20);  /* seqFilePos value. */
struct hash *qHash = newHash(20);  /* seqFilePos value. */
struct dlList *fileCache = newDlList();
struct chain *chain;
int q,t;

verbose(1, "Scanning %s\n", targetList);
hashFileList(targetList, fileHash, tHash);
verbose(1, "Scanning %s\n", queryList);
hashFileList(queryList, fileHash, qHash);
verbose(1, "Converting %s\n", inName);

while ((chain = chainRead(lf)) != NULL)
    {
    //uglyf("chain %s %s \n",chain->tName,chain->qName); 
    q = findSize(qSizeHash, chain->qName);
    t = findSize(tSizeHash, chain->tName);
    aliStringToPsl(lf, chain->qName, chain->tName, chain->qSize, chain->tSize,
	min(chain->tEnd-chain->tStart, chain->qEnd-chain->qStart), chain->qStart, chain->qEnd, chain->tStart, chain->tEnd,
        chain->qStrand, f, chain, tHash, qHash, fileCache);
    chainFree(&chain);
    }
lineFileClose(&lf);
carefulClose(&f);
}
Ejemplo n.º 2
0
void pslPretty(char *pslName, char *targetList, char *queryList, 
	char *prettyName, boolean axt, char *checkFileName)
/* pslPretty - Convert PSL to human readable output. */
{
struct hash *fileHash = newHash(0);  /* No value. */
struct hash *tHash = newHash(20);  /* seqFilePos value. */
struct hash *qHash = newHash(20);  /* seqFilePos value. */
struct dlList *fileCache = newDlList();
struct lineFile *lf = pslFileOpen(pslName);
FILE *f = mustOpen(prettyName, "w");
FILE *checkFile = NULL;
struct psl *psl;
int dotMod = dot;

if (checkFileName != NULL)
    checkFile = mustOpen(checkFileName, "w");
/* fprintf(stderr,"Scanning %s\n", targetList); */
hashFileList(targetList, fileHash, tHash);
/* fprintf(stderr,"Scanning %s\n", queryList); */
hashFileList(queryList, fileHash, qHash);
/* fprintf(stderr,"Converting %s\n", pslName); */
while ((psl = pslNext(lf)) != NULL)
    {
    if (dot > 0)
        {
	if (--dotMod <= 0)
	   {
	   fprintf(stderr,"."); /* stderr flushes itself */
	   dotMod = dot;
	   }
	}
    prettyOne(psl, qHash, tHash, fileCache, f, axt, checkFile);
    pslFree(&psl);
    }
if (dot > 0)
    fprintf(stderr,"\n");
if (checkFile != NULL)
    {
    fprintf(checkFile,"missLargeStart: %d\n", total_missLargeStart);
    fprintf(checkFile,"missSmallStart: %d\n", total_missSmallStart);
    fprintf(checkFile,"missLargeEnd: %d\n", total_missLargeEnd);
    fprintf(checkFile,"missSmallEnd: %d\n", total_missSmallEnd);
    fprintf(checkFile,"missLargeMiddle: %d\n", total_missLargeMiddle);
    fprintf(checkFile,"missSmallMiddle: %d\n", total_missSmallMiddle);
    fprintf(checkFile,"weirdSplice: %d\n", total_weirdSplice);
    fprintf(checkFile,"doubleGap: %d\n", total_doubleGap);
    fprintf(checkFile,"jumpBack: %d\n", total_jumpBack);
    fprintf(checkFile,"perfect: %d\n", total_rnaPerfect);
    fprintf(checkFile,"total: %d\n", total_rnaCount);
    }
lineFileClose(&lf);
carefulClose(&f);
carefulClose(&checkFile);
}