Difference between revisions of "Print the shifts in individual atom positions"

From CCP4 wiki
Jump to navigationJump to search
Line 1: Line 1:
This can be done with one command line (albeit a rather long one). Below is the code with (remove backslashes if pasting as a single line)  
+
This can be done with one command line (albeit a rather long one). It also implies a rather recent version of awk, some older versions won't support the fixed width argument splitting.  Below is the code with (remove backslashes if pasting as a single line)  
  
 
grep 'ATOM\|HETATM' file1.pdb file2.pdb | \
 
grep 'ATOM\|HETATM' file1.pdb file2.pdb | \

Revision as of 14:49, 14 December 2010

This can be done with one command line (albeit a rather long one). It also implies a rather recent version of awk, some older versions won't support the fixed width argument splitting. Below is the code with (remove backslashes if pasting as a single line)

grep 'ATOM\|HETATM' file1.pdb file2.pdb | \

grep -v REMARK | \

cut -d: -f 2 | \

cut -c 13-54 | \

sort | \

awk 'BEGIN {FIELDWIDTHS = "14 28"; pt=""} {if(pt==$1) print pr,$2; pt=$1; pr=$0;}' | \

awk 'BEGIN {FIELDWIDTHS = "14 4 8 8 8 5 8 8 8"} {printf "%s %8.4f\n",$1,sqrt(($3-$7)^2+($4-$8)^2+($5-$9)^2);}' | \

awk 'BEGIN {FIELDWIDTHS = "4 1 3 1 1 5 9"} {printf "%s %s %s %s %s\n", $3,$5,$6,$1,$7;}'


Back to Useful scripts (aka smart piece of code)