forked from haddocking/haddock-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdb_chain-segid
executable file
·37 lines (34 loc) · 1.01 KB
/
pdb_chain-segid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/awk -f
#
# pdb_segid-to-chain script
#
# This script copies the CNS segid to the chainid
#
# Usage: see usage statement (type 'pdb_segid-to-chain' without arguments)
#
# Example:
# input lines:
# ATOM 32 CD1 LEU A 2 -6.002 10.544 9.006 1.00 0.00
# output lines:
# ATOM 32 CD1 LEU A 2 -6.002 10.544 9.006 1.00 0.00 A
#
# Remarks:
# - Only ATOM and HETATM records are affected.
# - Only the first character of the segid can be stored in the chainid.
BEGIN {
if ( ARGC == 1 ) {
print "Usage: pdb_chain-to-segid inputfile > outputfile"
print "Action:"
print "the chainID given in column 22 is copied to the segid in column 73"
exit
}
}
$1 == "ATOM" || $1 == "HETATM" {
if (substr($0,73,1) == " "){segid=substr($0,22,1)}else{segid=substr($0,73,1)};
if (substr($0,22,1) == " "){chain=substr($0,73,1)}else{chain=substr($0,22,1)};
printf( "%s%s%s%s%s\n", substr($0,1,21),chain,substr($0,23,50),segid,substr($0,74) )
next
}
{
print $0
}