program difri(data, difrip, xyin, output); (* difri: difference in Ri values in a scan data file Tom Schneider NCI/FCRDC Bldg 469. Room 144 P.O. Box B Frederick, MD 21702-1201 (301) 846-5581 (-5532 for messages) network address: toms@ncifcrf.gov National Cancer Institute Laboratory of Mathematical Biology *) label 1; (* end of program *) const (* begin module version *) version = 1.08; (* of difri.p 1995 April 17 origin 1995 April 17 *) (* end module version *) (* begin module describe.difri *) (* name difri: difference in Ri values in a scan data file synopsis difri(data: in, difrip: in, xyin: in, output: out) files data: output data file from the scan program. difrip: parameter file to control the program. first line: one integer, the distance between Ri values. second line: If the first character is: r: Ri values are used p: probability values are used z: Z values are used xyin: input data file to the xyplop program. output: messages to the user description examples documentation This program the data file, extracts sites "distance" bases apart and puts their Ri values into a xyin file for plotting with xyplo. see also scan.p, xyplo.p author Thomas Dana Schneider bugs technical notes *) (* end module describe.difri *) (* begin module Ri.const *) defnegativeinfinity = -1000; (* default for negative infinity for the Ri(b,l) table *) maxribl = 2000; (* maximum size of Ri(b,l) table *) infofield = 12; (* size of field for printing information in bits *) infodecim = 6; (* number of decimal places for printing information *) (* these are used for conlist only *) nfield = 6; (* size of field for printing n, the number of sites *) (* end module Ri.const from ri.p 2.02 *) var data, difrip, (* file used by this program *) xyin: text; (* file used by this program *) (* begin module halt *) procedure 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. *) begin writeln(output,' program halt.'); goto 1 end; (* end module halt version = 4.15; (@ of prgmod.p 1994 November 12 *) (* begin module copyaline *) procedure copyaline(var fin, fout: text); (* copy a line from file fin to file fout *) begin (* copyaline *) while not eoln(fin) do begin fout^ := fin^; put(fout); get(fin) end; readln(fin); writeln(fout); end; (* copyaline *) (* end module copyaline version = 4.15; (@ of prgmod.p 1994 November 12 *) (* begin module skipblanks *) procedure skipblanks(var thefile: text); (* skip over blanks until a non-blank, or end of line, is found *) begin while (thefile^ = ' ') and not eoln(thefile) do get(thefile); end; procedure skipnonblanks(var thefile: text); (* skip over nonblanks until a blank, or end of line, is found *) begin while (thefile^ <> ' ') and not eoln(thefile) do get(thefile); end; procedure skipcolumn(var thefile: text); (* skip over a data column *) begin skipblanks(thefile); skipnonblanks(thefile) end; (* end module skipblanks version = 4.15; (@ of prgmod.p 1994 November 12 *) (* begin module difri.themain *) procedure themain(var data, difrip, xyin: text); (* the main procedure of the program *) var distance: integer; (* distance between sites to use *) selector: char; (* select Ri (r), probability (p) or Z value (z) to report *) coordinate: integer; (* coordinate of a site *) orientation: integer; (* orientation of a site *) p: real; (* probability of a site *) Ri: real; (* Ri of a site *) Z: real; (* Z of a site *) oldcoordinate: integer; (* coordinate of the previous site *) oldorientation: integer; (* orientation of the previous site *) oldp: real; (* probability of the previous site *) oldRi: real; (* Ri of the previous site *) oldZ: real; (* Z of the previous site *) begin writeln(output,'difri ',version:4:2); (* get parameters *) reset(difrip); readln(difrip, distance); if distance < 1 then begin writeln(output,'distance between sites must be positive'); halt end; readln(difrip, selector); if not (selector in ['r','p','z']) then begin writeln(output,'selector must be one of: rpz'); halt end; reset(data); oldcoordinate := 0; oldorientation := 0; oldp := 0; oldRi := 0; oldZ := 0; rewrite(xyin); writeln(xyin,'* difri ',version:4:2); writeln(xyin,'************************************'); writeln(xyin,'* DEFINITION OF THE DATA COLUMNS: *'); write(xyin,'* 1: '); case selector of 'r': write(xyin,'Ri(n) '); 'p': write(xyin,'probability(n)'); 'z': write(xyin,'Z(n) '); end; writeln(xyin,' *'); write(xyin,'* 2: '); case selector of 'r': write(xyin,'Ri(n+',distance:2,') '); 'p': write(xyin,'probability(n+',distance:2,')'); 'z': write(xyin,'Z(n+',distance:1,') '); end; writeln(xyin,' *'); writeln(xyin,'* 3: n *'); writeln(xyin,'* 4: n+',distance:1, ' *'); writeln(xyin,'************************************'); while not eof(data) do begin if data^ = '*' then begin copyaline(data, xyin) end else begin skipcolumn(data); (* piece number *) skipcolumn(data); (* piece length *) skipcolumn(data); (* piece name *) read(data, coordinate); read(data, orientation); read(data, Ri); read(data, Z); read(data, p); readln(data); if coordinate - oldcoordinate = distance then begin case selector of 'r': begin write(xyin, oldRi:infofield:infodecim); write(xyin, ' ',Ri:infofield:infodecim); end; 'p': begin write(xyin, oldp:infofield:infodecim); write(xyin, ' ',p:infofield:infodecim); end; 'z': begin write(xyin, oldZ:infofield:infodecim); write(xyin, ' ',Z:infofield:infodecim); end; end; write(xyin, ' ',oldcoordinate:nfield); write(xyin, ' ',coordinate:nfield); writeln(xyin); end; oldcoordinate := coordinate; oldorientation := orientation; oldp := p; oldRi := Ri; oldZ := Z; {zzz} end end; end; (* end module difri.themain *) begin themain(data, difrip, xyin); 1: end.