March 27th, 2012 Combine Multiple PDB Files as Models in a Single File
So I found this site that gives a quick script to do this job, but i needed to combine a directory full of inconsistently named docking outputs (pdb files) so I modified it and this is what I came up with:
#!/bin/bash mkdir 1 echo -n > 1/output.pdb; j=1; for i in *.pdb; do printf "MODEL %4d\n" $j >> 1/output.pdb; grep ATOM $i >> 1/output.pdb; printf "ENDMDL\n" >> 1/output.pdb; j=`expr $j + 1` done
Quick and painless. To use it copy & paste the above text into a file and make it executable, or download the compressed file here:
CombinePDB.sh
It should work wherever bash is the shell of choice.
Posted in bash scripting, Biochemistry | Comments (0)