# read the secondary structure records from an edited version # of a STRIDE output file and return the information in the form: # {SSType chain1 resid1 chain2 resid2} {... } proc vmd_read_stride_ss {stride_filename} { set response {} # open the STRIDE file set infile [open $stride_filename r] # read until the end of file while {[gets $infile line]} { set str [string range $line 0 2] if {$str == "LOC"} { set str [string range $line 5 14] if {$str == "AlphaHelix"} { set ss helix } if {$str == "310Helix "} { set ss helix310 } if {$str == "PIHelix "} { set ss pihelix } if {$str == "Strand "} { set ss sheet } if {$str == "Bridge "} { set ss bridge } if {$str == "Coil "} { set ss coil } if {$str == "TurnI "} { set ss turn } if {$str == "TurnII "} { set ss turn } if {$str == "TurnII' "} { set ss turn } if {$str == "TurnIII "} { set ss turn } if {$str == "TurnIV "} { set ss turn } if {$str == "TurnV "} { set ss turn } if {$str == "TurnVI "} { set ss turn } if {$str == "TurnVII "} { set ss turn } if {$str == "TurnVIII "} { set ss turn } set chain1 [string range $line 28 28] set resid1 [string range $line 23 26] set chain2 [string range $line 46 46] set resid2 [string range $line 41 44] lappend response [list $ss $chain1 $resid1 $chain2 $resid2] continue } # also, if read blank line then there are no more def's if {$str == ""} { break } } # close the file and return the list of info close $infile return $response } #### Now a driver to get info from this routine # Return 0 if no information available # Return 1 otherwise proc vmd_use_stride_ss {molid stride_filename} { # get the list of information set ssdata [vmd_read_stride_ss $stride_filename] # was there data? if {$ssdata == {}} {return 0} #rlc's modification: first, reset everything to coil as a default set sel_all [atomselect $molid "all"] $sel_all set structure coil # Go through each of the element foreach ele $ssdata { lassign $ele ss chain1 resid1 chain2 resid2 # if the chains are " ", don't use them if {$chain1 == " "} { set seltext "protein and (resid $resid1 to $resid2)" } else { set seltext "chain $chain1 and (resid $resid1 to $resid2)" } # get the selection/ make it the right structure/ free it set sel [atomselect $molid $seltext] $sel set structure $ss $sel delete } # all done, so return that I did something return 1 } proc apply_stride_ss {molid stride_filename} { vmd_use_stride_ss $molid $stride_filename } puts "In order to apply the new secondary structure information, do:" puts "apply_stride_ss " puts " mol_id can be 'top' or the number next to the file name in" puts " the list of files that you have read in"