/* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */ /* From input file "makeinst.p" */ #include /* makeinst: generate delila instructions for set A and B from dcout. Ryan Shultzaberger National Institutes of Health National Cancer Institute Center for Cancer Research Nanobiology Program Molecular Information Theory Group Frederick, Maryland 21702-1201 in the lab of: Dr. Thomas D. Schneider National Institutes of Health National Cancer Institute Center for Cancer Research Nanobiology Program Molecular Information Theory Group Frederick, Maryland 21702-1201 toms@ncifcrf.gov permanent email: toms@alum.mit.edu (use only if first address fails) http://www.ccrnp.ncifcrf.gov/~toms/ */ /* end of program */ /* begin module version */ #define version 1.01 /* of makeinst.p 2005 Oct 13 2005 Oct 13, 1.01: touch up documentation (TDS) 2005 Oct 07, 1.00: upgrade address */ #define updateversion 1.00 /* defines lowest acceptable current parameter file */ /* end module version */ /* begin module describe.makeinst */ /* name makeinst: generate delila instructions for set A and B from dcout. synopsis makeinst(instA: in, instB: in, makeinstp: in, dcout: out, output: out) files instA: Delila instructions for type A sites. instB: Delila instructions for type B sites. dcout: Output of the diri program that reports coordinates of A and B and information about their individual strengths and their combined strength. makeinstp: parameters to control the program. The file must contain the following parameters, one per line: parameterversion: The version number of the program. This allows the user to be warned if an old parameter file is used. From To Range (2 integers): This is the From To range to use in the inst. It should be given like "-10 +10". This will correspond to an inst that is "get from 100 -10 to same +10;". output: messages to the user description This program will generate two inst files "instA" and "instB" from the dcout file created by the diri program. The makeinst program assumes that A is the more upstream of the two binding components and assigns the orienation of the instruction on the relative positioning of B to A. That is if A > B then the instruction for that pair will have a positive orientation. If B > A then the instruction for that pair will have a negative orientation. Since the header information is not present in dcout it is not reported in the inst files. This must be added later. examples example makeinstp file: 1.00 version of makeinst that this parameter file is designed for. -100 +100 From/To range to use in inst. documentation see also diri.p delila.p {example parameter file: } makeinstp author Ryan Shultzaberger bugs technical notes */ /* end module describe.makeinst */ Static _TEXT instA; /* file used by this program */ Static _TEXT instB; /* file used by this program */ Static _TEXT makeinstp; /* file used by this program */ Static _TEXT dcout; /* file used by this program */ Static jmp_buf _JL1; /* begin module halt */ Static Void halt() { /* stop the program. the procedure performs a goto to the end of the program. you must have a label: label 1; declared, and also the end of the program must have this label: 1: end. examples are in the module libraries. this is the only goto in the delila system. */ printf(" program halt.\n"); longjmp(_JL1, 1); } /* end module halt version = 'delmod 6.16 84 mar 12 tds/gds'; */ /* begin module makeinst.themain */ Static Void themain(instA, instB, makeinstp, dcout) _TEXT *instA, *instB, *makeinstp, *dcout; { /* the main procedure of the program */ double parameterversion; /* parameter version number */ long fromrange; /* the from range for the inst files */ long torange; /* the two range from the inst files */ long coordA, coordB; /* the coordinates of sites A and B */ long diff; /* the difference between coordA and coordB */ Char c; /* first character on the line */ printf("makeinst %4.2f\n", version); if (*makeinstp->name != '\0') { if (makeinstp->f != NULL) makeinstp->f = freopen(makeinstp->name, "r", makeinstp->f); else makeinstp->f = fopen(makeinstp->name, "r"); } else rewind(makeinstp->f); if (makeinstp->f == NULL) _EscIO2(FileNotFound, makeinstp->name); RESETBUF(makeinstp->f, Char); fscanf(makeinstp->f, "%lg%*[^\n]", ¶meterversion); getc(makeinstp->f); if ((long)floor(100 * parameterversion + 0.5) < (long)floor(100.0 + 0.5)) { printf("You have an old parameter file!\n"); halt(); } fscanf(makeinstp->f, "%ld%ld%*[^\n]", &fromrange, &torange); getc(makeinstp->f); if (*dcout->name != '\0') { if (dcout->f != NULL) dcout->f = freopen(dcout->name, "r", dcout->f); else dcout->f = fopen(dcout->name, "r"); } else rewind(dcout->f); if (dcout->f == NULL) _EscIO2(FileNotFound, dcout->name); RESETBUF(dcout->f, Char); if (*instA->name != '\0') { if (instA->f != NULL) instA->f = freopen(instA->name, "w", instA->f); else instA->f = fopen(instA->name, "w"); } else { if (instA->f != NULL) rewind(instA->f); else instA->f = tmpfile(); } if (instA->f == NULL) _EscIO2(FileNotFound, instA->name); SETUPBUF(instA->f, Char); if (*instB->name != '\0') { if (instB->f != NULL) instB->f = freopen(instB->name, "w", instB->f); else instB->f = fopen(instB->name, "w"); } else { if (instB->f != NULL) rewind(instB->f); else instB->f = tmpfile(); } if (instB->f == NULL) _EscIO2(FileNotFound, instB->name); SETUPBUF(instB->f, Char); while (!BUFEOF(dcout->f)) { c = getc(dcout->f); if (c == '\n') c = ' '; if (c == '*') { fscanf(dcout->f, "%*[^\n]"); getc(dcout->f); continue; } fscanf(dcout->f, "%ld%ld%*[^\n]", &coordA, &coordB); getc(dcout->f); diff = coordA - coordB; if (diff >= 0) { fprintf(instA->f, "get from %ld %ld to same +%ld;\n", coordA, fromrange, torange); fprintf(instB->f, "get from %ld %ld to same +%ld;\n", coordB, fromrange, torange); } if (diff < 0) { fprintf(instA->f, "get from %ld +%ld to same -%ld;\n", coordA, -fromrange, torange); fprintf(instB->f, "get from %ld +%ld to same -%ld;\n", coordB, -fromrange, torange); } } } /* end module makeinst.themain */ main(argc, argv) int argc; Char *argv[]; { PASCAL_MAIN(argc, argv); if (setjmp(_JL1)) goto _L1; dcout.f = NULL; strcpy(dcout.name, "dcout"); makeinstp.f = NULL; strcpy(makeinstp.name, "makeinstp"); instB.f = NULL; strcpy(instB.name, "instB"); instA.f = NULL; strcpy(instA.name, "instA"); themain(&instA, &instB, &makeinstp, &dcout); _L1: if (instA.f != NULL) fclose(instA.f); if (instB.f != NULL) fclose(instB.f); if (makeinstp.f != NULL) fclose(makeinstp.f); if (dcout.f != NULL) fclose(dcout.f); exit(EXIT_SUCCESS); } /* End. */