#!/bin/csh # #Cartesian All Atom Comparison (coordcomp) # #Written by Pat Fleming, 1998 # #Plots the absolute distance between like atoms in two PDB files # #################################################################### # #The PDB files must have identical order of atoms # #Makes sense only for structures superpositioned by CA atoms # (Use "match" in MidasPlus or "lsqman" in Uppsala Software Factory) # #For site mutations edit the PDB files so that the mutated site # only has CB side chain (or none if GLY). # #################################################################### # #USAGE: coordcomp PDBfilename1 PDBfilename2 # #################################################################### # #OUTPUT: # dist.list - Distances between the same atom in each PDB file # dist.plt - A data file useful for plotting the data in XMGR # dist.param - Parameter file for displaying dist.plt in XMGR # #################################################################### # #Will display plot in xmgr if following variables are correct setenv GR_HOME /srv/local/xmgr-3.01pl8 alias xmgr '$GR_HOME/bin/xmgr' # #################################################################### #Get all ATOM records grep ^ATOM $1 > tmp0 #Find number of residues set numres = `grep 'CA' tmp0 | wc -l` @ numres++ #Remove hydrogens and/or deuteriums awk '((substr($0,14,1))!="H")&&((substr($0,13,1))!="H")&&((substr($0,14,1))!="D")' tmp0 > tmpb #Put atom info and coords for file1 in tmp1 #Remove chain label if present #cut -c5-21,23-55 tmpb > tmp1 cut -c 5-21,23-26 tmpb > tmpinfo cut -c 31-38 tmpb > tmpcol1 cut -c 39-46 tmpb > tmpcol2 cut -c 47-54 tmpb > tmpcol3 #Now do same for file2 grep ^ATOM $2 > tmp0 awk '((substr($0,14,1))!="H")&&((substr($0,13,1))!="H")&&((substr($0,14,1))!="D")' tmp0 > tmpb #cut -c30-55 tmpb > tmp2 cut -c 31-38 tmpb > tmpcol4 cut -c 39-46 tmpb > tmpcol5 cut -c 47-54 tmpb > tmpcol6 #Combine two sets of coords for distance calculation #paste -d' ' tmp1 tmp2 > tmp3 paste -d' ' tmpinfo tmpcol1 tmpcol2 tmpcol3 tmpcol4 tmpcol5 tmpcol6 > tmp3 #Distance calculation #The file "dist.list" has the basic distance information nawk '{printf("%s\t%s\t%d\t%f\n",$2,$3,$4, sqrt((($5-$8)^2+($6-$9)^2+($7-$10)^2)))}' tmp3 > dist.list #Find maximum distance for scaling # and round off to higher number set maxdist = `awk '{print $4}' dist.list | sort -n | tail -1` set maxdist = $maxdist:r @ maxdist++ #Prepare file with three data sets for xmgr plotting #First dataset contains all atoms for vertical bars #Second dataset contains all except CA for open circles #Third dataset contains only CA atoms for filled circles awk '{print $3, $4}' dist.list > dist.plt echo ' ' >> dist.plt grep -v 'CA\b' dist.list > tmp4 awk '{print $3, $4}' tmp4 >> dist.plt echo ' ' >> dist.plt grep CA dist.list > tmp4 awk '{print $3, $4}' tmp4 >> dist.plt #Call xmgr with the following parameters and using # the file "dist.plt" for the data cat < dist.param # ACE/gr parameter file # # page 5 page inout 5 link page off default linestyle 1 default linewidth 1 default color 1 default char size 1.000000 default font 4 default font source 0 default symbol size 1.000000 with g0 g0 on g0 label off g0 hidden false g0 type xy g0 autoscale type AUTO g0 fixedpoint off g0 fixedpoint type 0 g0 fixedpoint xy 0.000000, 0.000000 g0 fixedpoint format general general g0 fixedpoint prec 6, 6 world xmin 0 world xmax ${numres} world ymin 0 world ymax ${maxdist} view xmin 0.150000 view xmax 0.850000 view ymin 0.150000 view ymax 0.850000 title "Cartesion All Atom Comparison" title font 4 title size 1.500000 title color 1 title linewidth 2 subtitle "$1 vs $2" subtitle font 4 subtitle size 1.000000 subtitle color 1 subtitle linewidth 2 s0 type xy s0 symbol 12 s0 symbol size 1.000000 s0 symbol fill 0 s0 symbol color 1 s0 symbol linewidth 1 s0 symbol linestyle 1 s0 symbol center false s0 symbol char 0 s0 skip 0 s0 linestyle 0 s0 linewidth 1 s0 color 1 s0 fill 0 s0 fill with color s0 fill color 1 s0 fill pattern 0 s0 errorbar type BOTH s0 errorbar length 1.000000 s0 errorbar linewidth 1 s0 errorbar linestyle 1 s0 errorbar riser on s0 errorbar riser linewidth 1 s0 errorbar riser linestyle 1 s0 xyz 0.000000, 0.000000 s0 comment "dist.plt" s1 type xy s1 symbol 2 s1 symbol size 0.500000 s1 symbol fill 2 s1 symbol color 1 s1 symbol linewidth 1 s1 symbol linestyle 1 s1 symbol center false s1 symbol char 0 s1 skip 0 s1 linestyle 0 s1 linewidth 1 s1 color 1 s1 fill 0 s1 fill with color s1 fill color 1 s1 fill pattern 0 s1 errorbar type BOTH s1 errorbar length 1.000000 s1 errorbar linewidth 1 s1 errorbar linestyle 1 s1 errorbar riser on s1 errorbar riser linewidth 1 s1 errorbar riser linestyle 1 s1 xyz 0.000000, 0.000000 s1 comment "dist.plt" s2 type xy s2 symbol 2 s2 symbol size 0.500000 s2 symbol fill 1 s2 symbol color 1 s2 symbol linewidth 1 s2 symbol linestyle 1 s2 symbol center false s2 symbol char 0 s2 skip 0 s2 linestyle 0 s2 linewidth 1 s2 color 1 s2 fill 0 s2 fill with color s2 fill color 1 s2 fill pattern 0 s2 errorbar type BOTH s2 errorbar length 1.000000 s2 errorbar linewidth 1 s2 errorbar linestyle 1 s2 errorbar riser on s2 errorbar riser linewidth 1 s2 errorbar riser linestyle 1 s2 xyz 0.000000, 0.000000 s2 comment "dist.plt" xaxis tick on xaxis tick major ${numres} xaxis tick minor ${numres} xaxis tick offsetx 0.000000 xaxis tick offsety 0.000000 xaxis label "Residue Number" xaxis label layout para xaxis label place auto xaxis label char size 1.000000 xaxis label font 4 xaxis label color 1 xaxis label linewidth 2 xaxis ticklabel on xaxis ticklabel type auto xaxis ticklabel prec 0 xaxis ticklabel format decimal xaxis ticklabel append "" xaxis ticklabel prepend "" xaxis ticklabel layout horizontal xaxis ticklabel skip 0 xaxis ticklabel stagger 0 xaxis ticklabel op bottom xaxis ticklabel sign normal xaxis ticklabel start type auto xaxis ticklabel start 0.000000 xaxis ticklabel stop type auto xaxis ticklabel stop 0.000000 xaxis ticklabel char size 1.000000 xaxis ticklabel font 4 xaxis ticklabel color 1 xaxis ticklabel linewidth 2 xaxis tick major on xaxis tick minor on xaxis tick default 6 xaxis tick in xaxis tick major color 1 xaxis tick major linewidth 1 xaxis tick major linestyle 1 xaxis tick minor color 1 xaxis tick minor linewidth 1 xaxis tick minor linestyle 1 xaxis tick log off xaxis tick size 1.000000 xaxis tick minor size 0.500000 xaxis bar off xaxis bar color 1 xaxis bar linestyle 1 xaxis bar linewidth 1 xaxis tick major grid off xaxis tick minor grid off xaxis tick op both xaxis tick type auto xaxis tick spec 0 yaxis tick on yaxis tick major ${maxdist} yaxis tick minor ${maxdist} yaxis tick offsetx 0.000000 yaxis tick offsety 0.000000 yaxis label "Distance Between Like Atoms (Ang)" yaxis label layout para yaxis label place auto yaxis label char size 1.000000 yaxis label font 4 yaxis label color 1 yaxis label linewidth 2 yaxis ticklabel on yaxis ticklabel type auto yaxis ticklabel prec 1 yaxis ticklabel format decimal yaxis ticklabel append "" yaxis ticklabel prepend "" yaxis ticklabel layout horizontal yaxis ticklabel skip 0 yaxis ticklabel stagger 0 yaxis ticklabel op left yaxis ticklabel sign normal yaxis ticklabel start type auto yaxis ticklabel start 0.000000 yaxis ticklabel stop type auto yaxis ticklabel stop 0.000000 yaxis ticklabel char size 1.000000 yaxis ticklabel font 4 yaxis ticklabel color 1 yaxis ticklabel linewidth 2 yaxis tick major on yaxis tick minor on yaxis tick default 6 yaxis tick in yaxis tick major color 1 yaxis tick major linewidth 1 yaxis tick major linestyle 1 yaxis tick minor color 1 yaxis tick minor linewidth 1 yaxis tick minor linestyle 1 yaxis tick log off yaxis tick size 1.000000 yaxis tick minor size 0.500000 yaxis bar off yaxis bar color 1 yaxis bar linestyle 1 yaxis bar linewidth 1 yaxis tick major grid off yaxis tick minor grid off yaxis tick op both yaxis tick type auto yaxis tick spec 0 zeroxaxis tick on zeroxaxis tick major 50 zeroxaxis tick minor 25 zeroxaxis tick offsetx 0.000000 zeroxaxis tick offsety 0.000000 zeroxaxis label "" zeroxaxis label layout para zeroxaxis label place auto zeroxaxis label char size 1.000000 zeroxaxis label font 4 zeroxaxis label color 1 zeroxaxis label linewidth 1 zeroxaxis ticklabel off zeroxaxis ticklabel type auto zeroxaxis ticklabel prec 1 zeroxaxis ticklabel format decimal zeroxaxis ticklabel append "" zeroxaxis ticklabel prepend "" zeroxaxis ticklabel layout horizontal zeroxaxis ticklabel skip 0 zeroxaxis ticklabel stagger 0 zeroxaxis ticklabel op bottom zeroxaxis ticklabel sign normal zeroxaxis ticklabel start type auto zeroxaxis ticklabel start 0.000000 zeroxaxis ticklabel stop type auto zeroxaxis ticklabel stop 0.000000 zeroxaxis ticklabel char size 1.000000 zeroxaxis ticklabel font 4 zeroxaxis ticklabel color 1 zeroxaxis ticklabel linewidth 1 zeroxaxis tick major off zeroxaxis tick minor on zeroxaxis tick default 6 zeroxaxis tick in zeroxaxis tick major color 1 zeroxaxis tick major linewidth 1 zeroxaxis tick major linestyle 1 zeroxaxis tick minor color 1 zeroxaxis tick minor linewidth 1 zeroxaxis tick minor linestyle 1 zeroxaxis tick log off zeroxaxis tick size 1.000000 zeroxaxis tick minor size 0.500000 zeroxaxis bar off zeroxaxis bar color 1 zeroxaxis bar linestyle 1 zeroxaxis bar linewidth 1 zeroxaxis tick major grid off zeroxaxis tick minor grid off zeroxaxis tick op both zeroxaxis tick type auto zeroxaxis tick spec 0 zeroyaxis tick on zeroyaxis tick major 2 zeroyaxis tick minor 1 zeroyaxis tick offsetx 0.000000 zeroyaxis tick offsety 0.000000 zeroyaxis label "" zeroyaxis label layout para zeroyaxis label place auto zeroyaxis label char size 1.000000 zeroyaxis label font 4 zeroyaxis label color 1 zeroyaxis label linewidth 1 zeroyaxis ticklabel off zeroyaxis ticklabel type auto zeroyaxis ticklabel prec 1 zeroyaxis ticklabel format decimal zeroyaxis ticklabel append "" zeroyaxis ticklabel prepend "" zeroyaxis ticklabel layout horizontal zeroyaxis ticklabel skip 0 zeroyaxis ticklabel stagger 0 zeroyaxis ticklabel op left zeroyaxis ticklabel sign normal zeroyaxis ticklabel start type auto zeroyaxis ticklabel start 0.000000 zeroyaxis ticklabel stop type auto zeroyaxis ticklabel stop 0.000000 zeroyaxis ticklabel char size 1.000000 zeroyaxis ticklabel font 4 zeroyaxis ticklabel color 1 zeroyaxis ticklabel linewidth 1 zeroyaxis tick major off zeroyaxis tick minor on zeroyaxis tick default 6 zeroyaxis tick in zeroyaxis tick major color 1 zeroyaxis tick major linewidth 1 zeroyaxis tick major linestyle 1 zeroyaxis tick minor color 1 zeroyaxis tick minor linewidth 1 zeroyaxis tick minor linestyle 1 zeroyaxis tick log off zeroyaxis tick size 1.000000 zeroyaxis tick minor size 0.500000 zeroyaxis bar off zeroyaxis bar color 1 zeroyaxis bar linestyle 1 zeroyaxis bar linewidth 1 zeroyaxis tick major grid off zeroyaxis tick minor grid off zeroyaxis tick op both zeroyaxis tick type auto zeroyaxis tick spec 0 legend on legend loctype view legend layout 0 legend vgap 2 legend hgap 1 legend length 4 legend box off legend box fill off legend box fill with color legend box fill color 0 legend box fill pattern 1 legend box color 1 legend box linewidth 1 legend box linestyle 1 legend x1 0.197817 legend y1 0.79085 legend font 4 legend char size 1.000000 legend linestyle 1 legend linewidth 1 legend color 1 legend string 1 "All Like Atoms" legend string 2 "Alpha Carbons" frame on frame type 0 frame linestyle 1 frame linewidth 1 frame color 1 frame fill off frame background color 0 EOP xmgr -p dist.param dist.plt & rm tmp*