program dblo(cat, list, output); (* dblo: look at the catalogue of a genbank/embl database thomas schneider copyright module libraries required: delman, prgmods *) label 1; (* end of the program *) const (* begin module version *) version = 1.11; (* of dblo.p 1998 July 16 1998 July 16: upgrade origin 1985 may 28 *) (* end module version *) (* begin module describe.dblo *) (* name dblo: look at the catalogue of a genbank/embl database synopsis dblo(cat: in, list: out, output: out) files cat: a catalogue from program dbcat list: a listing in tabular form of the catalogue output: messages to the user description the program dbcat creates a machine readable catalogue of the locations of entries in a genbank /embl database. one cannot read this directly because it is a compressed internal format of the computer. (that is, it is a file of records.) to read the file, one must convert it into normal characters, which is what dblo does. author thomas schneider see also dbcat.p, dbpull.p, loocat.p, delila.p bugs none known *) (* end module describe.dblo *) (* begin module dblo.const *) linewidth = 10; (* number of characters for display of the line number of an entry in the catalogue *) libwidth = 10; (* number of characters for display of the number of the library in which an entry is found *) (* end module dblo.const *) (* begin module dbpull.constant *) (* more constants *) idlength = 20; (* length of identification code of a library entry *) namelength = idlength; (* length of computer system date *) lclength = 3; (* length of code at beginning of each library line *) libtotal = 8; (* number of libraries used in program *) lctotal = 20; (* maximum number of line code requests *) checknum = 1; (* controls the number of times certain procedures run *) (* the following constants are used for string comparisons by the functions lcequal and idequal. if your computer system does not do these packed array comparisons, the functions must be re- written and the constants replaced by a series of assignment statements to declared arrays. *) spraw = 'RAW'; (* special fin request that pulls only sequence *) spall = 'ALL'; (* special request that pulls whole entry *) lcloc = 'LOC'; (* short for locus, line code(lc) for genb entry beginning point. this line contains id of entry *) lcid = 'ID '; (* begining point of embl entry, also holds id *) lc3spc = ' '; (* three space line code always identifies sequence lines of an embl type entry *) lcxx = 'XX '; (* marks the end of a string of one or more embl lines having the same line code *) lct = ' T'; (* first letter of title, part of reference section of genb entry. if you pull 'ref', you pull ' t' *) lca = ' A'; (* first letter of author, part of reference section of a genb entry. if you pull 'ref', you pull ' a' *) lcj = ' J'; (* first letter of journal, part of ref also *) lcori = 'ORI'; (* short for origin, code for line just above sequence in genbank entries *) lcsit = 'SIT'; (* short for sites, line just below sequence in genb *) lcterm = '// '; (* terminus code at the end of every entry *) lcdat = 'DAT'; (* short for date, used for dateline of libraries *) idembl = 'EMBL '; (* fin line indicating that following lines contain embl requests *) idgenb = 'GENB '; (* following lines are for genb requests *) idgenbank = 'GENBANK '; (* ' ' *) iddate = 'DATE '; (* catalogs of undated libraries use this as the date *) idevery = 'EVERY '; (* special id that matches any id it is compared to *) (* end module dbpull.constant version = 2.32; (@ of dbpull 1985 apr 20 *) type (* begin module dbpull.type *) (* a 'u' after the 'lc' or 'id' in a type name indicates that the array is unpacked; a 'p' indicates that the array is packed; an 's' indicates that the array has more than one dimension *) idutype = array[1..idlength] of char; (* holds id for reading-writing before packing *) idptype = packed array[1..idlength] of char; (* holds id for string comparisons *) alpha = idptype; (* holds computer system date *) lnrange = 0..libtotal; (* subrange for handling number of libraries *) catrec = record (* structure of each catalog entry *) idp: idptype; (* holds id of entry *) libnum: lnrange; (* identifies in which of 8 libraries entry is found *) linenumber: integer; (* holds the line in a library where an entry begins *) end; dbcat = file of catrec; (* structure of whole catalog *) lcutype = array[1..lclength] of char; (* holds library line code for reading-writing before packing *) lcptype = packed array[1..lclength] of char; (* holds line code for string comparisons *) lcstype = array[1..lctotal,1..lclength] of char; (* holds fin line code requests *) countype = 0..lclength; (* subrange for handling line codes *) libsused = ( embl, genb ); (* used to indicate whether requested entry is of embl or genbank type *) wctype = ( notwc, xwc, wcx, xwcx ); (* used to indicate whether or not an id request is wildcard and if wc whether the set characters are in front, in back, or in the middle of the variable characters. the 'x' represents the variable part of the id *) (* end module dbpull.type version = 2.32; (@ of dbpull 1985 apr 20 *) var (* begin module dblo.var *) cat: dbcat; (* the catalogue to be analyzed *) list: text; (* the listing of the catalogue *) (* end module dblo.var *) (* 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 = 'prgmod 3.97 85 may 5 tds'; *) (* begin module dblo.themain *) procedure themain(var cat: dbcat; var list: text); (* the main procedure of dblo *) var anentry: catrec; (* the information about an entry in the catalogue *) entries: integer; (* number of entries in the database *) i: integer; (* index to the name of each entry in the catalogue *) begin writeln(output,' DBLO ', version:4:2); reset(cat); rewrite(list); writeln(list,' DBLO ',version:4:2,': LOOK AT A DATABASE CATALOGUE'); writeln(list,' ', 'ID',' ':(idlength - 2), ' ':(libwidth-6),'LIBRARY', ' ':(linewidth-3),'LINE'); entries := 0; while not eof(cat) do begin entries := entries + 1; anentry := cat^; with anentry do begin write(list,' '); for i := 1 to idlength do write(list,idp[i]); write(list,' ',libnum:libwidth); write(list,' ',linenumber:linewidth); writeln(list) end; get(cat) end; writeln(output,' ',entries:1,' ENTRIES IN THE CATALOGUE') end; (* end module dblo.themain *) begin (* dblo *) themain(cat, list); 1: end.