program dotsba(dots, database, output); (* dotsba: dots to database 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 1990 *) label 1; (* end of program *) const (* begin module version *) version = 1.07; (* of dotsba.p 1990 December 9 origin 1987 sep 21 *) (* end module version *) (* begin module describe.dotsba *) (* name dotsba: dots to database synopsis dotsba(dots: in, database: out, output: out) files dots: dot input format of sequences. First line is the header line for the database. Second line is the standard, not to be copied to the database. Following lines have a period (dot, '.') replacing bases that are the same as the standard or a different base. There may be any number of spaces. Following this is a bar (|). Following the bar are other data to be copied to the database: clone number, primer for sequencing, and the date. database: reformatted data ready for sites program output: messages to the user description To convert from dots format to one the sites program can use. It should not have been necesary to do this, but Peter Papp didn't type the original sequences in unfortunately. examples documentation see also sites.p author Thomas Dana Schneider bugs This is a stupid program. technical notes *) (* end module describe.dotsba *) (* begin module interact.const *) maxstring = 150; (* the maximum string *) (* end module interact.const version = 4.09; (@ of prgmod.p 1990 May 18 *) type (* begin module interact.type *) string = record (* a string of characters *) letters: array[1..maxstring] of char; (* the letters in the string *) length: integer; (* the number of characters in the string *) current: integer; (* the letter we are working on *) end; (* end module interact.type version = 4.09; (@ of prgmod.p 1990 May 18 *) var dots, database: text; (* files 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 = 'delmod 6.16 84 mar 12 tds/gds'; *) (* 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.75; (@ of rsgra.p 1990 Oct 2 *) (* begin module interact.clearstring *) procedure clearstring(var ribbon: string); (* empty the string *) var index: integer; (* to the ribbon *) begin (* clearstring *) with ribbon do begin for index := 1 to maxstring do letters[index] := ' '; length := 0; current := 0; end end; (* clearstring *) (* end module interact.clearstring version = 4.09; (@ of prgmod.p 1990 May 18 *) (* begin module interact.getstring *) procedure getstring(var afile: text; var buffer: string; var gotten: boolean); (* get a string from a file not using string calls. this lets one obtain lines from a file without interactive prompts *) var index: integer; (* of buffer *) begin (* getstring *) clearstring(buffer); if eof(afile) then gotten := false else begin index := 0; while (not eoln(afile)) and (index < maxstring) do begin index := succ(index); read(afile, buffer.letters[index]) end; if not eoln(afile) then begin writeln(output, ' getstring: a line exceeds maximum string size (', maxstring:1,')'); halt end; buffer.length := index; buffer.current := 1; readln(afile); gotten := true end end; (* getstring *) (* end module interact.getstring version = 4.09; (@ of prgmod.p 1990 May 18 *) (* begin module dotsba.themain *) procedure themain(var dots, database: text); (* the main procedure of the program *) const mark = '|'; (* character indicating end of sequence data on a line *) var gotten: boolean; (* a line of data was obtained *) wildtype: string; (* first line of the dots file; sample *) begin writeln(output,'dotsba ',version:4:2); (* put the database title out *) reset(dots); rewrite(database); copyaline(dots,database); reset(dots); readln(dots); (* skip the database title *) getstring(dots,wildtype,gotten); (* the standard *) if not gotten then begin writeln(output,'could not find the sequence standard!'); halt end; while not eof(dots) do with wildtype do begin current := 1; while (not eoln(dots)) and (dots^<>mark) do begin if dots^ = '.' then database^ := letters[current] else database^ := dots^; if dots^ <> ' ' then put(database); get(dots); current := succ(current) end; if dots^ <> mark then begin writeln(output,'missing mark (',mark,'): it was','"', dots^,'"'); (* should have been a | *) halt end; get(dots); copyaline(dots,database); end; end; (* end module dotsba.themain *) begin themain(dots, database); 1: end.