inc/blastParse.h

Go to the documentation of this file.
00001 /* blastParse - read in blast output into C data structure. */
00002 
00003 #ifndef BLASTPARSE_H
00004 #define BLASTPARSE_H
00005 
00006 struct blastFile
00007 /* All the info in a single file. */
00008     {
00009     struct blastFile *next;
00010     char *fileName;                     /* Name of file this is in. */
00011     char *program;                      /* Blastp, blastx, blastn, etc. */
00012     char *version;                      /* Version of program. */
00013     char *buildDate;                    /* Build date of program. */
00014     struct lineFile *lf;                /* File blast is in. */
00015     struct blastQuery *queries;         /* List of queries. */
00016     };
00017 
00018 struct blastQuery
00019 /* Info on one query. */
00020     {
00021     struct blastQuery *next;
00022     char *query;                        /* Name of query sequence. */
00023     int queryBaseCount;                 /* Number of bases in query. */
00024     char *database;                     /* Name of database. */
00025     int dbSeqCount;                     /* Number of sequences in database. */
00026     int dbBaseCount;                    /* Number of bases in database. */
00027     struct blastGappedAli *gapped;      /* List of gapped alignments. */
00028     };
00029 
00030 struct blastGappedAli
00031 /* Info about a gapped alignment. */
00032     {
00033     struct blastGappedAli *next;
00034     struct blastQuery *query;           /* Query associated with this alignment (not owned here). */
00035     char *targetName;                   /* Name of target sequence. */
00036     int targetSize;                     /* Size of target sequence. */
00037     struct blastBlock *blocks;          /* List of aligning blocks (no big gaps). */
00038     };
00039 
00040 struct blastBlock
00041 /* Info about a single block of gapped alignment. */
00042     {
00043     struct blastBlock *next;
00044     struct blastGappedAli *gappedAli;   /* gapped ali associated with block */
00045     int bitScore;                       /* About 2 bits per aligning nucleotide. */
00046     double eVal;                        /* Expected number of alignments in database. */
00047     int matchCount;                     /* Number of matching nucleotides. */
00048     int totalCount;                     /* Total number of nucleotides. */
00049     int insertCount;                    /* Number of inserts. */
00050     BYTE qStrand;                       /* Query strand (+1 or -1) */
00051     BYTE tStrand;                       /* Target strand (+1 or -1) */
00052     BYTE frame;                         /* Frame for tblastn, +/- 1, 2, 3, or
00053                                          * 0 if none. */
00054     int qStart;                         /* Query start position. [0..n) */
00055     int tStart;                         /* Target start position. [0..n) */
00056     int qEnd;                           /* Query end position. */
00057     int tEnd;                           /* Target end position. */
00058     char *qSym;                         /* Query letters (including '-') */
00059     char *tSym;                         /* Target letters (including '-') */
00060     };
00061 
00062 struct blastFile *blastFileReadAll(char *fileName);
00063 /* Read all blast alignment in file. */
00064 
00065 struct blastFile *blastFileOpenVerify(char *fileName);
00066 /* Open file, read and verify header. */
00067 
00068 struct blastQuery *blastFileNextQuery(struct blastFile *bf);
00069 /* Read all alignments associated with next query.  Return NULL at EOF. */
00070 
00071 struct blastGappedAli *blastFileNextGapped(struct blastFile *bf, struct blastQuery *bq);
00072 /* Read in next gapped alignment.   Does *not* put it on bf->gapped list. 
00073  * Return NULL at EOF or end of query. */
00074 
00075 struct blastBlock *blastFileNextBlock(struct blastFile *bf, 
00076         struct blastQuery *bq, struct blastGappedAli *bga);
00077 /* Read in next blast block.  Return NULL at EOF or end of
00078  * gapped alignment. */
00079 
00080 void blastFileFree(struct blastFile **pBf);
00081 /* Free blast file. */
00082 
00083 void blastFileFreeList(struct blastFile **pList);
00084 /* Free list of blast files. */
00085 
00086 void blastQueryFree(struct blastQuery **pBq);
00087 /* Free single blastQuery. */
00088 
00089 void blastQueryFreeList(struct blastQuery **pList);
00090 /* Free list of blastQuery's. */
00091 
00092 void blastGappedAliFree(struct blastGappedAli **pBga);
00093 /* Free blastGappedAli. */
00094 
00095 void blastGappedAliFreeList(struct blastGappedAli **pList);
00096 /* Free blastGappedAli list. */
00097 
00098 void blastBlockFree(struct blastBlock **pBb);
00099 /* Free a single blastBlock. */
00100 
00101 void blastBlockFreeList(struct blastBlock **pList);
00102 /* Free a list of blastBlocks. */
00103 
00104 void blastBlockPrint(struct blastBlock* bb, FILE* out);
00105 /* print a BLAST block for debugging purposes  */
00106 
00107 void blastGappedAliPrint(struct blastGappedAli* ba, FILE* out);
00108 /* print a BLAST gapped alignment for debugging purposes  */
00109 
00110 void blastQueryPrint(struct blastQuery *bq, FILE* out);
00111 /* print a BLAST query for debugging purposes  */
00112 
00113 #endif /* BLASTPARSE_H */
00114 

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