00001 /* dnaMotif.h was originally generated by the autoSql program, which also 00002 * generated dnaMotif.c and dnaMotif.sql. This header links the database and 00003 * the RAM representation of objects. */ 00004 00005 #ifndef DNAMOTIF_H 00006 #define DNAMOTIF_H 00007 00008 #ifndef DNAUTIL_H 00009 #include "dnautil.h" 00010 #endif 00011 00012 struct dnaMotif 00013 /* A gapless DNA motif */ 00014 { 00015 struct dnaMotif *next; /* Next in singly linked list. */ 00016 char *name; /* Motif name. */ 00017 int columnCount; /* Count of columns in motif. */ 00018 float *aProb; /* Probability of A's in each column. */ 00019 float *cProb; /* Probability of C's in each column. */ 00020 float *gProb; /* Probability of G's in each column. */ 00021 float *tProb; /* Probability of T's in each column. */ 00022 }; 00023 00024 struct dnaMotif *dnaMotifCommaIn(char **pS, struct dnaMotif *ret); 00025 /* Create a dnaMotif out of a comma separated string. 00026 * This will fill in ret if non-null, otherwise will 00027 * return a new dnaMotif */ 00028 00029 void dnaMotifFree(struct dnaMotif **pEl); 00030 /* Free a single dynamically allocated dnaMotif such as created 00031 * with dnaMotifLoad(). */ 00032 00033 void dnaMotifFreeList(struct dnaMotif **pList); 00034 /* Free a list of dynamically allocated dnaMotif's */ 00035 00036 void dnaMotifOutput(struct dnaMotif *el, FILE *f, char sep, char lastSep); 00037 /* Print out dnaMotif. Separate fields with sep. Follow last field with lastSep. */ 00038 00039 #define dnaMotifTabOut(el,f) dnaMotifOutput(el,f,'\t','\n'); 00040 /* Print out dnaMotif as a line in a tab-separated file. */ 00041 00042 #define dnaMotifCommaOut(el,f) dnaMotifOutput(el,f,',',','); 00043 /* Print out dnaMotif as a comma separated list including final comma. */ 00044 00045 float dnaMotifSequenceProb(struct dnaMotif *motif, DNA *dna); 00046 /* Return probability of dna according to motif. Make sure 00047 * motif is probabalistic (with call to dnaMotifMakeProbabalistic 00048 * if you're not sure) before calling this. */ 00049 00050 char dnaMotifBestStrand(struct dnaMotif *motif, DNA *dna); 00051 /* Figure out which strand of DNA is better for probabalistic motif. */ 00052 00053 double dnaMotifBitScore(struct dnaMotif *motif, DNA *dna); 00054 /* Return logBase2-odds score of dna given a probabalistic motif. */ 00055 00056 void dnaMotifNormalize(struct dnaMotif *motif); 00057 /* Make all columns of motif sum to one. */ 00058 00059 boolean dnaMotifIsScoreBased(struct dnaMotif *motif); 00060 /* Return TRUE if dnaMotif is score-based (which we decide by 00061 * the presense of negative values. */ 00062 00063 void dnaMotifScoreToProb(struct dnaMotif *motif); 00064 /* Convert motif that is log-odds score based to motif 00065 * that is probability based. This assumes that the 00066 * background distribution is simple: 25% for each base */ 00067 00068 void dnaMotifMakeProbabalistic(struct dnaMotif *motif); 00069 /* Change motif, which may be score or count based, to 00070 * probabalistic one, where each column adds to 1.0 */ 00071 00072 double dnaMotifBitsOfInfo(struct dnaMotif *motif, int pos); 00073 /* Return bits of information at position. */ 00074 00075 void dnaMotifPrintProb(struct dnaMotif *motif, FILE *f); 00076 /* Print DNA motif probabilities. */ 00077 00078 void dnaMotifToLogoPs(struct dnaMotif *motif, double widthPerBase, double height, 00079 char *fileName); 00080 /* Write logo corresponding to motif to postScript file. */ 00081 00082 void dnaMotifToLogoPsW(struct dnaMotif *motif, double widthPerBase, double width, 00083 double height, char *fileName); 00084 /* Write logo corresponding to motif to postScript file. 00085 * use the whole window width, rather than just incrementing 00086 * by widthPerBase */ 00087 00088 void dnaMotifToLogoPng( 00089 struct dnaMotif *motif, /* Motif to draw. */ 00090 double widthPerBase, /* Width of each base. */ 00091 double height, /* Max height. */ 00092 char *gsExe, /* ghostscript executable, NULL for default */ 00093 char *tempDir, /* temp dir , NULL for default */ 00094 char *fileName); /* output png file name. */ 00095 /* Write logo corresponding to motif to png file. */ 00096 00097 void dnaMotifToLogoPGM( 00098 struct dnaMotif *motif, /* Motif to draw. */ 00099 double widthPerBase, /* Width of each base. */ 00100 double width, /* Max width. */ 00101 double height, /* Max height. */ 00102 char *gsExe, /* ghostscript executable, NULL for default */ 00103 char *tempDir, /* temp dir , NULL for default */ 00104 char *fileName); /* output png file name. */ 00105 /* Write logo corresponding to motif to PGM file. */ 00106 00107 #endif /* DNAMOTIF_H */ 00108
1.5.2