inc/gfPcrLib.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gfPcrInput
struct  gfPcrOutput

Functions

void gfPcrInputStaticLoad (char **row, struct gfPcrInput *ret)
gfPcrInputgfPcrInputLoad (char **row)
gfPcrInputgfPcrInputLoadAll (char *fileName)
void gfPcrInputFree (struct gfPcrInput **pEl)
void gfPcrInputFreeList (struct gfPcrInput **pList)
void gfPcrOutputFree (struct gfPcrOutput **pOut)
void gfPcrOutputFreeList (struct gfPcrOutput **pList)
void gfPcrLocal (char *pcrName, struct dnaSeq *seq, int seqOffset, char *seqName, int seqSize, int maxSize, char *fPrimer, int fPrimerSize, char *rPrimer, int rPrimerSize, int minPerfect, int minGood, char strand, struct gfPcrOutput **pOutList)
gfRangegfPcrGetRanges (char *host, char *port, char *fPrimer, char *rPrimer, int maxSize)
gfPcrOutputgfPcrViaNet (char *host, char *port, char *seqDir, struct gfPcrInput *inList, int maxSize, int minPerfect, int minGood)
void gfPcrOutputWriteList (struct gfPcrOutput *outList, char *outType, char *url, FILE *f)
void gfPcrOutputWriteAll (struct gfPcrOutput *outList, char *outType, char *url, char *fileName)
char * gfPcrMakePrimer (char *s)


Function Documentation

struct gfRange* gfPcrGetRanges ( char *  host,
char *  port,
char *  fPrimer,
char *  rPrimer,
int  maxSize 
) [read]

Definition at line 380 of file gfPcrLib.c.

References AllocVar, cloneString(), errAbort(), gfConnect(), gfSignature(), name, netGetString(), nextWord(), rangeList, safef(), sameString, slAddHead, slReverse(), and startsWith().

Referenced by gfPcrOneViaNet().

00383 {
00384 char buf[256];
00385 int conn = gfConnect(host, port);
00386 struct gfRange *rangeList = NULL, *range;
00387 
00388 /* Query server and put results into rangeList. */
00389 safef(buf, sizeof(buf), "%spcr %s %s %d", gfSignature(), fPrimer, rPrimer, maxSize);
00390 write(conn, buf, strlen(buf));
00391 for (;;)
00392     {
00393     if (netGetString(conn, buf) == NULL)
00394         break;
00395     if (sameString(buf, "end"))
00396         break;
00397     else if (startsWith("Error:", buf))
00398         errAbort(buf);
00399     else
00400         {
00401         char *s = buf;
00402         char *name, *start, *end, *strand;
00403         name = nextWord(&s);
00404         start = nextWord(&s);
00405         end = nextWord(&s);
00406         strand = nextWord(&s);
00407         if (strand == NULL)
00408             errAbort("Truncated gfServer response");
00409         AllocVar(range);
00410         range->tName = cloneString(name);
00411         range->tStart = atoi(start);
00412         range->tEnd = atoi(end);
00413         range->tStrand = strand[0];
00414         slAddHead(&rangeList, range);
00415         }
00416     }
00417 close(conn);
00418 slReverse(&rangeList);
00419 return rangeList;
00420 }

Here is the call graph for this function:

Here is the caller graph for this function:

void gfPcrInputFree ( struct gfPcrInput **  pEl  ) 

Definition at line 89 of file gfPcrLib.c.

References gfPcrInput::fPrimer, freeMem(), freez(), gfPcrInput::name, and gfPcrInput::rPrimer.

Referenced by gfPcrInputFreeList().

00092 {
00093 struct gfPcrInput *el;
00094 
00095 if ((el = *pEl) == NULL) return;
00096 freeMem(el->name);
00097 freeMem(el->fPrimer);
00098 freeMem(el->rPrimer);
00099 freez(pEl);
00100 }

Here is the call graph for this function:

Here is the caller graph for this function:

