{+ file: rename_segid.inp +} {+ directory: general +} {+ description: Rename segid(s) +} {+ comment: Reads in a coordinate and structure file, renames the selected segid information and writes out a new coordinate and structure file +} {+ authors: Axel T. Brunger, and Paul D. Adams +} {+ copyright: Yale University +} {- Guidelines for using this file: - all strings must be quoted by double-quotes - logical variables (true/false) are not quoted - do not remove any evaluate statements from the file -} {- begin block parameter definition -} define( {======================= molecular structure ==========================} {* input molecular structure file *} {===>} structure_infile="fab2hfl.mtf"; {* input coordinate file *} {===>} coordinate_infile="fab2hfl.pdb"; {========================== renaming segids ==========================} {+ table: rows=10 numbered cols=2 "old segid" "new segid" +} {===>} segid_old_1="L"; {===>} segid_new_1="A"; {===>} segid_old_2="H"; {===>} segid_new_2="B"; {===>} segid_old_3=""; {===>} segid_new_3=""; {===>} segid_old_4=""; {===>} segid_new_4=""; {===>} segid_old_5=""; {===>} segid_new_5=""; {===>} segid_old_6=""; {===>} segid_new_6=""; {===>} segid_old_7=""; {===>} segid_new_7=""; {===>} segid_old_8=""; {===>} segid_new_8=""; {===>} segid_old_9=""; {===>} segid_new_9=""; {===>} segid_old_10=""; {===>} segid_new_10=""; {=========================== output files ============================} {* output molecular structure file *} {===>} structure_outfile="rename_segid.mtf"; {* output coordinate file *} {===>} coordinate_outfile="rename_segid.pdb"; {===========================================================================} { things below this line do not normally need to be changed } {===========================================================================} ) {- end block parameter definition -} checkversion 1.2 evaluate ($log_level=quiet) structure @@&structure_infile end coordinate @@&coordinate_infile evaluate ($segnum=1) evaluate ($done=false) while ( $done = false ) loop safe if ( &exist_segid_old_$segnum = true ) then if ( &segid_old_$segnum # &segid_new_$segnum ) then evaluate ($segtmp="T^" + encode($segnum)) do (segid=$segtmp) (segid=&segid_old_$segnum) end if else evaluate ($done=true) end if evaluate ($segnum=$segnum+1) end loop safe evaluate ($segnum=1) evaluate ($done=false) while ( $done = false ) loop rename if ( &exist_segid_old_$segnum = true ) then if ( &segid_old_$segnum # &segid_new_$segnum ) then evaluate ($segold="T^" + encode($segnum)) evaluate ($segid=capitalize(&segid_new_$segnum)) do (segid=$segid) (segid=$segold) end if else evaluate ($done=true) end if evaluate ($segnum=$segnum+1) end loop rename write structure output=&structure_outfile end write coordinate output=&coordinate_outfile end stop