-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCCColor.tcl
More file actions
151 lines (136 loc) · 4.8 KB
/
CCColor.tcl
File metadata and controls
151 lines (136 loc) · 4.8 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Color pdb via CCC of Secondary Structure and residues
# Maximilian Scheurer, March 2016
#
namespace eval ::CCColor {
namespace export cccolor
set version 0.1
set description "CCColoring tool as VMD plugin"
}
package provide CCColor $CCColor::version
proc cccolor {args} \
{
return [eval ::CCColor::cccolor $args]
}
#####################
# input files
####################
proc ::CCColor::cccolor {MOL mapname resolution threshold spacing ss_on res_on gen_sel res_sel {tempfolder "/usr/tmp"} {bb_only 0} args} {
#################
# Program settings
#################
####color ss
#set ss_on 1
####color residues
#set res_on 0
# if "all" is specified as range, all residues will be analyzed, otherwise specify "resid x to y"
set range $res_sel
#######################
## MAIN PROGRAM
########################
set pdb [mol new $MOL]
set MOL [file rootname [file tail $MOL]]
### set beta for all
set defaultBeta 0
[atomselect $pdb all] set beta $defaultBeta
set atomSel [atomselect $pdb "$gen_sel"]
set dens_mol [mol new $mapname]
#source getSS.tcl
getSS $MOL.ss $pdb segname $tempfolder
assignSS $MOL.ss $pdb segname
set chains [lindex [list [lsort -unique [$atomSel get fragment]]] 0]
set log [open "${MOL}_cclog.txt" w]
puts $log $chains
# do ccc-coloring for SS
if {$ss_on} {
puts $log "Running SS coloring"
foreach chain $chains {
puts $log "current chain: $chain"
set chainCAS [atomselect $pdb "fragment $chain and name CA"]
puts $chainCAS
set ssList [$chainCAS get structure]
puts $log $ssList
puts $log [llength $ssList]
set resList [lsort -unique -integer [$chainCAS get resid]]
set resListLength [llength $resList]
puts $log "reslist $resListLength"
set id_begin [lindex $resList 0]
set id_end [expr $id_begin + $resListLength - 1]
set id_0 $id_begin
for {set id_i $id_begin} {$id_i <= $id_end} {incr id_i} {
set ss_0 [lindex $ssList [expr $id_i - $id_begin]]
set ss_1 [lindex $ssList [expr $id_i - $id_begin + 1]]
# puts $log "$id_i"
if {$ss_0 != $ss_1} {
set ssSel [atomselect $pdb "fragment $chain and (resid $id_0 to $id_i)"]
if {[$ssSel num] == 0} {
puts "no atoms in selection"
}
puts $log [$ssSel num]
# volmap mask $ssSel -o mask.dx -cutoff $cutoff
# volutil -mult ${emdbName}_density.dx mask.dx -o compare.dx
#set CCSS [mdff ccc $ssSel -i $mapname.dx -res $resolution -spacing $spacing -thresholddensity $threshold]
if {$spacing != -1} {
set CCSS [mdffi cc $ssSel -mol $dens_mol -res $resolution -spacing $spacing -thresholddensity $threshold]
} else {
set CCSS [mdffi cc $ssSel -mol $dens_mol -res $resolution -thresholddensity $threshold]
}
#set CCSS 0.0
set str [string range "$CCSS" 1 3]
if {[string equal $str "nan"] || [string equal $str "NaN"]} {
$ssSel set beta -1.0
} else {
$ssSel set beta $CCSS
}
#rm mask.dx compare.dx
puts $log "$id_0 $id_i $CCSS"
set id_0 [expr $id_i +1]
}
}
}
[atomselect $pdb all] writepdb $MOL-ss.pdb
}
if {$res_on} {
puts $log "Running resid coloring"
[atomselect $pdb all] set beta $defaultBeta
foreach chain $chains {
if {$range=="all"} {
set resids [lsort -unique -integer [[atomselect $pdb "fragment $chain"] get resid]]
} else {
set resids [lsort -unique -integer [[atomselect $pdb "fragment $chain and (${range})"] get resid]]
}
puts $log "$resids"
foreach res $resids {
if {$bb_only} {
set resSel [atomselect $pdb "fragment $chain and resid $res and backbone"]
} else {
set resSel [atomselect $pdb "fragment $chain and resid $res"]
}
puts $log "[$resSel num] --- $chain"
#volmap mask $resSel -o mask.dx -cutoff $cutoff
#volutil -mult ${emdbName}_density.dx mask.dx -o compare.dx
#set CCres [mdff ccc $resSel -i $mapname.dx -res $resolution -spacing $spacing -thresholddensity $threshold]
# set CCres [mdffi cc $resSel -mol $dens_mol -res $resolution -spacing $spacing -thresholddensity $threshold]
if {$spacing != -1} {
set CCres [mdffi cc $resSel -mol $dens_mol -res $resolution -spacing $spacing -thresholddensity $threshold]
} else {
set CCres [mdffi cc $resSel -mol $dens_mol -res $resolution -thresholddensity $threshold]
}
set str [string range "$CCres" 1 3]
if {[string equal $str "nan"] || [string equal $str "NaN"]} {
$resSel set beta -1.0
} else {
$resSel set beta $CCres
}
#rm mask.dx compare.dx
puts $log "$res $CCres"
unset resSel
}
}
if {$bb_only} {
[atomselect $pdb all] writepdb $MOL-res-bb.pdb
} else {
[atomselect $pdb all] writepdb $MOL-res.pdb
}
}
close $log
}