int main(int argc, char **argv) { /* Variable declarations */ AjPFile outf = NULL; AjPXmlall xmlall = NULL; AjPXml xml = NULL; /* ACD processing */ embInit("xmltext", argc, argv); xmlall = ajAcdGetXmlall("xml"); outf = ajAcdGetOutfile("outfile"); while(ajXmlallNext(xmlall, &xml)) { ajFmtPrintF(outf,"%S",ajXmlGetEntry(xml)); } /* Memory clean-up and exit */ ajXmlallDel(&xmlall); ajXmlDel(&xml); ajFileClose(&outf); embExit(); return 0; }
int main(int argc, char **argv) { /* Variable declarations */ AjPOutfile outfile = NULL; AjPVarload varload = NULL; AjPVar variation = NULL; /* ACD processing */ embInit("variationget", argc, argv); varload = ajAcdGetVariation("variation"); outfile = ajAcdGetOutvariation("outfile"); while(ajVarloadNext(varload, &variation)) { while(ajVarloadMore(varload, &variation)) { ajVaroutWriteNext(outfile, variation); } ajOutfileReset(outfile); } /* Memory clean-up and exit */ ajVarloadDel(&varload); ajVarDel(&variation); ajOutfileClose(&outfile); embExit(); return 0; }
int main(int argc, char **argv) { /* Variable declarations */ AjPFile outfile = NULL; AjPResourceall resourceall = NULL; AjPResource resource = NULL; /* ACD processing */ embInit("drtext", argc, argv); resourceall = ajAcdGetResourceall("resources"); outfile = ajAcdGetOutfile("outfile"); while(ajResourceallNext(resourceall, &resource)) { ajFmtPrintF(outfile,"%S",ajResourceGetEntry(resource)); } ajResourceallDel(&resourceall); ajResourceDel(&resource); ajFileClose(&outfile); embExit(); return 0; }
int main(int argc, char **argv) { /* Variable declarations */ AjPOutfile outfile = NULL; AjPResourceall resourceall = NULL; AjPResource resource = NULL; /* ACD processing */ embInit("drget", argc, argv); resourceall = ajAcdGetResourceall("resources"); outfile = ajAcdGetOutresource("outfile"); while(ajResourceallNext(resourceall, &resource)) { ajResourceoutWrite(outfile, resource); } ajResourceallDel(&resourceall); ajResourceDel(&resource); ajOutfileClose(&outfile); embExit(); return 0; }
int main(int argc, char **argv) { AjPFeattaball featin; AjPFeattable feat = NULL; embInit("benchmark", argc, argv); featin = ajAcdGetFeaturesall("features"); long counter = 0; while(ajFeattaballNext(featin, &feat)) { counter++; } ajFeattableDel(&feat); ajFeattaballDel(&featin); printf("Read %li records\n", counter); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqall seqall; AjPSeqout seqout; AjPSeq seq = NULL; AjBool firstonly; embInit("seqret", argc, argv); seqout = ajAcdGetSeqoutall("outseq"); seqall = ajAcdGetSeqall("sequence"); firstonly = ajAcdGetBoolean("firstonly"); while(ajSeqallNext(seqall, &seq)) { ajSeqoutWriteSeq(seqout, seq); if(firstonly) break; } ajSeqoutClose(seqout); ajSeqallDel(&seqall); ajSeqDel(&seq); ajSeqoutDel(&seqout); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqout seqout; AjPSeqall seqall; AjPSeq seq = NULL; embInit("seqretallfeat", argc, argv); seqout = ajAcdGetSeqoutall("outseq"); seqall = ajAcdGetSeqall("sequence"); while (ajSeqallNext(seqall, &seq)) { ajSeqoutWriteSeq(seqout, seq); ajSeqTrace(seq); } ajSeqoutClose(seqout); ajFeatTest(); ajSeqallDel(&seqall); ajSeqDel(&seq); ajSeqoutDel(&seqout); embExit(); return 0; }
int main(int argc, char **argv) { // initialize EMBASSY info embInitPV("kclique", argc, argv, "KBWS", "1.0.9"); struct soap soap; char* jobid; char* result; AjPFile infile; AjPFile outf; AjPStr substr; AjPStr indata = NULL; AjPStr line = NULL; infile = ajAcdGetInfile("infile"); outf = ajAcdGetOutfile("outfile"); while (ajReadline(infile, &line)) { ajStrAppendS(&indata, line); ajStrAppendC(&indata, "\n"); } soap_init(&soap); char* in0; in0 = ajCharNewS(indata); if ( soap_call_ns1__runClique( &soap, NULL, NULL, in0, &jobid ) == SOAP_OK ) { } else { soap_print_fault(&soap, stderr); } int check = 0; while ( check == 0 ) { if ( soap_call_ns1__checkStatus( &soap, NULL, NULL, jobid, &check ) == SOAP_OK ) { } else { soap_print_fault(&soap, stderr); } sleep(3); } if ( soap_call_ns1__getResult( &soap, NULL, NULL, jobid, &result ) == SOAP_OK ) { substr = ajStrNewC(result); ajFmtPrintF(outf,"%S\n",substr); } else { soap_print_fault(&soap, stderr); } soap_destroy(&soap); soap_end(&soap); soap_done(&soap); ajFileClose(&infile); ajFileClose(&outf); ajStrDel(&substr); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqall seqall; AjPSeq seq = NULL; AjPFile primerFile; /* read the primer pairs from a file */ AjPFile outf; AjPList primerList; ajint mmp = 0; embInit("primersearch", argc, argv); seqall = ajAcdGetSeqall("seqall"); outf = ajAcdGetOutfile("outfile"); primerFile = ajAcdGetInfile("infile"); mmp = ajAcdGetInt("mismatchpercent"); /* build list of forward/reverse primer pairs as read from primerfile */ primerList = ajListNew(); /* read in primers from primerfile, classify and compile them */ primersearch_read_primers(&primerList,primerFile, mmp); /* check there are primers to be searched */ if(!ajListGetLength(primerList)) { ajErr("No suitable primers found - exiting"); embExitBad(); return 0; } /* query sequences one by one */ while(ajSeqallNext(seqall,&seq)) primersearch_primer_search(primerList, seq); /* output the results */ primersearch_print_hits(primerList, outf); /* delete all nodes of list, then the list itself */ ajListMap(primerList, primersearch_free_primer, NULL); ajListFree(&primerList); ajListFree(&primerList); ajFileClose(&outf); ajSeqallDel(&seqall); ajSeqDel(&seq); ajFileClose(&primerFile); embExit(); return 0; }
int main(int argc, char **argv) { /* ACD data item variables */ AjPFile database = NULL; /* Housekeeping variables */ AjPStr cmd = NULL; AjPStr tmp = NULL; /* ACD file processing */ embInitPV("ehmmindex",argc,argv,"HMMERNEW",VERSION); database = ajAcdGetInfile("database"); /* MAIN APPLICATION CODE */ /* 1. Housekeeping */ cmd = ajStrNew(); tmp = ajStrNew(); /* 2. Build hmmindex 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. */ ajFmtPrintS(&cmd, "%S ", ajAcdGetpathC("hmmindex")); ajStrAppendC(&cmd, ajFileGetNameC(database)); /* 3. Close ACD files. */ ajFileClose(&database); /* 4. Call hmmindex */ ajFmtPrint("\n%S\n\n", cmd); system(ajStrGetPtr(cmd)); /* 5. Exit cleanly */ ajStrDel(&cmd); ajStrDel(&tmp); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqall seqall; AjPSeq a; AjPSeqout outf; AjPStr substr; AjPStr back; AjPStr gctable; AjPCod codon = NULL; ajint gctablenum; ajint beg; ajint end; embInit("backtranambig", argc, argv); seqall = ajAcdGetSeqall("sequence"); outf = ajAcdGetSeqoutall("outfile"); gctable = ajAcdGetListSingle("table"); ajStrToInt(gctable, &gctablenum); codon = ajCodNewCodenum(gctablenum); while(ajSeqallNext(seqall, &a)) { substr = ajStrNew(); beg = ajSeqGetBegin(a); end = ajSeqGetEnd(a); ajStrAssignSubC(&substr,ajSeqGetSeqC(a),beg-1,end-1); back = ajStrNew(); ajCodBacktranslateAmbig(&back,substr,codon); ajSeqAssignSeqS (a, back); ajSeqSetNuc(a); ajSeqoutWriteSeq(outf,a); } ajSeqoutClose(outf); ajStrDel(&back); ajStrDel(&substr); ajSeqoutDel(&outf); ajCodDel(&codon); ajStrDel(&gctable); ajSeqallDel(&seqall); ajSeqDel(&a); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqall seqall; AjPSeqout seqout; AjPSeqout junkout; AjPSeq seq = NULL; AjPStr exclude = NULL; AjPStr pattern = NULL; AjPStr name = NULL; AjPStr acc = NULL; embInit("notseq", argc, argv); seqout = ajAcdGetSeqoutall("outseq"); junkout = ajAcdGetSeqoutall("junkoutseq"); seqall = ajAcdGetSeqall("sequence"); exclude = ajAcdGetString("exclude"); notseq_readfile(exclude, &pattern); while(ajSeqallNext(seqall, &seq)) { ajStrAssignS(&name, ajSeqGetNameS(seq)); ajStrAssignS(&acc, ajSeqGetAccS(seq)); if(embMiscMatchPatternDelimC(name, pattern, ",;") || embMiscMatchPatternDelimC(acc, pattern, ",;")) ajSeqoutWriteSeq(junkout, seq); else /* no match, so not excluded */ ajSeqoutWriteSeq(seqout, seq); ajStrSetClear(&name); ajStrSetClear(&acc); } ajSeqoutClose(seqout); ajSeqoutClose(junkout); ajSeqallDel(&seqall); ajSeqDel(&seq); ajSeqoutDel(&seqout); ajSeqoutDel(&junkout); ajStrDel(&exclude); ajStrDel(&pattern); ajStrDel(&name); ajStrDel(&acc); embExit(); return 0; }
int main(int argc, char **argv) { /* Variable Declarations */ AjPFile outf; AjPStr code = NULL; char code1; ajuint i; ajuint iend; /* ACD File Processing */ embInit("infobase", argc, argv); code = ajAcdGetString("code"); outf = ajAcdGetOutfile("outfile"); /* Application logic */ ajStrFmtUpper(&code); iend = ajStrGetLen(code); ajFmtPrintF(outf, "%4s %-10s %-10s %s\n", "Code", "Ambiguity", "Complement", "Mnemonic"); for(i=0;i<iend;i++) { code1=ajStrGetCharPos(code,i); if(ajBaseExistsChar(code1)) { ajFmtPrintF(outf, "%-4c %-10S %-10c %S\n", code1, ajBaseGetCodes(code1), ajBaseAlphacharComp(code1), ajBaseGetMnemonic(code1)); } else { ajFmtPrintF(outf, "%-4c %-10s %-10c %s\n", code1, ".", '.', "invalid"); } } /* Memory management and exit */ ajStrDel(&code); ajFileClose(&outf); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqset seqset; AjPSeqall seqall; AjPSeq seq; ajint i = 0; AjPStr kimout = NULL; AjPStr dir = NULL; AjPFile obofile = NULL; AjPFile resfile = NULL; AjPDir taxdir = NULL; embInit("ajtest", argc, argv); seqall = ajAcdGetSeqall ("sequence"); seqset = ajAcdGetSeqset ("bsequence"); dir = ajAcdGetOutdirName("outdir"); obofile = ajAcdGetInfile ("obofile"); taxdir = ajAcdGetDirectory ("taxdir"); resfile = ajAcdGetInfile ("dbxreffile"); ajUser("Directory '%S'", dir); ajUser("Set of %d", ajSeqsetGetSize(seqset)); while(ajSeqallNext (seqall, &seq)) { ajUser ("%3d <%S>", i++, ajSeqGetUsaS(seq)); ajFmtPrintS(&kimout, "kim%d.out", i); ajtest_kim (kimout, seq); } ajSeqDel(&seq); ajSeqallDel(&seqall); ajSeqsetDel(&seqset); ajStrDel(&kimout); ajStrDel(&dir); if(taxdir) ajTaxLoad(taxdir); ajDirDel(&taxdir); if(obofile) ajOboParseObofile(obofile, ""); ajFileClose(&obofile); if(resfile) ajResourceParse(resfile, ""); ajFileClose(&resfile); embExit(); return 0; }
int main(int argc, Char *argv[]) { /* main program */ long i; #ifdef MAC argc = 1; /* macsetup("Contml",""); */ argv[0] = "Contml"; #endif init(argc, argv); emboss_getoptions("fcontml", argc, argv); progname = argv[0]; ibmpc = IBMCRT; ansi = ANSICRT; firstset = true; doinit(); for (ith = 1; ith <= datasets; ith++) { getinput(); if (ith == 1) firstset = false; if (datasets > 1) { fprintf(outfile, "Data set # %ld:\n\n", ith); if (progress) printf("\nData set # %ld:\n", ith); } for (jumb = 1; jumb <= njumble; jumb++) maketree(); if (usertree) for (i = 0; i < MAXSHIMOTREES; i++) free(l0gf[i]); } FClose(outfile); FClose(outtree); #ifdef MAC fixmacfile(outfilename); fixmacfile(outtreename); #endif printf("\nDone.\n\n"); #ifdef WIN32 phyRestoreConsoleAttributes(); #endif ajPhyloFreqDel(&phylofreq); ajPhyloTreeDelarray(&phylotrees); ajFileClose(&embossoutfile); ajFileClose(&embossouttree); embExit(); return 0; }
int main(int argc, char **argv) { /* Variable Declarations */ AjPFile inf = NULL; AjPFile outf = NULL; AjPStr line = NULL; /* Line from inf */ AjPStr option = NULL; AjBool doall = AJFALSE; AjBool doend = AJFALSE; AjBool doexcess = AJFALSE; /* ACD File Processing */ embInit("nospace", argc, argv); inf = ajAcdGetInfile("infile"); outf = ajAcdGetOutfile("outfile"); option = ajAcdGetListSingle("menu"); if(ajStrMatchC(option, "all")) doall = ajTrue; else if(ajStrMatchC(option, "end")) doend = ajTrue; else if(ajStrMatchC(option, "excess")) doexcess = ajTrue; /* Application logic */ line = ajStrNew(); while(ajReadline(inf,&line)) { if(doall) ajStrRemoveWhite(&line); else if(doend) ajStrTrimWhiteEnd(&line); else if(doexcess) ajStrRemoveWhiteExcess(&line); ajFmtPrintF(outf, "%S\n", line); } /* Memory management and exit */ ajFileClose(&inf); ajFileClose(&outf); ajStrDel(&line); ajStrDel(&option); embExit(); return 0; }
int main(int argc, char **argv) { if(argc < 2) ajFatal("Error - must specify an application to compile\n"); ajAcdSetControl("acdtrace"); ajAcdSetControl("acdnocommandline"); embInit(argv[1], argc-1, &argv[1]); ajAcdExit(ajTrue); /* turn off the 'never used' ACD warnings */ embExit(); return 0; }
int main(int argc, char **argv) { /* Variable Declarations */ AjPSeqset seqset = NULL; AjPAlign align = NULL; AjPStr name = NULL; AjPStr comment = NULL; AjBool append = ajFalse; AjPStr header = NULL; /* ACD File Processing */ embInit("aligncopy", argc, argv); seqset = ajAcdGetSeqset("sequences"); align = ajAcdGetAlign("outfile"); name = ajAcdGetString("name"); comment = ajAcdGetString("comment"); append = ajAcdGetBoolean("append"); /* Application logic */ ajAlignDefine(align, seqset); if(ajStrGetLen(name)) ajFmtPrintS(&header, "Alignment: %S\n\n", name); ajStrAppendS(&header, comment); if(append) ajAlignSetHeaderApp(align, header); else ajAlignSetHeader(align, header); ajAlignWrite(align); ajAlignClose(align); /* Memory management and exit */ ajSeqsetDel(&seqset); ajAlignDel(&align); ajStrDel(&name); ajStrDel(&comment); ajStrDel(&header); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqall seqall; AjPSeq seq; AjPFile outf; AjPCod codon; AjPStr substr; ajint beg; ajint end; ajint ccnt; embInit("cusp", argc, argv); seqall = ajAcdGetSeqall("sequence"); outf = ajAcdGetOutfile("outfile"); ccnt = 0; substr = ajStrNew(); codon = ajCodNewCodenum(0); ajCodSetNameS(codon, ajFileGetPrintnameS(outf)); while(ajSeqallNext(seqall, &seq)) { beg = ajSeqallGetseqBegin(seqall); end = ajSeqallGetseqEnd(seqall); ajStrAssignSubS(&substr,ajSeqGetSeqS(seq),beg-1,end-1); ajCodSetTripletsS(codon,substr,&ccnt); } ajCodCalcUsage(codon,ccnt); ajCodSetDescC(codon, "CUSP codon usage file"); ajCodWrite(codon, outf); ajFileClose(&outf); ajStrDel(&substr); ajCodDel(&codon); ajSeqallDel(&seqall); ajSeqDel(&seq); embExit(); return 0; }
int main(int argc, Char *argv[]) { /* Read in sequences or frequencies and bootstrap or jackknife them */ #ifdef MAC argc = 1; /* macsetup("SeqBoot",""); */ argv[0] = "SeqBoot"; #endif init(argc,argv); emboss_getoptions("ffreqboot", argc, argv); ibmpc = IBMCRT; ansi = ANSICRT; doinput(argc, argv); bootwrite(); FClose(infile); if (weights) FClose(weightfile); if (categories) { FClose(catfile); FClose(outcatfile); } if(mixture) FClose(outmixfile); if(ancvar) FClose(outancfile); if (justwts && !permute) { FClose(outweightfile); } else FClose(outfile); #ifdef MAC fixmacfile(outfilename); if (justwts && !permute) fixmacfile(outweightfilename); if (categories) fixmacfile(outcatfilename); if (mixture) fixmacfile(outmixfilename); #endif printf("Done.\n\n"); #ifdef WIN32 phyRestoreConsoleAttributes(); #endif embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqall seqall; AjPSeq seq; AjPTable table = 0; AjPFile outf; ajint wordsize; ajint mincount; embInit("wordcount", argc, argv); seqall = ajAcdGetSeqall("sequence1"); wordsize = ajAcdGetInt("wordsize"); outf = ajAcdGetOutfile("outfile"); mincount = ajAcdGetInt("mincount"); embWordLength(wordsize); while (ajSeqallNext(seqall, &seq)) { embWordGetTable(&table, seq); /* get table of words */ } embWordPrintTableFI(table, mincount, outf); /* print table of words */ /* ** test if table can be added to ** if(getWordTable(&table, seq, wordcount)) ?? get table of words ?? ** { ** printWordTable(table); ?? print table of words ?? ** } */ embWordFreeTable(&table); /* free table of words */ ajSeqallDel(&seqall); ajSeqDel(&seq); ajFileClose(&outf); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeq seq = NULL; AjPFile outf = NULL; embInitPV("myseq", argc, argv, "myemboss",VERSION); seq = ajAcdGetSeq("sequence"); outf = ajAcdGetOutfile("outfile"); ajFmtPrintF(outf, "Sequence properties\n"); ajFmtPrintF(outf, "===================\n"); ajFmtPrintF(outf, "Name: %S\n", ajSeqGetNameS(seq)); ajFmtPrintF(outf, "Usa: %S\n", ajSeqGetUsaS(seq)); ajFmtPrintF(outf, "Length: %d\n", ajSeqGetLen(seq)); ajFileClose(&outf); embExit(); return 0; }
int main(int argc, char **argv) { /* Variable Declarations */ AjPSeqset seqset = NULL; AjPSeqout seqout = NULL; AjBool bigfirst; ajuint nseqs; ajuint i; /* ACD File Processing */ embInit("sizeseq", argc, argv); seqset = ajAcdGetSeqset("sequences"); bigfirst = ajAcdGetBoolean("descending"); seqout = ajAcdGetSeqoutall("outseq"); /* Application logic */ ajSeqsetSortLen(seqset); nseqs = ajSeqsetGetSize(seqset); if(bigfirst) { for(i=nseqs; i>0; i--) ajSeqoutWriteSeq(seqout, ajSeqsetGetseqSeq(seqset,i-1)); } else { for(i=0; i<nseqs; i++) ajSeqoutWriteSeq(seqout, ajSeqsetGetseqSeq(seqset,i)); } /* Memory management and exit */ ajSeqsetDel(&seqset); ajSeqoutClose(seqout); ajSeqoutDel(&seqout); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqall seqall; AjPFile outf; AjPSeq seq = NULL; AjPList xrefs = NULL; ajuint nrefs; AjPSeqXref xref = NULL; embInit("seqxref", argc, argv); outf = ajAcdGetOutfile("outfile"); seqall = ajAcdGetSeqall("sequence"); xrefs = ajListNew(); while(ajSeqallNext(seqall, &seq)) { nrefs = ajSeqGetXrefs(seq, xrefs); ajSeqxreflistSort(xrefs); ajFmtPrintF(outf, "#%S: %u\n", ajSeqGetUsaS(seq), nrefs); while(ajListPop(xrefs, (void**)&xref)) { ajFmtPrintF(outf, "%S:%S\n", xref->Db, xref->Id); ajSeqxrefDel(&xref); } } ajListFree(&xrefs); ajSeqDel(&seq); ajFileClose(&outf); ajSeqallDel(&seqall); embExit(); return 0; }
int main(int argc, char **argv) { AjPStr directory = NULL; AjPTable mtable = NULL; AjPList jdirlist = NULL; AjPStr jdirloc = NULL; embInit("jaspextract",argc,argv); directory = ajAcdGetDirectoryName("directory"); mtable = ajTablestrNewLen(PFMNUMGUESS); jdirlist = ajListNew(); jaspextract_openoutdirs(); jaspextract_copyfiles(directory); jaspextract_readmatrixlist(mtable, directory); jaspextract_getjaspdirs(jdirlist); while(ajListPop(jdirlist,(void **)&jdirloc)) { jaspextract_writematrixfile(mtable, jdirloc); ajStrDel(&jdirloc); } ajTablestrFree(&mtable); ajStrDel(&directory); ajListFree(&jdirlist); embExit(); return 0; }
int getorf_acd(int argc, char **argv) { AjPSeqout seqout; AjPSeqall seqall; AjPStr tablestr; ajuint minsize; ajuint maxsize; AjPStr findstr; AjBool methionine; AjBool circular; AjBool reverse; ajint around; embInit("getorf", argc, argv); seqout = ajAcdGetSeqoutall("outseq"); seqall = ajAcdGetSeqall("sequence"); tablestr = ajAcdGetListSingle("table"); minsize = ajAcdGetInt("minsize"); maxsize = ajAcdGetInt("maxsize"); findstr = ajAcdGetListSingle("find"); methionine = ajAcdGetBoolean("methionine"); circular = ajAcdGetBoolean("circular"); reverse = ajAcdGetBoolean("reverse"); around = ajAcdGetInt("flanking"); getorf(seqout, seqall, tablestr, minsize, maxsize, findstr, methionine, circular, reverse, around); ajSeqoutClose(seqout); ajSeqallDel(&seqall); ajSeqoutDel(&seqout); ajStrDel(&tablestr); ajStrDel(&findstr); embExit(); return 0; }
int main(int argc, char **argv) { /* Variable declarations */ AjPOutfile outfile = NULL; AjPRefseq refseq = NULL; /* ACD processing */ embInit("refseqget", argc, argv); refseq = ajAcdGetRefseq("refsequence"); outfile = ajAcdGetOutrefseq("outfile"); ajRefseqoutWrite(outfile, refseq); /* Memory clean-up and exit */ ajRefseqDel(&refseq); ajOutfileClose(&outfile); embExit(); return 0; }
int main(int argc, char **argv) { /* Variable Declarations */ AjPSeqset seqset = NULL; AjPMatrixf fmat = NULL; float thresh; float threshlow; float threshup; float gapopen; float gapextend; AjPSeqout seqout = NULL; AjPSeqout seqoutred = NULL; AjPStr mode = NULL; ajint moden; ajuint i; /* toggle "feature" from ACD not retrieved ... no need */ const AjPSeq seq = NULL; AjPList list = NULL; /* List for redundancy removal. */ AjPUint keep = NULL; /* 1: Sequence in list was non-redundant, 0: redundant. */ ajuint nseq = 0; /* No. seqs. in list. */ ajint nseqnr = 0; /* No. non-redundant seqs. in list. */ /* ACD File Processing */ embInit("skipredundant", argc, argv); seqset = ajAcdGetSeqset("sequences"); mode = ajAcdGetListSingle("mode"); fmat = ajAcdGetMatrixf("datafile"); thresh = ajAcdGetFloat("threshold"); threshlow = ajAcdGetFloat("minthreshold"); threshup = ajAcdGetFloat("maxthreshold"); gapopen = ajAcdGetFloat("gapopen"); gapextend = ajAcdGetFloat("gapextend"); seqout = ajAcdGetSeqoutall("outseq"); seqoutred = ajAcdGetSeqoutall("redundantoutseq"); /* Application logic */ list = ajListNew(); skipredundant_SeqsetToList(list, seqset); keep = ajUintNew(); ajStrToInt(mode, &moden); if(moden == 1) /* Remove redundancy at a single threshold % sequence similarity */ { if((!embDmxSeqNR(list, &keep, &nseqnr, fmat, gapopen, gapextend, thresh, ajFalse))) ajFatal("embDmxSeqNR unexpected failure!"); } else if (moden == 2) /* 2: Remove redundancy outside a range of acceptable threshold % similarity */ { if((!embDmxSeqNRRange(list, &keep, &nseqnr, fmat, gapopen, gapextend, threshlow, threshup, ajFalse))) ajFatal("embDmxSeqNRRange unexpected failure!"); } else ajFatal("Invalid mode (not 1 or 2) which should never occur (check ACD file!)"); nseq = ajSeqsetGetSize(seqset); for(i=0; i<nseq; i++) { seq = ajSeqsetGetseqSeq(seqset, i); if(ajUintGet(keep, i)) ajSeqoutWriteSeq(seqout, seq); else if(seqoutred) ajSeqoutWriteSeq(seqoutred, seq); } /* Memory management and exit */ ajSeqsetDel(&seqset); ajMatrixfDel(&fmat); ajStrDel(&mode); ajSeqoutClose(seqout); ajSeqoutDel(&seqout); if(seqoutred) { ajSeqoutClose(seqoutred); ajSeqoutDel(&seqoutred); } skipredundant_ClearList(list); ajListFree(&list); ajUintDel(&keep); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqall seqall; AjPSeq seq = NULL; AjPReport report = NULL; AjPStr jaspdir = NULL; AjPStr menu = NULL; AjPStr substr = NULL; AjPStr mats = NULL; AjPStr excl = NULL; float thresh = 0.; ajuint recurs = 0; AjPStr dir = NULL; AjPStr mfname = NULL; AjPList flist = NULL; AjPList hits = NULL; AjPStr head = NULL; ajint begin; ajint end; ajuint mno; char cp; ajuint i; AjPTable mattab = NULL; AjPFeattable TabRpt = NULL; AjBool both = ajFalse; embInit("jaspscan", argc, argv); seqall = ajAcdGetSeqall("sequence"); menu = ajAcdGetListSingle("menu"); mats = ajAcdGetString("matrices"); excl = ajAcdGetString("exclude"); thresh = ajAcdGetFloat("threshold"); report = ajAcdGetReport("outfile"); both = ajAcdGetBoolean("both"); jaspdir = ajStrNew(); substr = ajStrNew(); flist = ajListNew(); hits = ajListNew(); dir = ajStrNew(); head = ajStrNew(); cp = ajStrGetCharFirst(menu); if(cp=='C') ajStrAssignC(&jaspdir,J_COR); else if(cp=='F') ajStrAssignC(&jaspdir,J_FAM); else if(cp=='P') ajStrAssignC(&jaspdir,J_PHY); else if(cp=='N') ajStrAssignC(&jaspdir,J_CNE); else if(cp=='O') ajStrAssignC(&jaspdir,J_POL); else if(cp=='S') ajStrAssignC(&jaspdir,J_SPL); else ajFatal("Invalid JASPAR database selection"); ajStrAssignS(&dir, ajDatafileValuePath()); if(!ajStrGetLen(dir)) ajFatal("EMBOSS DATA directory couldn't be determined"); jaspscan_ParseInput(dir, jaspdir, mats, excl, &recurs, flist); mno = ajListGetLength(flist); if(cp == 'C') mattab = jaspscan_ReadCoreList(jaspdir); if(cp == 'F') mattab = jaspscan_ReadFamList(jaspdir); if(cp == 'P') mattab = jaspscan_ReadCoreList(jaspdir); if(cp == 'N') mattab = jaspscan_ReadCoreList(jaspdir); if(cp == 'O') mattab = jaspscan_ReadCoreList(jaspdir); if(cp == 'S') mattab = jaspscan_ReadCoreList(jaspdir); ajFmtPrintS(&head,"Database scanned: %S Threshold: %.3f",jaspdir,thresh); ajReportSetHeaderS(report,head); while(ajSeqallNext(seqall, &seq)) { begin = ajSeqallGetseqBegin(seqall); end = ajSeqallGetseqEnd(seqall); ajStrAssignSubC(&substr,ajSeqGetSeqC(seq),begin-1,end-1); ajStrFmtUpper(&substr); TabRpt = ajFeattableNewSeq(seq); for(i=0; i < mno; ++i) { ajListPop(flist,(void **)&mfname); jaspscan_scan(substr,begin,mfname, cp, thresh, both, hits); ajListPushAppend(flist, (void **)mfname); } jaspscan_ReportHits(TabRpt,mattab,hits); ajReportWrite(report, TabRpt, seq); ajFeattableDel(&TabRpt); } while(ajListPop(flist,(void **)&mfname)) ajStrDel(&mfname); ajStrDel(&dir); ajStrDel(&menu); ajStrDel(&excl); ajStrDel(&substr); ajStrDel(&mats); ajStrDel(&head); ajStrDel(&jaspdir); ajSeqDel(&seq); ajTableMapDel(mattab,jaspscan_ClearTable,NULL); ajTableFree(&mattab); ajListFree(&flist); ajListFree(&hits); ajSeqallDel(&seqall); ajReportDel(&report); 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; }