{+ file: merge_structures.inp +} {+ directory: general +} {+ description: Merge coordinate and molecular structure information +} {+ comment: Reads in two or more coordinate and structure files, checks for overlapping atom definitions, and writes out a merged 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 structures =========================} {* Structure file, coordinate file, new segid and residue number increment *} {* if the new segid is blank the old segid will not be renamed *} {* if the residue increment is non-zero all residue numbers will be incremented by this number *} {+ table: rows=10 numbered cols=4 "structure file" "coordinate file" "new segid" "residue increment" +} {===>} structure_infile_1="mbp_sites.mtf"; {===>} coordinate_infile_1="mbp_sites.pdb"; {===>} segid_file_1="mol1"; {===>} resid_inc_1=10; {===>} structure_infile_2="amy.mtf"; {===>} coordinate_infile_2="amy.pdb"; {===>} segid_file_2="mol2"; {===>} resid_inc_2=0; {===>} structure_infile_3=""; {===>} coordinate_infile_3=""; {===>} segid_file_3=""; {===>} resid_inc_3=0; {===>} structure_infile_4=""; {===>} coordinate_infile_4=""; {===>} segid_file_4=""; {===>} resid_inc_4=0; {===>} structure_infile_5=""; {===>} coordinate_infile_5=""; {===>} segid_file_5=""; {===>} resid_inc_5=0; {===>} structure_infile_6=""; {===>} coordinate_infile_6=""; {===>} segid_file_6=""; {===>} resid_inc_6=0; {===>} structure_infile_7=""; {===>} coordinate_infile_7=""; {===>} segid_file_7=""; {===>} resid_inc_7=0; {===>} structure_infile_8=""; {===>} coordinate_infile_8=""; {===>} segid_file_8=""; {===>} resid_inc_8=0; {===>} structure_infile_9=""; {===>} coordinate_infile_9=""; {===>} segid_file_9=""; {===>} resid_inc_9=0; {===>} structure_infile_10=""; {===>} coordinate_infile_10=""; {===>} segid_file_10=""; {===>} resid_inc_10=0; {* check for overlapping atom definitions after merging *} {+ choice: true false +} {===>} check_overlap=true; {=========================== output files ============================} {* output molecular structure file *} {===>} structure_outfile="merge.mtf"; {* output coordinate file *} {===>} coordinate_outfile="merge.pdb"; {===========================================================================} { things below this line do not normally need to be changed } {===========================================================================} ) {- end block parameter definition -} checkversion 1.2 evaluate ($log_level=quiet) evaluate ($struct=1) evaluate ($done=false) while ( $done = false ) loop struct do (refx=0) (all) if ( &BLANK%structure_infile_$struct = false ) then structure @@&structure_infile_$struct end end if if ( &BLANK%coordinate_infile_$struct = false ) then coordinate @@&coordinate_infile_$struct end if if ( &resid_inc_$struct # 0 ) then do (resid=encode(decode(resid)+&resid_inc_$struct)) (attr refx=9999) end if if ( &BLANK%segid_file_$struct = false ) then evaluate ($segid="T^" + encode($struct)) do (segid=$segid) (attr refx=9999) end if evaluate ($struct=$struct+1) if ( &BLANK%structure_infile_$struct = true ) then evaluate ($done=true) end if end loop struct evaluate ($struct=1) evaluate ($done=false) while ( $done = false ) loop rename if ( &BLANK%segid_file_$struct = false ) then evaluate ($segold="T^" + encode($struct)) evaluate ($segid=capitalize(&segid_file_$struct)) do (segid=$segid) (segid=$segold) end if evaluate ($struct=$struct+1) if ( &BLANK%structure_infile_$struct = true ) then evaluate ($done=true) end if end loop rename evaluate ($struct=1) evaluate ($done=false) while ( $done = false ) loop check if ( $log_level = verbose ) then set message=normal echo=on end else set message=off echo=off end end if if ( &check_overlap = true ) then if ( $struct > 1 ) then for $id in id (all) loop overlap show (segid) (id $id) evaluate ($segid=$result) show (resid) (id $id) evaluate ($resid=$result) show (name) (id $id) evaluate ($name=$result) show sum(1) (segid $QUOTE%segid and resid $resid and name $name) if ( $result > 1 ) then evaluate ($segid="""+$segid+""") display >>>> Overlapping molecular structure information for display >>>> atom: segid $segid and resid $resid and name $name display >>>> there are $result atoms selected abort end if end loop overlap end if end if set message=normal end set echo=on end evaluate ($struct=$struct+1) if ( &BLANK%structure_infile_$struct = true ) then evaluate ($done=true) end if end loop check show sum(1) (not(known)) if ( $result > 0 ) then display >>>> Warning: there are still missing coordinates for $result atoms show (name) (not(known)) end if write structure output=&structure_outfile end write coordinate output=&coordinate_outfile end stop