patch for XPLOR PDB files - and now the script

Ton Rullmann rull at PANDA.CHEM.RUU.NL
Fri Oct 10 09:34:08 EST 1997


This is a multi-part message in MIME format.

--------------2781446B794B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I KNEW I forgot something. Sorry.
Ton.

--------------2781446B794B
Content-Type: text/plain; charset=us-ascii; name="patchXPLORpdb"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="patchXPLORpdb"

#!/bin/nawk -f
#
# patchXPLORpdb script.
# Author: Ton Rullmann, Utrecht University, rull at nmr.chem.ruu.nl
# Date: October 10, 1997
#
# This script modifies an XPLOR PDB-file to comply better (but still not
# completely) with the PDB format definition:
#  - 4 character atom names such as HG11 are changed to 1HG1 etc.
#  - optionally, the segid given in column 73 is copied to the chainID in
#    column 22
#
# Usage: see usage statement (type 'patchXPLORpdb' without arguments)
#
# Example:
# input lines:
# ATOM     32  CD1 LEU     2      -6.002  10.544   9.006  1.00  0.00      A   
# ATOM     33 HD11 LEU     2      -6.305  11.580   9.001  1.00  0.00      A   
# output lines:
# ATOM     32  CD1 LEU A   2      -6.002  10.544   9.006  1.00  0.00      A   
# ATOM     33 1HD1 LEU A   2      -6.305  11.580   9.001  1.00  0.00      A   
#
# Remarks: 
#  - Only ATOM and HETATM records are affected.
#  - Formally TER records should be introduced to delineate the chains,
#    but many programs can live without.
#  - Only the first character of the segid can be stored in the chainid. 

BEGIN {
    if ( FILENAME == "-" ) {
	print "Usage: patchXPLORpdb [nochain=1] inputfile > outputfile"
	print "    segid is not copied to chainid if nochain is set to 1"
	exit
    }
}

$1 == "ATOM" || $1 == "HETATM" {
    if ( substr($0,13,1) == "H" )
	lin = substr($0,1,12) substr($0,16,1) substr($0,13,3) substr($0,17)
    else
	lin = $0
    if ( nochain )
	print lin
    else
        printf( "%s%s%s\n", substr(lin,1,21), substr(lin,73,1), substr(lin,23) )
    next
}

{
    print $0
}

--------------2781446B794B--




More information about the X-plor mailing list