#gawk script that adds a first line to the mtx file, with # the residue name and number for each field # This version gets the info from a pdb file. It # is intended for use with discom output that compared # different proteins #M. Nelson (with advice from B. Sheehan) 4/23/96 BEGIN { filenum = ENVIRON["FILENUM"] namebase = ENVIRON["NAMEBASE"] pdb_file = ENVIRON["PDBFILE"] if (filenum) { filename = sprintf("%s%02d",namebase,filenum) filler = "------------" printf("%12s ",filler) > filename x = 0 } old_resnum = 0 } { #gets info on length and number of fields of original (mtx) file. num_lines = ENVIRON["NUM_LINES"] data_fields = (NF - 3) while (getline < pdb_file > 0) { if ($5 > old_resnum) break } endpt = data_fields + ((filenum-1)*15) startpt = endpt - data_fields if ( x >= startpt && x < endpt ) { printf("%3s_%3s",$5,$4) >> filename } x++ } old_resnum = $5 END { printf("\n") >> filename printf("\n") >> filename close (filename) while (getline < ARGV[1]) { print $0 >> filename } }