int main(int argc, char **argv) { /* ACD data item variables */ AjPFile hmmfile = NULL; AjPSeqall seqfile = NULL; AjBool nuc = 0; ajint A = 0; float E = 0.0; float T = 0.0; ajint Z = 0; AjBool acc = ajFalse; AjBool compat = ajFalse; ajint cpu = 0; AjBool cutga = ajFalse; AjBool cuttc = ajFalse; AjBool cutnc = ajFalse; float dome = 0.0; float domt = 0.0; AjBool forward = ajFalse; AjBool nulltwo = ajFalse; AjBool pvm = ajFalse; AjBool xnu = ajFalse; AjPStr outname = NULL; /* Housekeeping variables */ AjPStr cmd = NULL; AjPStr rnd = NULL; AjPSeqout rndo = NULL; AjPSeq seq = NULL; /* ACD file processing */ embInitPV("ehmmpfam",argc,argv,"HMMERNEW",VERSION); hmmfile = ajAcdGetInfile("hmmfile"); seqfile = ajAcdGetSeqall("seqfile"); nuc = ajAcdGetBoolean("nuc"); A = ajAcdGetInt("A"); E = ajAcdGetFloat("E"); T = ajAcdGetFloat("T"); Z = ajAcdGetInt("Z"); acc = ajAcdGetBoolean("acc"); compat = ajAcdGetBoolean("compat"); cpu = ajAcdGetInt("cpu"); cutga = ajAcdGetBoolean("cutga"); cuttc = ajAcdGetBoolean("cuttc"); cutnc = ajAcdGetBoolean("cutnc"); dome = ajAcdGetFloat("dome"); domt = ajAcdGetFloat("domt"); forward = ajAcdGetBoolean("forward"); nulltwo = ajAcdGetBoolean("nulltwo"); pvm = ajAcdGetBoolean("pvm"); xnu = ajAcdGetBoolean("xnu"); outname = ajAcdGetOutfileName("outfile"); /* MAIN APPLICATION CODE */ /* 1. Housekeeping */ cmd = ajStrNew(); rnd = ajStrNew(); /* 2. Re-write seqfile to a temporary file in a format (fasta) HMMER can understand. We cannot just pass the name of seqfile to HMMER as the name provided might be a USA which HMMER would not understand. */ ajFilenameSetTempname(&rnd); rndo = ajSeqoutNew(); if(!ajSeqoutOpenFilename(rndo, rnd)) ajFatal("Terminal ajSeqFileNewOut failure. Email EMBOSS helpdesk!\n"); ajSeqoutSetFormatC(rndo, "fasta"); while(ajSeqallNext(seqfile, &seq)) ajSeqoutWriteSeq(rndo, seq); ajSeqoutClose(rndo); ajSeqoutDel(&rndo); /* 2. Build hmmpfam command line */ /* Command line is built in this order: i. Application name. ii. HMMER 'options' (in order they appear in ACD file) iii.HMMER 'options' (that don't appear in ACD file) iv. HMMER & new parameters. */ ajStrAssignS(&cmd, ajAcdGetpathC("hmmpfam")); if(nuc) ajStrAppendC(&cmd, " -n "); ajFmtPrintAppS(&cmd, " -A %d -E %f -T %f -Z %d", A, E, T, Z); if(acc) ajStrAppendC(&cmd, " --acc "); if(compat) ajStrAppendC(&cmd, " --compat "); if(cpu) ajFmtPrintAppS(&cmd, " --cpu %d ", cpu); if(cutga) ajStrAppendC(&cmd, " --cutga "); if(cuttc) ajStrAppendC(&cmd, " --cuttc "); if(cutnc) ajStrAppendC(&cmd, " --cutnc "); ajFmtPrintAppS(&cmd, " --domE %f --domT %f ", dome, domt); if(forward) ajStrAppendC(&cmd, " --forward "); if(nulltwo) ajStrAppendC(&cmd, " --null2 "); if(pvm) ajStrAppendC(&cmd, " --pvm "); if(xnu) ajStrAppendC(&cmd, " --xnu "); /* Note output redirected to outname. rnd is the name of the rewritten seqfile. MUST specify FASTA format explicitly. */ ajFmtPrintAppS(&cmd, " --informat FASTA %s %S", ajFileGetNameC(hmmfile), rnd); /* 3. Close ACD files. */ ajFileClose(&hmmfile); ajSeqallDel(&seqfile); /* 4. Call hmmpfam. Use C system call instead of ajSystem so that redirect in cmd works ok. */ ajFmtPrint("\n%S\n\n", cmd); ajSysExecOutnameAppendS(cmd,outname); /* 5. Exit cleanly */ ajSysFileUnlinkS(rnd); ajStrDel(&cmd); ajStrDel(&rnd); ajStrDel(&outname); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqset seqset = NULL; AjPStr cl = NULL; AjPSeqout seqout = NULL; AjBool full = ajFalse; AjPStr fn = NULL; AjPStr stmp = NULL; AjPStr outfname = NULL; embInitPV("echlorop", argc, argv, "CBSTOOLS", VERSION); seqset = ajAcdGetSeqset("sequence"); outfname= ajAcdGetOutfileName("outfile"); full = ajAcdGetBoolean("full"); cl = ajStrNewS(ajAcdGetpathC("chlorop")); fn = ajStrNew(); stmp = ajStrNew(); ajFilenameSetTempname(&fn); seqout = ajSeqoutNew(); if(!ajSeqoutOpenFilename(seqout, fn)) ajFatal("Cannot open temporary file %S",fn); ajSeqoutSetFormatC(seqout, "fasta"); ajSeqoutWriteSet(seqout,seqset); ajSeqoutClose(seqout); if(full) ajStrAppendC(&cl," -F"); ajFmtPrintS(&stmp," %S",fn); ajStrAppendS(&cl,stmp); #if 0 ajFmtPrint("%S\n",cl); #endif #if 1 ajSysExecOutnameAppendS(cl, outfname); #endif ajSysFileUnlinkS(fn); ajStrDel(&cl); ajStrDel(&fn); ajStrDel(&stmp); ajSeqoutDel(&seqout); ajSeqsetDel(&seqset); ajStrDel(&outfname); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqset seqset = NULL; AjPStr cl = NULL; AjPSeqout seqout = NULL; float thresh = 0.; AjBool netphos = ajFalse; AjPStr format = NULL; AjBool plot = ajFalse; AjPStr fn = NULL; AjPStr stmp = NULL; AjPStr outfname = NULL; embInitPV("eyinoyang", argc, argv, "CBSTOOLS",VERSION); seqset = ajAcdGetSeqset("sequence"); outfname= ajAcdGetOutfileName("outfile"); plot = ajAcdGetBoolean("plot"); netphos = ajAcdGetBoolean("netphos"); thresh = ajAcdGetFloat("threshold"); format = ajAcdGetListSingle("format"); cl = ajStrNewS(ajAcdGetpathC("yinOyang")); fn = ajStrNew(); stmp = ajStrNew(); ajFilenameSetTempname(&fn); seqout = ajSeqoutNew(); if(!ajSeqoutOpenFilename(seqout, fn)) ajFatal("Cannot open temporary file %S",fn); ajSeqoutSetFormatC(seqout, "fasta"); ajSeqoutWriteSet(seqout,seqset); ajSeqoutClose(seqout); if(ajStrMatchC(format,"short")) ajStrAppendC(&cl," -f s"); else if(ajStrMatchC(format,"long")) ajStrAppendC(&cl," -f l"); if(plot) ajStrAppendC(&cl," -g"); if(netphos) ajStrAppendC(&cl," -y"); if(netphos) { ajFmtPrintS(&stmp," -t %f",thresh); ajStrAppendS(&cl,stmp); } ajFmtPrintS(&stmp," %S",fn); ajStrAppendS(&cl,stmp); #if 0 ajFmtPrint("%`S\n",cl); #endif #if 1 ajSysExecOutnameAppendS(cl, outfname); #endif ajSysFileUnlinkS(fn); ajStrDel(&cl); ajStrDel(&fn); ajStrDel(&stmp); ajStrDel(&format); ajSeqoutDel(&seqout); ajSeqsetDel(&seqset); ajStrDel(&outfname); embExit(); return 0; }