inc/cda.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
00003  * for personal, academic, and non-profit purposes.  Commercial use          *
00004  * permitted only by explicit agreement with Jim Kent (jim_kent@pacbell.net) *
00005  *****************************************************************************/
00006 /* cda.h - cDNA Alignment structure.  This stores all the info except
00007  * the bases themselves on an cDNA alignment. */
00008 
00009 #ifndef CDA_H
00010 #define CDA_H
00011 
00012 #ifndef MEMGFX_H
00013 #include "memgfx.h"
00014 #endif 
00015 
00016 #ifndef FUZZYFIND_H
00017 #include "fuzzyFind.h"
00018 #endif
00019 
00020 struct cdaBlock
00021     {
00022     int nStart, nEnd;           /* Start and end position in cDNA. */
00023     int hStart, hEnd;           /* Start and end position on chromosome. */
00024     UBYTE startGood, endGood;   /* Number of bases matching perfectly on end */
00025     UBYTE midScore;             /* 0-255  255 is perfect. */
00026     };
00027 
00028 struct cdaAli
00029     {
00030     struct cdaAli *next;
00031     char *name;
00032     int baseCount;
00033     short milliScore;               /* Score 0-1000 */
00034     bits16 chromIx;                 /* On disk as just a UBYTE */
00035     char strand;                    /* Strand of chromosome cDNA aligns with + or - */
00036     char direction;                 /* Direction of cDNA relative to transcription + or - */
00037     UBYTE isEmbryonic;
00038     UBYTE hasIntrons;
00039     int orientation;                /* +1 or -1 depending on whether *clone* is + or - WRT chrom . */
00040                                     /* New and perhaps not always respected. */
00041     int chromStart, chromEnd;
00042     short blockCount;               /* Number of blocks. */
00043     struct cdaBlock *blocks;        /* Dynamically allocated array. */
00044     };
00045 
00046 boolean cdaCloneIsReverse(struct cdaAli *cda);
00047 /* Returns TRUE if clone (.3/.5 pair) aligns on reverse strand. */
00048 
00049 char cdaCloneStrand(struct cdaAli *cda);
00050 /* Return '+' or '-' depending on the strand that clone (.3/.5 pair) aligns on. */
00051 
00052 char cdaDirChar(struct cdaAli *cda, char chromStrand);
00053 /* Return '>' or '<' or ' ' depending whether cDNA is going same, opposite, or
00054  * unknown alignment as the chromosome strand. */
00055 
00056 char *cdaLoadString(FILE *f);
00057 /* Load in a string from CDA file. */
00058 
00059 void cdaReadBlock(FILE *f, struct cdaBlock *block);
00060 /* Read one block from cda file. */
00061 
00062 FILE *cdaOpenVerify(char *fileName);
00063 /* Call this to open file and verify signature, then call cdaLoadOne
00064  * which returns NULL at EOF. This file type is created by binGood.exe. */
00065 
00066 struct cdaAli *cdaLoadOne(FILE *f);
00067 /* Load one cdaAli from file.  Assumes file pointer is correctly positioned.
00068  * either by cdaOpenVerify or a previous cdaLoadOne.  Returns NULL at EOF. */
00069 
00070 void cdaFixChromStartEnd(struct cdaAli *cda);
00071 /* Loop through blocks and figure out and fill in chromStart
00072  * and chromEnd. */
00073 
00074 void cdaCoalesceBlocks(struct cdaAli *ca);
00075 /* Coalesce blocks separated by small amounts of noise. */
00076 
00077 void cdaCoalesceFast(struct cdaAli *ca);
00078 /* Coalesce blocks as above, but don't update the score. */
00079 
00080 void cdaShowAlignmentTrack(struct memGfx *mg, 
00081     int xOff, int yOff, int width, int height,  Color goodColor, Color badColor,
00082     int dnaSize, int dnaOffset, struct cdaAli *cda, char repeatChar);
00083 /* Draw alignment on a horizontal track of picture. */
00084 
00085 void cdaRcOne(struct cdaAli *cda, int dnaStart, int baseCount);
00086 /* Reverse complement one cda. DnaStart is typically display window start. */
00087 
00088 void cdaRcList(struct cdaAli *cdaList, int dnaStart, int baseCount);
00089 /* Reverse complement cda list. */
00090 
00091 void cdaFreeAli(struct cdaAli *ca);
00092 /* Free a single cdaAli. */
00093 
00094 void cdaFreeAliList(struct cdaAli **pList);
00095 /* Free list of cdaAli. */
00096 
00097 struct cdaAli *cdaAliFromFfAli(struct ffAli *aliList, 
00098     DNA *needle, int needleSize, DNA *hay, int haySize, boolean isRc);
00099 /* Convert from ffAli to cdaAli format. */
00100 
00101 void cdaWrite(char *fileName, struct cdaAli *cdaList);
00102 /* Write out a cdaList to a cda file. */
00103 
00104 #endif /* CDA_H */

Generated on Tue Dec 25 18:39:29 2007 for blat by  doxygen 1.5.2