jkOwnLib/trans3.c File Reference

#include "common.h"
#include "dnaseq.h"
#include "trans3.h"

Include dependency graph for trans3.c:

Go to the source code of this file.

Functions

trans3trans3New (struct dnaSeq *seq)
void trans3Free (struct trans3 **pT3)
void trans3FreeList (struct trans3 **pList)
trans3trans3Find (struct hash *t3Hash, char *name, int start, int end)
void trans3Offset (struct trans3 *t3List, AA *aa, int *retOffset, int *retFrame)
int trans3GenoPos (char *pt, bioSeq *seq, struct trans3 *t3List, boolean isEnd)
int trans3Frame (char *pt, struct trans3 *t3List)

Variables

static char const rcsid [] = "$Id: trans3.c,v 1.5 2007/04/20 22:43:37 kent Exp $"


Function Documentation

struct trans3* trans3Find ( struct hash t3Hash,
char *  name,
int  start,
int  end 
) [read]

Definition at line 62 of file trans3.c.

References trans3::end, hashFindVal(), internalErr, trans3::next, and trans3::start.

Referenced by gfAlignTrans(), gfAlignTransTrans(), and untranslateRangeList().

00065 {
00066 struct trans3 *t3;
00067 for (t3 = hashFindVal(t3Hash, name); t3 != NULL; t3 = t3->next)
00068     {
00069     if (t3->start <= start && t3->end >= end)
00070         return t3;
00071     }
00072 internalErr();
00073 return NULL;
00074 }

Here is the call graph for this function:

Here is the caller graph for this function:

int trans3Frame ( char *  pt,
struct trans3 t3List 
)

Definition at line 126 of file trans3.c.

References FALSE, and trans3GenoPos().

Referenced by saveAxtBundle().

00128 {
00129 if (t3List == NULL)
00130     return 0;
00131 else
00132     return 1 + trans3GenoPos(pt, NULL, t3List, FALSE)%3;
00133 }

Here is the call graph for this function:

Here is the caller graph for this function:

void trans3Free ( struct trans3 **  pT3  ) 

Definition at line 36 of file trans3.c.

References freeDnaSeq(), freez(), and trans3::trans.

Referenced by gfAlignTrans(), gfAlignTransTrans(), gfMakeOoc(), gfTransTransFindBundles(), trans3FreeList(), transCountBothStrands(), transIndexBothStrands(), and transTransQuery().

00038 {
00039 struct trans3 *t3 = *pT3;
00040 if (t3 != NULL)
00041     {
00042     freeDnaSeq(&t3->trans[0]);
00043     freeDnaSeq(&t3->trans[1]);
00044     freeDnaSeq(&t3->trans[2]);
00045     freez(pT3);
00046     }
00047 }

Here is the call graph for this function:

Here is the caller graph for this function:

void trans3FreeList ( struct trans3 **  pList  ) 

Definition at line 49 of file trans3.c.

References trans3::next, and trans3Free().

Referenced by bigBlat().

00051 {
00052 struct trans3 *el, *next;
00053 
00054 for (el = *pList; el != NULL; el = next)
00055     {
00056     next = el->next;
00057     trans3Free(&el);
00058     }
00059 *pList = NULL;
00060 }

Here is the call graph for this function:

Here is the caller graph for this function:

int trans3GenoPos ( char *  pt,
bioSeq seq,
struct trans3 t3List,
boolean  isEnd 
)

Definition at line 99 of file trans3.c.

References dnaSeq::dna, trans3::seq, and trans3Offset().

Referenced by ffNextBreak(), saveAxtBundle(), savePslx(), scoreAli(), and trans3Frame().

00103 {
00104 int offset, frame;
00105 if (t3List != NULL)
00106     {
00107     /* Special processing at end. The end coordinate is
00108      * not included.  In most cases this makes things
00109      * easier.  Here we have to move it back one
00110      * amino acid, so that in the edge case it will
00111      * be included in the block that's loaded.  Then
00112      * we move it back. */
00113     if (isEnd)
00114         pt -= 1;
00115     trans3Offset(t3List, pt, &offset, &frame);
00116     if (isEnd)
00117         offset += 1;
00118     return 3*offset + frame;
00119     }
00120 else
00121    {
00122    return pt - seq->dna;
00123    }
00124 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct trans3* trans3New ( struct dnaSeq seq  )  [read]

Definition at line 10 of file trans3.c.

References AllocVar, trans3::end, FALSE, trans3::name, dnaSeq::name, trans3::seq, dnaSeq::size, trans3::trans, and translateSeq().

Referenced by gfAlignTransTrans(), gfMakeOoc(), gfTransTransFindBundles(), loadHashT3Ranges(), seqListToTrans3List(), transCountBothStrands(), transIndexBothStrands(), and transTransQuery().

00012 {
00013 struct trans3 *t3;
00014 int frame;
00015 int lastPos = seq->size - 1;
00016 
00017 AllocVar(t3);
00018 t3->name = seq->name;
00019 t3->seq = seq;
00020 t3->end = seq->size;
00021 for (frame=0; frame<3; ++frame)
00022     {
00023     /* Position and frame are the same except in the
00024      * very rare case where we are trying to translate 
00025      * something less than 3 bases.  In this case this
00026      * somewhat cryptic construction will force it to
00027      * return empty sequences for the missing frames
00028      * avoiding an assert in translateSeq. */
00029     int pos = frame;
00030     if (pos > lastPos) pos = lastPos;
00031     t3->trans[frame] = translateSeq(seq, pos, FALSE);
00032     }
00033 return t3;
00034 }

Here is the call graph for this function:

Here is the caller graph for this function:

void trans3Offset ( struct trans3 t3List,
AA aa,
int *  retOffset,
int *  retFrame 
)

Definition at line 76 of file trans3.c.

References dnaSeq::dna, trans3::next, trans3::seq, dnaSeq::size, trans3::start, and trans3::trans.

Referenced by trans3GenoPos().

00078 {
00079 struct trans3 *t3;
00080 int frame;
00081 aaSeq *seq;
00082 
00083 for (t3 = t3List; t3 != NULL; t3 = t3->next)
00084     {
00085     for (frame = 0; frame < 3; ++frame)
00086         {
00087         seq = t3->trans[frame];
00088         if (seq->dna <= aa && aa < seq->dna + seq->size)
00089             {
00090             *retOffset = aa - seq->dna + t3->start/3;
00091             *retFrame = frame;
00092             return;
00093             }
00094         }
00095     }
00096 internalErr();
00097 }

Here is the caller graph for this function:


Variable Documentation

char const rcsid[] = "$Id: trans3.c,v 1.5 2007/04/20 22:43:37 kent Exp $" [static]

Definition at line 8 of file trans3.c.


Generated on Tue Dec 25 19:30:49 2007 for blat by  doxygen 1.5.2