program chaos(data, xyin, output); (* chaos: chaotic analysis of scan data Tom Schneider NCI/FCRDC Bldg 469. Room 144 P.O. Box B Frederick, MD 21702-1201 (301) 846-5581 (-5532 for messages) toms@ncifcrf.gov http://www-lmmb.ncifcrf.gov/~toms/ National Cancer Institute Laboratory of Mathematical Biology *) label 1; (* end of program *) const (* begin module version *) version = 1.05; (* of chaos.p 1996 October 21 origin 1996 January 25 *) (* end module version *) (* begin module describe.chaos *) (* name chaos: chaotic analysis of scan data synopsis chaos(data: in, xyin: out, output: out) files data: data from the scan program xyin: data rearranged for chaotic analysis plot. The file format is ready for input to xyplo. output: messages to the user description A "classical" test for chaos in a system is to transform the series: x1, x2, x3, x4, x5, ... Into a set of pairs of coordinates: (x1,x2) (x2,x3) (x3,x4) (x4,x5) ... If there is no relationship, then one gets a random-looking scatter diagram. If there is a chaotic relationship, one gets curves. This program uses the potential locations of binding sites found by the scan program (and output in file 'data') as the input series. These values are then weighted by their probability. examples data: * DEFINITION OF THE DATA COLUMNS: * 1 piece number * 2 piece length * 3 piece name * 4 piece coordinate * 5 matrix orientation (+1 = as in book, -1 = complement) * 6 Ri evaluation (bits per site) * 7 Z * 8 probability * 1 87192 p1 15 1 2.184500 -2.223394 0.013095 1 87192 p1 81 1 1.000218 -2.648260 0.004045 1 87192 p1 88 1 2.780186 -2.009690 0.022232 1 87192 p1 109 1 5.395104 -1.071578 0.141955 1 87192 p1 113 1 1.761704 -2.375074 0.008773 1 87192 p1 165 1 1.217743 -2.570222 0.005082 1 87192 p1 387 1 3.648239 -1.698272 0.044728 1 87192 p1 447 1 1.022737 -2.640181 0.004143 1 87192 p1 480 1 2.553458 -2.091029 0.018263 1 87192 p1 528 1 6.956904 -0.511276 0.304579 1 87192 p1 540 1 2.927385 -1.956881 0.025181 1 87192 p1 587 1 1.316462 -2.534806 0.005625 1 87192 p1 609 1 6.937751 -0.518147 0.302178 1 87192 p1 621 1 1.241720 -2.561620 0.005209 1 87192 p1 625 1 2.097234 -2.254701 0.012076 1 87192 p1 705 1 1.965286 -2.302038 0.010667 1 87192 p1 992 1 3.166391 -1.871137 0.030663 1 87192 p1 1108 1 1.757896 -2.376440 0.008740 documentation see also scan.p, xyplo.p author Thomas Dana Schneider bugs The program uses the coordinates reported in the data file. Since these are piece coordinates they are not necessarily linear (ie, 1 to n). If fragments have been extracted from a circular sequence, the results will have some incorrect data. (This is a minor bug.) technical notes *) (* end module describe.chaos *) (* begin module chaos.const *) infofield = 12; (* size of field for printing information in bits *) infodecim = 6; (* number of decimal places for printing information *) (* end module chaos.const *) var data, (* 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 chaos.themain *) procedure themain(var data, xyin: text); (* the main procedure of the program *) var piecenumber: integer; (* standard column in data *) piecelength: integer; (* standard column in data *) (* piecename skip this, standard column in data *) piececoordinate: integer; (* standard column in data *) matrixorientation: integer; (* standard column in data *) Ri: real; (* standard column in data *) Z: real; (* standard column in data *) probability: real; (* standard column in data *) oldpiecenumber: integer; (* standard column in data *) oldpiecelength: integer; (* standard column in data *) (* oldpiecename skip this, standard column in data *) oldpiececoordinate: integer; (* standard column in data *) oldmatrixorientation: integer; (* standard column in data *) oldRi: real; (* standard column in data *) oldZ: real; (* standard column in data *) oldprobability: real; (* standard column in data *) oldoldpiecenumber: integer; (* standard column in data *) hue: real; (* the hue of a color *) saturation: real; (* the saturation of a color *) brightness: real; (* the brightness of a color *) deltapiececoordinate: integer; (* change in piececoordinate *) olddeltapiececoordinate: integer; (* previous deltapiececoordinate *) begin writeln(output,'chaos ',version:4:2); rewrite(xyin); writeln(xyin,'* chaos ',version:4:2); writeln(xyin,'*'); writeln(xyin,'* DEFINITION OF THE DATA COLUMNS:'); writeln(xyin,'* 1 delta old piece coordinate'); writeln(xyin,'* 2 delta piece coordinate'); writeln(xyin,'* 3 hue'); writeln(xyin,'* 4 saturation'); writeln(xyin,'* 5 brightness'); writeln(xyin,'*'); reset(data); oldpiecenumber := maxint; oldpiecelength := maxint; oldpiececoordinate := maxint; oldmatrixorientation := maxint; oldRi := maxint; oldZ := maxint; oldprobability := maxint; oldoldpiecenumber := 0; olddeltapiececoordinate := maxint; saturation := 1.00; brightness := 1.00; while not eof(data) do begin { write (output,'piecenumber:',piecenumber:10); write (output,'oldpiecenumber:',oldpiecenumber:10); writeln(output,'oldoldpiecenumber:',oldoldpiecenumber:10); } while data^ = '*' do copyaline(data, xyin); if not eof(data) then begin read(data, piecenumber); read(data, piecelength); skipcolumn(data); (* skip the piecename *) read(data, piececoordinate); read(data, matrixorientation); read(data, Ri); read(data, Z); read(data, probability); readln(data); deltapiececoordinate := piececoordinate - oldpiececoordinate; (* we display only when there are two delta intervals available: *) if oldoldpiecenumber = piecenumber then begin hue := probability; write(xyin,' ',oldRi:infofield:infodecim); write(xyin,' ',Ri:infofield:infodecim); write(xyin,' ',hue:infofield:infodecim); write(xyin,' ',saturation:infofield:infodecim); write(xyin,' ',brightness:infofield:infodecim); writeln(xyin); end; oldoldpiecenumber := oldpiecenumber; oldpiecenumber := piecenumber; oldpiecelength := piecelength; oldpiececoordinate := piececoordinate; oldmatrixorientation := matrixorientation; oldRi := Ri; oldZ := Z; oldprobability := probability; olddeltapiececoordinate := deltapiececoordinate; end; end; writeln(output,'done'); end; (* end module chaos.themain *) begin themain(data, xyin); 1: end. (* * DEFINITION OF THE DATA COLUMNS: * 1 piece number * 2 piece length * 3 piece name * 4 piece coordinate * 5 matrix orientation (+1 = as in book, -1 = complement) * 6 Ri evaluation (bits per site) * 7 Z * 8 probability * 1 87192 p1 15 1 2.184500 -2.223394 0.013095 1 87192 p1 81 1 1.000218 -2.648260 0.004045 1 87192 p1 88 1 2.780186 -2.009690 0.022232 1 87192 p1 109 1 5.395104 -1.071578 0.141955 1 87192 p1 113 1 1.761704 -2.375074 0.008773 1 87192 p1 165 1 1.217743 -2.570222 0.005082 1 87192 p1 387 1 3.648239 -1.698272 0.044728 1 87192 p1 447 1 1.022737 -2.640181 0.004143 1 87192 p1 480 1 2.553458 -2.091029 0.018263 1 87192 p1 528 1 6.956904 -0.511276 0.304579 1 87192 p1 540 1 2.927385 -1.956881 0.025181 1 87192 p1 587 1 1.316462 -2.534806 0.005625 1 87192 p1 609 1 6.937751 -0.518147 0.302178 1 87192 p1 621 1 1.241720 -2.561620 0.005209 1 87192 p1 625 1 2.097234 -2.254701 0.012076 1 87192 p1 705 1 1.965286 -2.302038 0.010667 1 87192 p1 992 1 3.166391 -1.871137 0.030663 1 87192 p1 1108 1 1.757896 -2.376440 0.008740 *)