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 /* trans3 - a sequence and three translated reading frames. 00007 * In the gfServer/gfClient system these are found in a 00008 * t3Hash that has as values lists of trans3. These reflect 00009 * the fragments of the genome actually loaded in memory 00010 * to perform the alignment. */ 00011 00012 #ifndef TRANS3_H 00013 #define TRANS3_H 00014 00015 #ifndef DNASEQ_H 00016 #include "dnaseq.h" 00017 #endif 00018 00019 #ifndef HASH_H 00020 #include "hash.h" 00021 #endif 00022 00023 struct trans3 00024 /* A sequence and three translations of it. */ 00025 { 00026 struct trans3 *next; /* Next in list. */ 00027 char *name; /* Name (not allocated here) */ 00028 struct dnaSeq *seq; /* Untranslated sequence. Not allocated here. */ 00029 aaSeq *trans[3]; /* Translated sequences. Allocated here*/ 00030 int start,end; /* Start/end of sequence in a larger context. */ 00031 int nibSize; /* Size of nib file this is embedded in. */ 00032 boolean isRc; /* Has been reverse complemented? */ 00033 }; 00034 00035 struct trans3 *trans3New(struct dnaSeq *seq); 00036 /* Create a new set of translated sequences. */ 00037 00038 void trans3Free(struct trans3 **pT3); 00039 /* Free a trans3 structure. */ 00040 00041 void trans3FreeList(struct trans3 **pList); 00042 /* Free a list of dynamically allocated trans3's */ 00043 00044 struct trans3 *trans3Find(struct hash *t3Hash, char *name, int start, int end); 00045 /* Find trans3 in hash which corresponds to sequence of given name and includes 00046 * bases between start and end. */ 00047 00048 void trans3Offset(struct trans3 *t3List, AA *aa, int *retOffset, int *retFrame); 00049 /* Figure out offset of peptide in context of larger sequences. */ 00050 00051 int trans3GenoPos(char *pt, bioSeq *seq, struct trans3 *t3List, boolean isEnd); 00052 /* Convert from position in one of three translated frames in 00053 * t3List to genomic offset. If t3List is NULL then just use seq 00054 * instead. */ 00055 00056 int trans3Frame(char *pt, struct trans3 *t3List); 00057 /* Figure out which frame pt is in or 0 if no frame. */ 00058 00059 #endif /* TRANS3_H */
1.5.2