/* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */ /* From input file "ckhelix.p" */ #include /* ckhelix: check that the helix location is where one wants 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.03 /* of ckhelix.p 2004 Sep 12 2004 Sep 12, 1.03: upgrade for GPC 2004 Sep 9, 1.02: upgrade for GPC 1992 Apr 28, 1.01: functional origin 1987 sep 21 */ /* end module version */ /* begin module describe.ckhelix */ /* name ckhelix: check that the helix location is where one wants synopsis ckhelix(makelogop: in, ckhelixp: in, output: out); files makelogop: the parameter file of the makelogo program ckhelixp: wave location: the point in bases on THIS logo which is to align with the other logos. NOTE: this is NOT necessarily the high or low point of the wave as given by the wave parameter file of the makelogo program, hence it is not read from that file. zero: location of the desired center in cm on the page output: messages to the user description The program is used to determine the position to place a sequence logo so that a particular point of the cosine wave (in bases of the nucleic acid coordinate system) is exactly at a given point on the page in cm. This allows one to adjust the location of the logos so that they can overlap. examples documentation see also author Thomas Dana Schneider bugs technical notes */ /* end module describe.ckhelix */ Static _TEXT makelogop, wave, ckhelixp; 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 = 7.67; {of delmod.p 2004 Sep 8} */ /* begin module ckhelix.themain */ Static Void themain(makelogop, ckhelixp) _TEXT *makelogop, *ckhelixp; { /* the main procedure of the program */ /* variables from makelogop */ long fromrange, torange, barlocation; double xcorner, ycorner; long rotation; double charwidth; /* variables from ckhelixp */ double wavelocation, desiredcenter; double actualcenter; /* where the current makelogop parameters really will put the wave */ double correction; /* the amount to change the x or y corner */ Char thecorner; /* x or y - the corner from which the wave is propagated */ /*unused variable wavelength: real; (* bases per turn of the DNA helix *) */ printf("ckhelix %4.2f\n", version); if (*makelogop->name != '\0') { if (makelogop->f != NULL) makelogop->f = freopen(makelogop->name, "r", makelogop->f); else makelogop->f = fopen(makelogop->name, "r"); } else rewind(makelogop->f); if (makelogop->f == NULL) _EscIO2(FileNotFound, makelogop->name); RESETBUF(makelogop->f, Char); fscanf(makelogop->f, "%ld%ld%*[^\n]", &fromrange, &torange); getc(makelogop->f); fscanf(makelogop->f, "%ld%*[^\n]", &barlocation); getc(makelogop->f); fscanf(makelogop->f, "%lg%lg%*[^\n]", &xcorner, &ycorner); getc(makelogop->f); fscanf(makelogop->f, "%ld%*[^\n]", &rotation); getc(makelogop->f); fscanf(makelogop->f, "%lg%*[^\n]", &charwidth); getc(makelogop->f); if (*ckhelixp->name != '\0') { if (ckhelixp->f != NULL) ckhelixp->f = freopen(ckhelixp->name, "r", ckhelixp->f); else ckhelixp->f = fopen(ckhelixp->name, "r"); } else rewind(ckhelixp->f); if (ckhelixp->f == NULL) _EscIO2(FileNotFound, ckhelixp->name); RESETBUF(ckhelixp->f, Char); fscanf(ckhelixp->f, "%lg%*[^\n]", &wavelocation); getc(ckhelixp->f); fscanf(ckhelixp->f, "%lg%*[^\n]", &desiredcenter); getc(ckhelixp->f); if (rotation != 0 && rotation != -90) printf("WARNING: rotation must be 0 or -90 for sensible results!\n"); if (rotation == -90) thecorner = 'y'; else thecorner = 'x'; if (thecorner == 'x') actualcenter = xcorner - (wavelocation - fromrange) * charwidth; else actualcenter = ycorner - (wavelocation - fromrange) * charwidth; printf( " |wave | | | | | | NEW\n"); printf( " %ccorner |location|fromrange|charwidth| center | rotation| change | CORNER\n", thecorner); /*123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789*/ if (thecorner == 'x') printf(" %7.4f |", xcorner); else printf(" %7.4f |", ycorner); printf(" %7.4f |", wavelocation); printf(" %7ld |", fromrange); printf(" %7.4f |", charwidth); printf(" %7.4f |", actualcenter); printf(" %7ld |", rotation); correction = desiredcenter - actualcenter; if (correction != 0.0) { printf(" %7.4f |", correction); printf(" %7.4f |", ycorner + correction); } else printf(" (none)"); putchar('\n'); } /* end module ckhelix.themain */ main(argc, argv) int argc; Char *argv[]; { PASCAL_MAIN(argc, argv); if (setjmp(_JL1)) goto _L1; ckhelixp.f = NULL; strcpy(ckhelixp.name, "ckhelixp"); wave.f = NULL; *wave.name = '\0'; makelogop.f = NULL; strcpy(makelogop.name, "makelogop"); themain(&makelogop, &ckhelixp); _L1: if (makelogop.f != NULL) fclose(makelogop.f); if (wave.f != NULL) fclose(wave.f); if (ckhelixp.f != NULL) fclose(ckhelixp.f); exit(EXIT_SUCCESS); } /* End. */