/* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */ /* From input file "dnamwt.p" */ #include /* dnamwt: calculate the molecular weight of a DNA molecule Paul N. Hengen and Tom Schneider National Cancer Institute Laboratory of Mathematical Biology NCI/FCRDC Bldg 469. Room 144 P.O. Box B Frederick, MD 21702-1201 (301) 846-5581 (-5532 for messages) e-mail: pnh@ncifcrf.gov and toms@ncifcrf.gov */ /* end of program */ /* begin module version */ #define version 1.08 /* of dnamwt.p 1995 July 20 origin 1995 July 14 */ /* end module version */ /* begin module describe.dnamwt */ /* name dnamwt: calculate the molecular weight of a DNA molecule synopsis dnamwt(input: in, report: out, output: out) files input: user input report: output file with calculated weight output: output file with calculated weight description This program is used to calculate the molecular weight of DNA examples The molecular weights of the monophosporylated nucleotides are: A = 331.2 C = 307.2 G = 347.2 T = 322.2 When polymerized, each nucleotide will lose a water molecule of 18.0, and not considering methylation of any bases, the molecular weight of each will be; A = 313.2 C = 289.2 G = 329.2 T = 304.2 But, we'll have to add back two hydroxide ions, one for each strand polymerized, which is 17.0 x 2 = 34.0 PLUS 2.0 for the two extra hydrogen ions subtracted earlier. If you only know the sequence of one strand, and want to know the molecular weight of the entire double-stranded DNA: MW of strand1 = #A(313.2) + #C(289.2) + #G(329.2) + #T(304.2) + 18.0 PLUS MW of strand2 = #A(304.2) + #C(329.2) + #G(289.2) + #T(313.2) + 18.0 Therefore the overall MW is #A(313.2 + 304.2) + #C(289.2 + 329.2) + #G(329.2 + 289.2) + #T(304.2 + 313.2) + 36.0 --------------------------------------- OR #A(617.4) + #C(618.4) + #G(618.4) + #T(617.4) + 36.0 OR 617.4(#T + #A) + 618.4(#C + #G) + 36.0 OR If you know the %GC of the single stranded sequence, MW in daltons for the double stranded DNA would be = (%GC * total length) (100-%GC * total length) -------------------- (618.4) + ------------------------ (617.4) + 36.0 100 100 documentation Other sources of information or documents on the program. see also author Paul N. Hengen and Thomas Dana Schneider bugs technical notes */ /* end module describe.dnamwt */ /* begin module dnamwt.const */ /* molecular weights of all the deoxynucleotides with a single phosphate and H2O removed */ #define awt 313.2 #define cwt 289.2 #define gwt 329.2 #define twt 304.2 /* end module dnamwt.const */ Static _TEXT report; /* 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); } Local Void getbase(report, xchar, xno) _TEXT *report; Char xchar; long *xno; { /* get the number of base x and write it to the report file */ printf("number of %c's in strand 1 of the sequence: ", xchar); scanf("%ld%*[^\n]", xno); getchar(); fprintf(report->f, "the number of %c's in strand 1 of the sequence is: %ld\n", xchar, *xno); } /* end module halt version = 'delmod 6.16 84 mar 12 tds/gds'; */ /* begin module dnamwt.themain */ Static Void themain(report) _TEXT *report; { /* the main procedure of the program */ long ano; /* number of a's in the sequence */ long cno; /* number of c's in the sequence */ long gno; /* number of g's in the sequence */ long tno; /* number of t's in the sequence */ long total; /* total number of bases in the sequence */ Char c; /* a character */ double strand1; /* strand 1 molecular weight */ double strand2; /* strand 2 molecular weight */ printf("dnamwt %4.2f\n", version); if (*report->name != '\0') { if (report->f != NULL) report->f = freopen(report->name, "w", report->f); else report->f = fopen(report->name, "w"); } else { if (report->f != NULL) rewind(report->f); else report->f = tmpfile(); } if (report->f == NULL) _EscIO2(FileNotFound, report->name); SETUPBUF(report->f, Char); fprintf(report->f, "dnamwt %4.2f\n", version); getbase(report, 'A', &ano); getbase(report, 'C', &cno); getbase(report, 'G', &gno); getbase(report, 'T', &tno); strand1 = ano * awt + cno * cwt + gno * gwt + tno * twt + 18.0; strand2 = ano * twt + cno * gwt + gno * cwt + tno * awt + 18.0; total = ano + cno + gno + tno; fprintf(report->f, "total number of bases: %12ld\n", total); fprintf(report->f, "strand 1 molecular weight: %4.1f daltons\n", strand1); fprintf(report->f, "strand 2 molecular weight: %4.1f daltons\n", strand2); fprintf(report->f, "total molecular weight: %4.1f daltons\n", strand1 + strand2); fprintf(report->f, "%% GC: %4.1f\n", (gno + cno) * 100.0 / (ano + cno + gno + tno)); /* show the report */ putchar('\n'); if (*report->name != '\0') { if (report->f != NULL) report->f = freopen(report->name, "r", report->f); else report->f = fopen(report->name, "r"); } else rewind(report->f); if (report->f == NULL) _EscIO2(FileNotFound, report->name); RESETBUF(report->f, Char); while (!BUFEOF(report->f)) { while (!P_eoln(report->f)) { c = getc(report->f); if (c == '\n') c = ' '; putchar(c); } fscanf(report->f, "%*[^\n]"); getc(report->f); putchar('\n'); } } /* end module dnamwt.themain */ main(argc, argv) int argc; Char *argv[]; { PASCAL_MAIN(argc, argv); if (setjmp(_JL1)) goto _L1; report.f = NULL; strcpy(report.name, "report"); themain(&report); _L1: if (report.f != NULL) fclose(report.f); exit(EXIT_SUCCESS); } /* End. */