gfClient/gfClient.c File Reference

#include "common.h"
#include "linefile.h"
#include "aliType.h"
#include "fa.h"
#include "genoFind.h"
#include "psl.h"
#include "options.h"
#include "fuzzyFind.h"

Include dependency graph for gfClient.c:

Go to the source code of this file.

Functions

void usage ()
void gfClient (char *hostName, char *portName, char *tSeqDir, char *inName, char *outName, char *tTypeName, char *qTypeName)
int main (int argc, char *argv[])

Variables

static char const rcsid [] = "$Id: gfClient.c,v 1.34 2006/11/15 15:20:59 angie Exp $"
static struct optionSpec optionSpecs []
int dots = 0
int minScore = 30
double minIdentity = 90
char * outputFormat = "psl"
char * qType = "dna"
char * tType = "dna"
gfOutputgvo


Function Documentation

void gfClient ( char *  hostName,
char *  portName,
char *  tSeqDir,
char *  inName,
char *  outName,
char *  tTypeName,
char *  qTypeName 
)

Definition at line 87 of file gfClient.c.

References databaseName, dnaSeq::dna, dots, errAbort(), FALSE, faSomeSpeedReadNext(), gfAlignStrand(), gfAlignTrans(), gfAlignTransTrans(), gfConnect(), gfFileCacheFree(), gfFileCacheNew(), gfOutputAny(), gfOutputHead(), gfOutputQuery(), gftDna, gftDnaX, gftProt, gftRna, gftRnaX, gfTypeFromName(), gvo, lineFileOpen(), minIdentity, minScore, mustOpen(), dnaSeq::name, optionExists(), outputFormat, qType, gfOutput::reportTargetStrand, reverseComplement(), round, dnaSeq::size, TRUE, and tType.

Referenced by main().

00090 {
00091 struct lineFile *lf = lineFileOpen(inName, TRUE);
00092 static bioSeq seq;
00093 FILE *out = mustOpen(outName, "w");
00094 enum gfType qType = gfTypeFromName(qTypeName);
00095 enum gfType tType = gfTypeFromName(tTypeName);
00096 int dotMod = 0;
00097 char databaseName[256];
00098 struct hash *tFileCache = gfFileCacheNew();
00099 
00100 snprintf(databaseName, sizeof(databaseName), "%s:%s", hostName, portName);
00101 
00102 gvo = gfOutputAny(outputFormat,  round(minIdentity*10), qType == gftProt, tType == gftProt,
00103         optionExists("nohead"), databaseName, 23, 3.0e9, minIdentity, out);
00104 gfOutputHead(gvo, out);
00105 while (faSomeSpeedReadNext(lf, &seq.dna, &seq.size, &seq.name, qType != gftProt))
00106     {
00107     int conn = gfConnect(hostName, portName);
00108     if (dots != 0)
00109         {
00110         if (++dotMod >= dots)
00111             {
00112             dotMod = 0;
00113             fputc('.', stdout);
00114             fflush(stdout);
00115             }
00116         }
00117     if (qType == gftProt && (tType == gftDnaX || tType == gftRnaX))
00118         {
00119         gvo->reportTargetStrand = TRUE;
00120         gfAlignTrans(&conn, tSeqDir, &seq, minScore, tFileCache, gvo);
00121         }
00122     else if ((qType == gftRnaX || qType == gftDnaX) && (tType == gftDnaX || tType == gftRnaX))
00123         {
00124         gvo->reportTargetStrand = TRUE;
00125         gfAlignTransTrans(&conn, tSeqDir, &seq, FALSE, minScore, tFileCache, 
00126                 gvo, qType == gftRnaX);
00127         if (qType == gftDnaX)
00128             {
00129             reverseComplement(seq.dna, seq.size);
00130             close(conn);
00131             conn = gfConnect(hostName, portName);
00132             gfAlignTransTrans(&conn, tSeqDir, &seq, TRUE, minScore, tFileCache,
00133                 gvo, FALSE);
00134             }
00135         }
00136     else if ((tType == gftDna || tType == gftRna) && (qType == gftDna || qType == gftRna))
00137         {
00138         gfAlignStrand(&conn, tSeqDir, &seq, FALSE, minScore, tFileCache, gvo);
00139         conn = gfConnect(hostName, portName);
00140         reverseComplement(seq.dna, seq.size);
00141         gfAlignStrand(&conn, tSeqDir, &seq, TRUE,  minScore, tFileCache, gvo);
00142         }
00143     else
00144         {
00145         errAbort("Comparisons between %s queries and %s databases not yet supported",
00146                 qTypeName, tTypeName);
00147         }
00148     gfOutputQuery(gvo, out);
00149     }
00150 if (out != stdout)
00151     printf("Output is in %s\n", outName);
00152 gfFileCacheFree(&tFileCache);
00153 }

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 155 of file gfClient.c.

References dots, ffIntronMaxDefault, gfClient(), minIdentity, minScore, optionExists(), optionFloat(), optionInit(), optionInt(), optionSpecs, optionVal(), outputFormat, qType, sameWord, setFfIntronMax(), tType, and usage().