void gfPcrInputFreeList ( struct gfPcrInput **  pList  ) 

Definition at line 102 of file gfPcrLib.c.

References gfPcrInputFree(), and gfPcrInput::next.

00104 {
00105 struct gfPcrInput *el, *next;
00106 
00107 for (el = *pList; el != NULL; el = next)
00108     {
00109     next = el->next;
00110     gfPcrInputFree(&el);
00111     }
00112 *pList = NULL;
00113 }

Here is the call graph for this function:

struct gfPcrInput* gfPcrInputLoad ( char **  row  )  [read]

Definition at line 57 of file gfPcrLib.c.

References AllocVar, cloneString(), gfPcrInput::fPrimer, gfPcrInput::name, and gfPcrInput::rPrimer.

Referenced by gfPcrInputLoadAll().

00060 {
00061 struct gfPcrInput *ret;
00062 
00063 AllocVar(ret);
00064 ret->name = cloneString(row[0]);
00065 ret->fPrimer = cloneString(row[1]);
00066 ret->rPrimer = cloneString(row[2]);
00067 return ret;
00068 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct gfPcrInput* gfPcrInputLoadAll ( char *  fileName  )  [read]

Definition at line 70 of file gfPcrLib.c.

References gfPcrInputLoad(), lineFileClose(), lineFileOpen(), lineFileRow, slAddHead, slReverse(), and TRUE.

00073 {
00074 struct gfPcrInput *list = NULL, *el;
00075 struct lineFile *lf = lineFileOpen(fileName, TRUE);
00076 char *row[3];
00077 
00078 while (lineFileRow(lf, row))
00079     {
00080     el = gfPcrInputLoad(row);
00081     slAddHead(&list, el);
00082     }
00083 lineFileClose(&lf);
00084 slReverse(&list);
00085 return list;
00086 }

Here is the call graph for this function:

void gfPcrInputStaticLoad ( char **  row,
struct gfPcrInput ret 
)

Definition at line 48 of file gfPcrLib.c.

References gfPcrInput::fPrimer, gfPcrInput::name, and gfPcrInput::rPrimer.

00051 {
00052 ret->name = row[0];
00053 ret->fPrimer = row[1];
00054 ret->rPrimer = row[2];
00055 }

void gfPcrLocal ( char *  pcrName,
struct dnaSeq seq,
int  seqOffset,
char *  seqName,
int  seqSize,
int  maxSize,
char *  fPrimer,
int  fPrimerSize,
char *  rPrimer,
int  rPrimerSize,
int  minPerfect,
int  minGood,
char  strand,
struct gfPcrOutput **  pOutList 
)

Definition at line 361 of file gfPcrLib.c.

References pcrLocalStrand().

Referenced by gfPcrOneViaNet().

00367 {
00368 /* For PCR primers reversing search strand just means switching
00369  * order of primers. */
00370 if (strand == '-')
00371     pcrLocalStrand(pcrName, seq, seqOffset, seqName, seqSize, maxSize, 
00372         rPrimer, rPrimerSize, fPrimer, fPrimerSize, 
00373         minPerfect, minGood, strand, pOutList);
00374 else
00375     pcrLocalStrand(pcrName, seq, seqOffset, seqName, seqSize, maxSize, 
00376         fPrimer, fPrimerSize, rPrimer, rPrimerSize, 
00377         minPerfect, minGood, strand, pOutList);
00378 }

Here is the call graph for this function:

Here is the caller graph for this function:

char* gfPcrMakePrimer ( char *  s  ) 

Definition at line 482 of file gfPcrLib.c.

References countChars(), dnaFilter(), dnaFilteredSize(), errAbort(), and needMem().

00485 {
00486 int size = dnaFilteredSize(s);
00487 int realSize;
00488 char *primer = needMem(size+1);
00489 dnaFilter(s, primer);
00490 realSize = size - countChars(primer, 'n');
00491 if (realSize < 10 || realSize < size/2)
00492    errAbort("%s does not seem to be a good primer", s);
00493 return primer;
00494 }

Here is the call graph for this function:

void gfPcrOutputFree ( struct gfPcrOutput **  pOut  ) 

Definition at line 20 of file gfPcrLib.c.

References gfPcrOutput::dna, gfPcrOutput::fPrimer, freeMem(), freez(), gfPcrOutput::name, gfPcrOutput::rPrimer, and gfPcrOutput::seqName.

Referenced by gfPcrOutputFreeList().

00022 {
00023 struct gfPcrOutput *out = *pOut;
00024 if (pOut != NULL)
00025     {
00026     freeMem(out->name);
00027     freeMem(out->fPrimer);
00028     freeMem(out->rPrimer);
00029     freeMem(out->seqName);
00030     freeMem(out->dna);
00031     freez(pOut);
00032     }
00033 }

Here is the call graph for this function:

Here is the caller graph for this function:

void gfPcrOutputFreeList ( struct gfPcrOutput **  pList  ) 

Definition at line 35 of file gfPcrLib.c.

References gfPcrOutputFree(), and gfPcrOutput::next.

00037 {
00038 struct gfPcrOutput *el, *next;
00039 
00040 for (el = *pList; el != NULL; el = next)
00041     {
00042     next = el->next;
00043     gfPcrOutputFree(&el);
00044     }
00045 *pList = NULL;
00046 }

Here is the call graph for this function:

void gfPcrOutputWriteAll ( struct gfPcrOutput outList,
char *  outType,
char *  url,
char *  fileName 
)

Definition at line 275 of file gfPcrLib.c.

References carefulClose(), gfPcrOutputWriteList(), and mustOpen().

00280 {
00281 FILE *f = mustOpen(fileName, "w");
00282 gfPcrOutputWriteList(outList, outType, url, f);
00283 carefulClose(&f);
00284 }

Here is the call graph for this function:

void gfPcrOutputWriteList ( struct gfPcrOutput outList,
char *  outType,
char *  url,
FILE *  f 
)

Definition at line 255 of file gfPcrLib.c.

References errAbort(), gfPcrOutput::next, outputBed(), outputFa(), outputPsl(), and sameWord.

Referenced by gfPcrOutputWriteAll().

00260 {
00261 struct gfPcrOutput *out;
00262 void (*output)(struct gfPcrOutput *out, FILE *f, char *url) = NULL;
00263 if (sameWord(outType, "fa"))
00264     output = outputFa;
00265 else if (sameWord(outType, "bed"))
00266     output = outputBed;
00267 else if (sameWord(outType, "psl"))
00268     output = outputPsl;
00269 else
00270     errAbort("Unrecognized pcr output type %s", outType);
00271 for (out = outList; out != NULL; out = out->next)
00272     output(out, f, url);
00273 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct gfPcrOutput* gfPcrViaNet ( char *  host,
char *  port,
char *  seqDir,
struct gfPcrInput inList,
int  maxSize,
int  minPerfect,
int  minGood 
) [read]

Definition at line 462 of file gfPcrLib.c.

References gfPcrInput::fPrimer, gfFileCacheFree(), gfFileCacheNew(), gfPcrOneViaNet(), gfPcrInput::name, gfPcrInput::next, gfPcrInput::rPrimer, and slReverse().

00465 {
00466 struct hash *tFileCache = gfFileCacheNew();
00467 struct gfPcrInput *in;
00468 struct gfPcrOutput *outList = NULL;
00469 
00470 for (in = inList; in != NULL; in = in->next)
00471     {
00472     gfPcrOneViaNet(host, port, seqDir,
00473         in->name, in->fPrimer, in->rPrimer, maxSize,
00474         minPerfect, minGood,
00475         tFileCache, &outList);
00476     }
00477 gfFileCacheFree(&tFileCache);
00478 slReverse(&outList);
00479 return outList;
00480 }

Here is the call graph for this function:


Generated on Tue Dec 25 18:59:03 2007 for blat by  doxygen 1.5.2