Exemplo n.º 1
0
void pslRecalcMatch(char *inName, char *targetName, char *queryName, 
	char *outName)
/* pslRecalcMatch - Recalculate match,mismatch,repMatch columns in psl file.  
 * This can be useful if the psl went through pslMap, or if you've added 
 * lower-case repeat masking after the fact. */
{
struct nibTwoCache *tCache = nibTwoCacheNew(targetName);
struct dnaSeq *qSeqList = dnaLoadAll(queryName);
struct hash *qHash = dnaSeqHash(qSeqList);
struct psl *psl;
struct lineFile *lf = pslFileOpen(inName);
FILE *f = mustOpen(outName, "w");

while ((psl = pslNext(lf)) != NULL)
    {
    int tSize;
    struct dnaSeq *tSeqPart = nibTwoCacheSeqPart(tCache,
    	psl->tName, psl->tStart, psl->tEnd - psl->tStart, &tSize);
    struct dnaSeq *qSeq = hashMustFindVal(qHash, getQName(psl->qName));
    recalcMatches(psl, tSeqPart, psl->tStart, qSeq);
    pslTabOut(psl, f);
    dnaSeqFree(&tSeqPart);
    }
carefulClose(&f);
lineFileClose(&lf);
}
void vgLoadNibb(char *sourceImageDir, char *parsedTab, char *probesFa,
	char *nameTab, char *stageTab, char *outDir)
/* vgLoadNibb - Create .ra and .tab files for loading Xenopus images from NIBB 
 * into VisiGene. */
{
struct hash *nameHash = makeNameHash(nameTab);
struct hash *seqHash = dnaSeqHash(faReadAllDna(probesFa));
struct hash *stageHash = makeStageHash(stageTab);
char outPath[PATH_LEN];

verbose(1, "Got %d named probes\n", nameHash->elCount);
verbose(1, "Got %d probe sequences\n", seqHash->elCount);
verbose(1, "Got %d stages\n", stageHash->elCount);

/* Make output directory and ra file. */
makeDir(outDir);
safef(outPath, sizeof(outPath), "%s/%s", outDir, "nibb.ra");
writeRa(outPath);

/* Make tab separated file. */
safef(outPath, sizeof(outPath), "%s/%s", outDir, "nibb.tab");
writeTab(stageHash, seqHash, sourceImageDir, parsedTab, nameHash, outPath);
}