00157 {
00158 optionInit(&argc, argv, optionSpecs);
00159 if (argc != 6)
00160     usage();
00161 if (optionExists("prot"))
00162     qType = tType = "prot";
00163 qType = optionVal("q", qType);
00164 tType = optionVal("t", tType);
00165 if (sameWord(tType, "prot") || sameWord(tType, "dnax") || sameWord(tType, "rnax"))
00166     minIdentity = 25;
00167 minIdentity = optionFloat("minIdentity", minIdentity);
00168 minScore = optionInt("minScore", minScore);
00169 dots = optionInt("dots", 0);
00170 outputFormat = optionVal("out", outputFormat);
00171 /* set global for fuzzy find functions */
00172 setFfIntronMax(optionInt("maxIntron", ffIntronMaxDefault));
00173 gfClient(argv[1], argv[2], argv[3], argv[4], argv[5], tType, qType);
00174 return 0;
00175 }

Here is the call graph for this function:

void usage (  ) 

Definition at line 35 of file gfClient.c.

References ffIntronMaxDefault, and gfVersion.

00037 {
00038 printf(
00039   "gfClient v. %s - A client for the genomic finding program that produces a .psl file\n"
00040   "usage:\n"
00041   "   gfClient host port seqDir in.fa out.psl\n"
00042   "where\n"
00043   "   host is the name of the machine running the gfServer\n"
00044   "   port is the same as you started the gfServer with\n"
00045   "   seqDir is the path of the .nib or .2bit files relative to the current dir\n"
00046   "       (note these are needed by the client as well as the server)\n"
00047   "   in.fa is a fasta format file.  May contain multiple records\n"
00048   "   out.psl where to put the output\n"
00049   "options:\n"
00050   "   -t=type     Database type.  Type is one of:\n"
00051   "                 dna - DNA sequence\n"
00052   "                 prot - protein sequence\n"
00053   "                 dnax - DNA sequence translated in six frames to protein\n"
00054   "               The default is dna\n"
00055   "   -q=type     Query type.  Type is one of:\n"
00056   "                 dna - DNA sequence\n"
00057   "                 rna - RNA sequence\n"
00058   "                 prot - protein sequence\n"
00059   "                 dnax - DNA sequence translated in six frames to protein\n"
00060   "                 rnax - DNA sequence translated in three frames to protein\n"
00061   "   -prot       Synonymous with -d=prot -q=prot\n"
00062   "   -dots=N   Output a dot every N query sequences\n"
00063   "   -nohead   Suppresses psl five line header\n"
00064   "   -minScore=N sets minimum score.  This is twice the matches minus the \n"
00065   "               mismatches minus some sort of gap penalty.  Default is 30\n"
00066   "   -minIdentity=N Sets minimum sequence identity (in percent).  Default is\n"
00067   "               90 for nucleotide searches, 25 for protein or translated\n"
00068   "               protein searches.\n"
00069   "   -out=type   Controls output file format.  Type is one of:\n"
00070   "                   psl - Default.  Tab separated format without actual sequence\n"
00071   "                   pslx - Tab separated format with sequence\n"
00072   "                   axt - blastz-associated axt format\n"
00073   "                   maf - multiz-associated maf format\n"
00074   "                   sim4 - similar to sim4 format\n"
00075   "                   wublast - similar to wublast format\n"
00076   "                   blast - similar to NCBI blast format\n"
00077   "                   blast8- NCBI blast tabular format\n"
00078   "                   blast9 - NCBI blast tabular format with comments\n"
00079   "   -maxIntron=N  Sets maximum intron size. Default is %d\n",
00080                         gfVersion, ffIntronMaxDefault);
00081 exit(-1);
00082 }


Variable Documentation

int dots = 0

Definition at line 28 of file gfClient.c.

Referenced by gfClient(), main(), mgBrezy(), and y_xor_line().

struct gfOutput* gvo

Definition at line 85 of file gfClient.c.

double minIdentity = 90

Definition at line 30 of file gfClient.c.

int minScore = 30

Definition at line 29 of file gfClient.c.

struct optionSpec optionSpecs[] [static]

Initial value:

 {
    {"prot", OPTION_BOOLEAN},
    {"q", OPTION_STRING},
    {"t", OPTION_STRING},
    {"minIdentity", OPTION_FLOAT},
    {"minScore", OPTION_INT},
    {"dots", OPTION_INT},
    {"out", OPTION_STRING},
    {"maxIntron", OPTION_INT},
    {"nohead", OPTION_BOOLEAN},
    {NULL, 0}
}

Definition at line 14 of file gfClient.c.

Referenced by main(), matchingOption(), optionInit(), parseAnOption(), parseOptions(), and validateOption().

char* outputFormat = "psl"

Definition at line 31 of file gfClient.c.

char* qType = "dna"

Definition at line 32 of file gfClient.c.

char const rcsid[] = "$Id: gfClient.c,v 1.34 2006/11/15 15:20:59 angie Exp $" [static]

Definition at line 12 of file gfClient.c.

char* tType = "dna"

Definition at line 33 of file gfClient.c.


Generated on Tue Dec 25 18:40:13 2007 for blat by  doxygen 1.5.2