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) { /* 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) { 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) { /* 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) { 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) { 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) { 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) { /* 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) { /* 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) { 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) { /* 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) { ajint begin, end; AjPSeqall seqall; AjPSeq seq; EmbPShow ss; AjPFile outfile; AjPStr tablename; ajint table; AjPRange uppercase; AjPRange highlight; AjBool threeletter; AjBool numberseq; AjBool nameseq; ajint width; ajint length; ajint margin; AjBool description; ajint offset; AjBool html; AjPStr descriptionline; ajint orfminsize; AjPTrn trnTable; AjBool translation; AjBool reverse; AjBool cutlist; AjBool flat; EmbPMatMatch mm = NULL; AjPStr *framelist; AjBool frames[6]; /* frames to be translated 1 to 3, -1 to -3 */ /* stuff for tables and lists of enzymes and hits */ ajint default_mincuts = 1; ajint default_maxcuts = 2000000000; AjPTable hittable; /* enzyme hits */ /* stuff lifted from Alan's 'restrict.c' */ AjPStr enzymes = NULL; ajint mincuts; ajint maxcuts; ajint sitelen; AjBool single; AjBool blunt; AjBool sticky; AjBool ambiguity; AjBool plasmid; AjBool commercial; AjBool limit; AjBool methyl; AjPFile enzfile = NULL; AjPFile equfile = NULL; AjPFile methfile = NULL; AjPTable retable = NULL; ajint hits; AjPList restrictlist = NULL; embInit("remap", argc, argv); seqall = ajAcdGetSeqall("sequence"); outfile = ajAcdGetOutfile("outfile"); tablename = ajAcdGetListSingle("table"); uppercase = ajAcdGetRange("uppercase"); highlight = ajAcdGetRange("highlight"); threeletter = ajAcdGetBoolean("threeletter"); numberseq = ajAcdGetBoolean("number"); width = ajAcdGetInt("width"); length = ajAcdGetInt("length"); margin = ajAcdGetInt("margin"); nameseq = ajAcdGetBoolean("name"); description = ajAcdGetBoolean("description"); offset = ajAcdGetInt("offset"); html = ajAcdGetBoolean("html"); orfminsize = ajAcdGetInt("orfminsize"); translation = ajAcdGetBoolean("translation"); reverse = ajAcdGetBoolean("reverse"); cutlist = ajAcdGetBoolean("cutlist"); flat = ajAcdGetBoolean("flatreformat"); framelist = ajAcdGetList("frame"); /* restriction enzyme stuff */ mincuts = ajAcdGetInt("mincuts"); maxcuts = ajAcdGetInt("maxcuts"); sitelen = ajAcdGetInt("sitelen"); single = ajAcdGetBoolean("single"); blunt = ajAcdGetBoolean("blunt"); sticky = ajAcdGetBoolean("sticky"); ambiguity = ajAcdGetBoolean("ambiguity"); plasmid = ajAcdGetBoolean("plasmid"); commercial = ajAcdGetBoolean("commercial"); limit = ajAcdGetBoolean("limit"); enzymes = ajAcdGetString("enzymes"); methfile = ajAcdGetDatafile("mfile"); methyl = ajAcdGetBoolean("methylation"); if(!blunt && !sticky) ajFatal("Blunt/Sticky end cutters shouldn't both be disabled."); /* get the number of the genetic code used */ ajStrToInt(tablename, &table); trnTable = ajTrnNewI(table); /* read the local file of enzymes names */ remap_read_file_of_enzyme_names(&enzymes); /* get the frames to be translated */ remap_GetFrames(framelist, frames); while(ajSeqallNext(seqall, &seq)) { /* get begin and end positions */ begin = ajSeqGetBegin(seq)-1; end = ajSeqGetEnd(seq)-1; /* do the name and description */ if(nameseq) { if(html) ajFmtPrintF(outfile, "<H2>%S</H2>\n", ajSeqGetNameS(seq)); else ajFmtPrintF(outfile, "%S\n", ajSeqGetNameS(seq)); } if(description) { /* ** wrap the description line at the width of the sequence ** plus margin */ if(html) ajFmtPrintF(outfile, "<H3>%S</H3>\n", ajSeqGetDescS(seq)); else { descriptionline = ajStrNew(); ajStrAssignS(&descriptionline, ajSeqGetDescS(seq)); ajStrFmtWrap(&descriptionline, width+margin); ajFmtPrintF(outfile, "%S\n", descriptionline); ajStrDel(&descriptionline); } } /* get the restriction cut sites */ /* ** most of this is lifted from the program 'restrict.c' by Alan ** Bleasby */ if(single) maxcuts=mincuts=1; retable = ajTablestrNew(EQUGUESS); enzfile = ajDatafileNewInNameC(ENZDATA); if(!enzfile) ajFatal("Cannot locate enzyme file. Run REBASEEXTRACT"); if(limit) { equfile = ajDatafileNewInNameC(EQUDATA); if(!equfile) limit = ajFalse; else remap_read_equiv(&equfile, &retable, commercial); } ajFileSeek(enzfile, 0L, 0); restrictlist = ajListNew(); /* search for hits, but don't use mincuts and maxcuts criteria yet */ hits = embPatRestrictMatch(seq, begin+1, end+1, enzfile, methfile, enzymes, sitelen,plasmid, ambiguity, default_mincuts, default_maxcuts, blunt, sticky, commercial, methyl, restrictlist); ajDebug("Remap found %d hits\n", hits); if(hits) { /* this bit is lifted from printHits */ embPatRestrictRestrict(restrictlist, hits, !limit, ajFalse); if(limit) remap_RestrictPreferred(restrictlist,retable); } ajFileClose(&enzfile); ajFileClose(&methfile); /* ** Remove those violating the mincuts and maxcuts ** criteria, but save them in hittable for printing out later. ** Keep a count of how many hits each enzyme gets in hittable. */ hittable = ajTablestrNewCase(TABLEGUESS); remap_RemoveMinMax(restrictlist, hittable, mincuts, maxcuts); /* make the Show Object */ ss = embShowNew(seq, begin, end, width, length, margin, html, offset); if(html) ajFmtPrintF(outfile, "<PRE>"); /* create the format to display */ embShowAddBlank(ss); embShowAddRE(ss, 1, restrictlist, plasmid, flat); embShowAddSeq(ss, numberseq, threeletter, uppercase, highlight); if(!numberseq) embShowAddTicknum(ss); embShowAddTicks(ss); if(reverse) { embShowAddComp(ss, numberseq); embShowAddRE(ss, -1, restrictlist, plasmid, flat); } if(translation) { if(reverse) embShowAddBlank(ss); if(frames[0]) embShowAddTran(ss, trnTable, 1, threeletter, numberseq, NULL, orfminsize, AJFALSE, AJFALSE, AJFALSE, AJFALSE); if(frames[1]) embShowAddTran(ss, trnTable, 2, threeletter, numberseq, NULL, orfminsize, AJFALSE, AJFALSE, AJFALSE, AJFALSE); if(frames[2]) embShowAddTran(ss, trnTable, 3, threeletter, numberseq, NULL, orfminsize, AJFALSE, AJFALSE, AJFALSE, AJFALSE); if(reverse) { embShowAddTicks(ss); if(frames[5]) embShowAddTran(ss, trnTable, -3, threeletter, numberseq, NULL, orfminsize, AJFALSE, AJFALSE, AJFALSE, AJFALSE); if(frames[4]) embShowAddTran(ss, trnTable, -2, threeletter, numberseq, NULL, orfminsize, AJFALSE, AJFALSE, AJFALSE, AJFALSE); if(frames[3]) embShowAddTran(ss, trnTable, -1, threeletter, numberseq, NULL, orfminsize, AJFALSE, AJFALSE, AJFALSE, AJFALSE); } } embShowPrint(outfile, ss); /* display a list of the Enzymes that cut and don't cut */ if(cutlist) { remap_CutList(outfile, hittable, limit, html, mincuts, maxcuts); remap_NoCutList(outfile, hittable, html, enzymes, blunt, sticky, sitelen, commercial, ambiguity, limit, retable); } /* add a gratuitous newline at the end of the sequence */ ajFmtPrintF(outfile, "\n"); /* tidy up */ embShowDel(&ss); while(ajListPop(restrictlist,(void **)&mm)) embMatMatchDel(&mm); ajListFree(&restrictlist); remap_DelTable(&hittable); ajTablestrFree(&retable); } ajTrnDel(&trnTable); ajSeqallDel(&seqall); ajSeqDel(&seq); ajFileClose(&outfile); ajStrDel(&tablename); ajStrDel(&enzymes); ajStrDelarray(&framelist); ajRangeDel(&uppercase); ajRangeDel(&highlight); embExit(); return 0; }
int main(int argc, char **argv) { /* Variable Declarations */ AjPStr code = NULL; AjPFile mfptr = NULL; AjPFile wfptr = NULL; AjPFile outf = NULL; EmbPPropMolwt *mwdata; EmbPPropAmino *aadata; float *dhstat = NULL; char code1; AjPStr code3 = NULL; ajint idx = 0; ajuint i; ajuint iend; AjPStr propstr = NULL; float charge; char csign; /* ACD File Processing */ embInit("inforesidue", argc, argv); code = ajAcdGetString("code"); mfptr = ajAcdGetDatafile("aadata"); wfptr = ajAcdGetDatafile("mwdata"); outf = ajAcdGetOutfile("outfile"); aadata = embPropEaminoRead(mfptr); mwdata = embPropEmolwtRead(wfptr); if(!embReadAminoDataFloatC(DAYHOFF_FILE,&dhstat,(float)0.001)) ajFatal("Set the EMBOSS_DATA environment variable"); /* Application logic */ ajStrFmtUpper(&code); iend = ajStrGetLen(code); ajFmtPrintF(outf, "%-4s %-5s %-20s %6s %9s %-30s %s\n", "Code", "Short", "Mnemonic", "Charge", "MolWt", "Properties", "Ambiguity"); for(i=0; i<iend; i++) { code1=ajStrGetCharPos(code,i); if(ajResidueExistsChar(code1)) { idx = ajBasecodeToInt(code1); ajResidueToTriplet(code1, &code3); ajStrFmtTitle(&code3); if(!embPropGetProperties(aadata[idx], &propstr)) ajStrAssignC(&propstr, "(none)"); charge = embPropGetCharge(aadata[idx]); if(charge > 0.0) csign = '+'; else if(charge < 0.0) csign = '-'; else csign = ' '; ajFmtPrintF(outf, "%-4c %-5S %-20S %3c%3.1f %9.4f %-30S %S\n", code1, code3, ajResidueGetMnemonic(code1), csign, fabs(charge), embPropMolwtGetMolwt(mwdata[idx]), propstr, ajResidueGetCodes(code1)); } else { ajFmtPrintF(outf, "%-4c %-5s %-20s %6s %9s %-30s %s\n", code1, ".", "invalid", ".", ".", ".", "."); } } /* Memory management and exit */ ajStrDel(&code); ajStrDel(&code3); ajStrDel(&propstr); ajFileClose(&outf); ajFileClose(&mfptr); ajFileClose(&wfptr); ajFileClose(&outf); embPropAminoDel(&aadata); embPropMolwtDel(&mwdata); AJFREE(dhstat); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqall seqall; AjPSeqout seqout; AjPSeq seq; ajint size; ajint overlap; ajint len; ajint pos; AjBool addover; AjBool feature; AjPStr outseq_name = ajStrNew(); ajint start; ajint end; embInit("splitter", argc, argv); seqout = ajAcdGetSeqoutall("outseq"); seqall = ajAcdGetSeqall("sequence"); size = ajAcdGetInt("size"); overlap = ajAcdGetInt("overlap"); addover = ajAcdGetBoolean("addoverlap"); feature = ajAcdGetBoolean("feature"); while(ajSeqallNext(seqall, &seq)) { ajSeqTrim(seq); len = ajSeqGetLen(seq); pos = 0; ajStrAssignC(&outseq_name, ""); if (!addover) { while(pos+size <= len-1) { start = pos; end = pos+size-1; splitter_MakeSubSeqName (&outseq_name, seq, start, end); splitter_ProcessChunk (seqout, seq, start, end, outseq_name, feature); pos += size-overlap; } } else { while(pos+size+overlap < len-1) { start = pos; end = pos+size+overlap-1; splitter_MakeSubSeqName (&outseq_name, seq, start, end); splitter_ProcessChunk (seqout, seq, start, end, outseq_name, feature); pos += size; } } splitter_MakeSubSeqName(&outseq_name, seq, pos, len-1); splitter_ProcessChunk (seqout, seq, pos, len-1, outseq_name, feature); } ajSeqoutClose(seqout); ajSeqallDel(&seqall); ajSeqoutDel(&seqout); ajSeqDel(&seq); ajStrDel(&outseq_name); embExit(); return 0; }
int main(int argc, char **argv) { AjPFile infile = NULL; AjPFile outfile = NULL; AjPStr line; AjPGraph graphLB = NULL; AjPGraphdata xygraph = NULL; AjPGraphdata xygraph2 = NULL; AjBool doplot; ajint N=0; float *xdata = NULL; float *ydata = NULL; float *V = NULL; float *S = NULL; float a; float b; float upperXlimit; float upperYlimit; float A; float B; float C; float D; float xmin; float xmax; float ymin; float ymax; float xmin2; float xmax2; float ymin2; float ymax2; float Vmax; float Km; float cutx; float cuty; float amin = 0.; float amax = 0.; float bmin = 0.; float bmax = 0.; embInit("findkm", argc, argv); infile = ajAcdGetInfile("infile"); outfile = ajAcdGetOutfile ("outfile"); doplot = ajAcdGetBoolean("plot"); graphLB = ajAcdGetGraphxy("graphLB"); line = ajStrNew(); /* Determine N by reading infile */ while(ajReadlineTrim(infile, &line)) if(ajStrGetLen(line) >0) N++; /* only allocate memory to the arrays */ AJCNEW(xdata, N); AJCNEW(ydata, N); AJCNEW(S, N); AJCNEW(V, N); ajFileSeek(infile, 0L, 0); N=0; while(ajReadlineTrim(infile, &line)) { if(ajStrGetLen(line) > 0) { sscanf(ajStrGetPtr(line),"%f %f",&S[N],&V[N]); if(S[N] > 0.0 && V[N] > 0.0) { xdata[N] = S[N]; ydata[N] = S[N]/V[N]; N++; } } } /* find the max and min values for the graph parameters*/ xmin = (float)0.5*findkm_findmin(xdata, N); xmax = (float)1.5*findkm_findmax(xdata, N); ymin = (float)0.5*findkm_findmin(ydata, N); ymax = (float)1.5*findkm_findmax(ydata, N); xmin2 = (float)0.5*findkm_findmin(S, N); xmax2 = (float)1.5*findkm_findmax(S, N); ymin2 = (float)0.5*findkm_findmin(V, N); ymax2 = (float)1.5*findkm_findmax(V, N); /* ** In case the casted ints turn out to be same number on the axis, ** make the max number larger than the min so graph can be seen. */ if((ajint)xmax == (ajint)xmin) ++xmax; if((ajint)ymax == (ajint)ymin) ++ymax; if((ajint)xmax2 == (ajint)xmin2) ++xmax2; if((ajint)ymax2 == (ajint)ymin2) ++ymax2; /* ** Gaussian Elimination for Best-fit curve plotting and ** calculating Km and Vmax */ A = findkm_summation(xdata, N); B = findkm_summation(ydata, N); C = findkm_multisum(xdata, ydata, N); D = findkm_multisum(xdata, xdata, N); /* ** To find the best fit line, Least Squares Fit: y =ax +b; ** Two Simultaneous equations, REARRANGE FOR b ** ** findkm_summation(ydata, N) - findkm_summation(xdata,N)*a - N*b =0; ** b = (findkm_summation(ydata,N) - findkm_summation(xdata,N)*a) / N; ** b = (B - A*a)/ N; ** ** C - D*a - A*((B - A*a)/ N) =0; ** C - D*a - A*B/N + A*A*a/N =0; ** C - A*B/N = D*a - A*A*a/N; */ /* REARRANGE FOR a */ a = (N*C - A*B)/ (N*D - A*A); b = (B - A*a)/ N; /* ** Equation of Line - Lineweaver burk eqn ** 1/V = (Km/Vmax)*(1/S) + 1/Vmax; */ Vmax = 1/a; Km = b/a; cutx = -1/Km; cuty = Km/Vmax; /* set limits for last point on graph */ upperXlimit = findkm_findmax(xdata,N)+3; upperYlimit = (upperXlimit)*a + b; ajFmtPrintF(outfile, "---Hanes Woolf Plot Calculations---\n"); ajFmtPrintF(outfile, "Slope of best fit line is a = %.2f\n", a); ajFmtPrintF(outfile,"Coefficient in Eqn of line y = ma +b is b " "= %.2f\n", b); ajFmtPrintF(outfile, "Where line cuts x axis = (%.2f, 0)\n", cutx); ajFmtPrintF(outfile, "Where line cuts y axis = (0, %.2f)\n", cuty); ajFmtPrintF(outfile, "Limit-point of graph for plot = (%.2f, %.2f)\n\n", upperXlimit, upperYlimit); ajFmtPrintF(outfile, "Vmax = %.2f, Km = %f\n",Vmax, Km); /* draw graphs */ if(doplot) { xygraph = ajGraphdataNewI(N); ajGraphdataAddXY(xygraph, S, V); ajGraphDataAdd(graphLB, xygraph); ajGraphdataSetTitleC(xygraph, "Michaelis Menten Plot"); ajGraphdataSetXlabelC(xygraph, "[S]"); ajGraphdataSetYlabelC(xygraph, "V"); ajGraphxySetXstartF(graphLB, 0.0); ajGraphxySetXendF(graphLB, xmax2); ajGraphxySetYstartF(graphLB, 0.0); ajGraphxySetYendF(graphLB, ymax2); ajGraphxySetXrangeII(graphLB, (ajint)0.0, (ajint)xmax2); ajGraphxySetYrangeII(graphLB, (ajint)0.0, (ajint)ymax2); ajGraphdataAddposLine(xygraph, 0.0, 0.0, S[0], V[0], (ajint)BLACK); ajGraphxyShowPointsCircle(graphLB, ajTrue); ajGraphdataSetMinmax(xygraph,0.0,xmax2,0.0,ymax2); ajGraphicsCalcRange(S,N,&amin,&amax); ajGraphicsCalcRange(V,N,&bmin,&bmax); ajGraphdataSetTruescale(xygraph,amin,amax,bmin,bmax); ajGraphdataSetTypeC(xygraph,"2D Plot Float"); xygraph2 = ajGraphdataNewI(N); ajGraphdataAddXY(xygraph2, xdata, ydata); ajGraphDataAdd(graphLB, xygraph2); ajGraphdataSetTitleC(xygraph2, "Hanes Woolf Plot"); ajGraphdataSetXlabelC(xygraph2, "[S]"); ajGraphdataSetYlabelC(xygraph2, "[S]/V"); ajGraphxySetXstartF(graphLB, cutx); ajGraphxySetXendF(graphLB, upperXlimit); ajGraphxySetYstartF(graphLB, 0.0); ajGraphxySetYendF(graphLB, upperYlimit); ajGraphxySetXrangeII(graphLB, (ajint)cutx, (ajint)upperXlimit); ajGraphxySetYrangeII(graphLB, (ajint)0.0, (ajint)upperYlimit); ajGraphxyShowPointsCircle(graphLB, ajTrue); ajGraphdataSetMinmax(xygraph2, cutx,upperXlimit,0.0,upperYlimit); ajGraphicsCalcRange(xdata,N,&amin,&amax); ajGraphicsCalcRange(ydata,N,&bmin,&bmax); ajGraphdataSetTruescale(xygraph2,amin,amax,bmin,bmax); ajGraphdataSetTypeC(xygraph2,"2D Plot"); ajGraphSetTitleC(graphLB,"FindKm"); ajGraphxySetflagOverlay(graphLB,ajFalse); ajGraphxyDisplay(graphLB, ajTrue); } AJFREE(xdata); AJFREE(ydata); AJFREE(S); AJFREE(V); ajFileClose(&infile); ajFileClose(&outfile); ajGraphxyDel(&graphLB); ajStrDel(&line); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqset seq1; AjPSeqset seq2; AjPFile list; ajint n1; ajint n2; ajint *lengths1; ajint *lengths2; ajuint *order1; ajuint *order2; ajint *hits1; ajint *hits2; ajint curr1; ajint curr2; ajint tmp1; ajint tmp2 = 0; ajint i; AjPStr operator; ajint OperatorCode=0; embInit("listor", argc, argv); seq1 = ajAcdGetSeqset("firstsequences"); seq2 = ajAcdGetSeqset("secondsequences"); list = ajAcdGetOutfile("outfile"); operator = ajAcdGetListSingle("operator"); /* get the operator value */ switch(ajStrGetCharFirst(operator)) { case 'O': OperatorCode = L_OR; break; case 'A': OperatorCode = L_AND; break; case 'X': OperatorCode = L_XOR; break; case 'N': OperatorCode = L_NOT; break; default: ajFatal("Invalid operator type: %S", operator); embExitBad(); } /* get the order of seqset 1 by length */ n1 = ajSeqsetGetSize(seq1); /* lengths of seq1 entries */ lengths1 = AJCALLOC0(n1, sizeof(ajint)); /* seq1 entries which match seq2 */ hits1 = AJCALLOC0(n1, sizeof(ajint)); /* seq1 entries in length order */ order1 = AJCALLOC0(n1, sizeof(ajint)); for(i=0; i<n1; i++) { lengths1[i] = ajSeqGetLen(ajSeqsetGetseqSeq(seq1, i)); order1[i] = i; hits1[i] = -1; } ajSortIntIncI(lengths1, order1, n1); /* get the order of seqset 2 by length */ n2 = ajSeqsetGetSize(seq2); lengths2 = AJCALLOC0(n2, sizeof(ajint)); hits2 = AJCALLOC0(n2, sizeof(ajint)); order2 = AJCALLOC0(n2, sizeof(ajint)); for(i=0; i<n2; i++) { lengths2[i] = ajSeqGetLen(ajSeqsetGetseqSeq(seq2, i)); order2[i] = i; hits2[i] = -1; } ajSortIntIncI(lengths2, order2, n2); /* ** go down the two sequence sets, by size order, looking for identical **lengths */ curr1 = 0; curr2 = 0; while(curr1 < n1 && curr2 < n2) { if(lengths1[order1[curr1]] < lengths2[order2[curr2]]) /* seq1 is shorter - increment curr1 index */ curr1++; else if(lengths1[order1[curr1]] > lengths2[order2[curr2]]) /* seq2 is shorter - increment curr2 index */ curr2++; else { /* identical lengths - check all seq1/seq2 entries of this len */ for(tmp1=curr1; tmp1<n1 && lengths1[order1[tmp1]] == lengths2[order2[curr2]]; tmp1++) for(tmp2=curr2; tmp2<n2 && lengths2[order2[tmp2]] == lengths2[order2[curr2]]; tmp2++) /* check to see if the sequences are identical */ if(!ajStrCmpCaseS(ajSeqGetSeqS(ajSeqsetGetseqSeq(seq1, order1[tmp1])), ajSeqGetSeqS(ajSeqsetGetseqSeq(seq2, order2[tmp2])))) { hits1[order1[tmp1]] = order2[tmp2]; hits2[order2[tmp2]] = order1[tmp1]; } curr1 = tmp1; curr2 = tmp2; } } /* output the required entries to the list file */ listor_Output(list, OperatorCode, seq1, seq2, hits1, hits2, n1, n2); AJFREE(lengths1); AJFREE(lengths2); AJFREE(order1); AJFREE(order2); AJFREE(hits1); AJFREE(hits2); ajFileClose(&list); ajStrDel(&operator); ajSeqsetDel(&seq1); ajSeqsetDel(&seq2); embExit(); return 0; }
int main(int argc, char **argv) { AjPSeqall seqall; AjPSeq seq = NULL; AjPFile outf = NULL; AjPStr strand = NULL; AjPStr substr = NULL; AjPStr bases = NULL; ajint begin; ajint end; ajint len; ajint minlen; float minobsexp; float minpc; ajint window; ajint shift; ajint plotstart; ajint plotend; float *xypc = NULL; float *obsexp = NULL; AjBool *thresh = NULL; float obsexpmax; ajint i; ajint maxarr; embInit("newcpgreport",argc,argv); seqall = ajAcdGetSeqall("sequence"); window = ajAcdGetInt("window"); shift = ajAcdGetInt("shift"); outf = ajAcdGetOutfile("outfile"); minobsexp = ajAcdGetFloat("minoe"); minlen = ajAcdGetInt("minlen"); minpc = ajAcdGetFloat("minpc"); substr = ajStrNew(); bases = ajStrNewC("CG"); maxarr = 0; while(ajSeqallNext(seqall, &seq)) { begin = ajSeqallGetseqBegin(seqall); end = ajSeqallGetseqEnd(seqall); strand = ajSeqGetSeqCopyS(seq); ajStrFmtUpper(&strand); ajStrAssignSubC(&substr,ajStrGetPtr(strand),--begin,--end); len=ajStrGetLen(substr); if(len > maxarr) { AJCRESIZE(obsexp, len); AJCRESIZE(thresh, len); AJCRESIZE(xypc, len); maxarr = len; } for(i=0;i<len;++i) obsexp[i]=xypc[i]=0.0; newcpgreport_findbases(substr, len, window, shift, obsexp, xypc, bases, &obsexpmax, &plotstart, &plotend); newcpgreport_identify(outf, obsexp, xypc, thresh, 0, len, shift, ajStrGetPtr(bases), ajSeqGetNameC(seq), minlen, minobsexp, minpc, ajStrGetPtr(strand)); ajStrDel(&strand); } ajStrDel(&bases); ajSeqDel(&seq); ajStrDel(&substr); ajFileClose(&outf); AJFREE(obsexp); AJFREE(thresh); AJFREE(xypc); ajSeqallDel(&seqall); embExit(); return 0; }