static double motifScoreHere(char *chrom, int start, int end, char *motifName, char *motifTable) /* Return score of motif at given position. */ { double score; struct dnaSeq *seq = hDnaFromSeq(database, chrom, start, end, dnaLower); struct dnaMotif *motif = loadDnaMotif(motifName, motifTable); char strand = dnaMotifBestStrand(motif, seq->dna); if (strand == '-') reverseComplement(seq->dna, seq->size); score = dnaMotifBitScore(motif, seq->dna); dnaMotifFree(&motif); dnaSeqFree(&seq); return score; }
void emblMatrixToMotif(char *inName, char *outName) /* emblMatrixToMotif - Convert transfac matrix in EMBL format to dnaMotif. */ { struct hash *hash = NULL; struct lineFile *lf = emblOpen(inName, NULL); FILE *f = mustOpen(outName, "w"); struct dnaMotif *motif; while ((hash = emblRecord(lf)) != NULL) { char *ac = hashFindVal(hash, "AC"); char *po = hashFindVal(hash, "P0"); if (ac != NULL && po != NULL && orgFits(hash)) { motif = emblToMotif(ac, hash); dnaMotifTabOut(motif, f); dnaMotifFree(&motif); } } }