annotate PLIDflow/scripts/separateChain.sh @ 6:795e11fac81b draft default tip

Included new tools for standardization
author bitlab
date Wed, 22 Apr 2020 06:12:00 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
1 #!/bin/bash
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
2
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
3 # Arguments
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
4 # $1 = pdb
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
5
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
6
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
7
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
8 nbad=$(awk '{if(length($5) > 1) print $0 }' $1 | wc -l)
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
9
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
10 if [[ $nbad -ne 0 ]]; then
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
11
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
12 #cat $1 | awk 'BEGIN{FS="\t"}{ split($0, array, " "); a=substr(array[5],1,1); b=substr(array[5],2); }'
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
13 cat $1 | gawk 'BEGIN{FS="\t"}{ split($0, array, " "); if(array[5] ~ /([A-Z][0-9]+)/){ a=substr(array[5],1,1); b=substr(array[5],2); gsub(array[5], a" "b, $0); gsub(a" "b" ", a" "b, $0) ; print $0; }else{ print $0}}' > $1.temp.awk
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
14 grep "ATOM\|HETATM" $1.temp.awk | awk '{ if(length($5)==1) updateName=$5; if($1 == "ATOM" || $1 == "HETATM"){ print $0 > "chain"updateName".pdb"; }}' ;
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
15 rm $1.temp.awk
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
16
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
17 else
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
18
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
19 grep "ATOM\|HETATM" $1 | awk '{ if(length($5)==1) updateName=$5; if($1 == "ATOM" || $1 == "HETATM"){ print $0 > "chain"updateName".pdb"; }}' ;
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
20
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
21 fi
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
22
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
23 #grep "ATOM\|HETATM" $1 | awk '{ if(length($5)==1) updateName=$5; if($1 == "ATOM" || $1 == "HETATM"){ print $0 > "chain"updateName".pdb"; }}' ;
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
24 for i in chain* ; do echo "TER" >> $i ; echo "END" >> $i ; done