#!/bin/csh set main_version = 2 set minor_version = 08 set edit_version = 07 echo " " echo "RESOLVE difference map script version $main_version.$minor_version.$edit_version " echo " " echo "Date: `date`" echo "Working directory: `pwd`" echo " " # # RESOLVE difference map script # 05-Jan-2005 # # Tom Terwilliger # Los Alamos National Laboratory # # # Input: FP, model # # Methods: Just calculate a difference map using phases from model # # Output: Map coefficients FP PHIM FOMM in resolve_diff.mtz # CCP4-style map file in resolve_diff.map # #====================================================================== # EDIT THE NEXT FEW SETS OF LINES TO MATCH YOUR DATA AND SYSTEM # # PLEASE NOTE: each of the " = " below must have a SPACE on either # side (hklin = solve.mtz NOT hklin=solve.mtz ) # #====================================================================== # # Anything special for your location (SOLVEDIR etc); # setenv SOLVEDIR /usr/local/lib/solve/ # # location of resolve and resolve libraries; place for large scratch files # set resolve = /u1/terwill/resolve/work/resolve.linux setenv TMPDIR . # large scratch files go here # set hklin = FOBS.mtz set labin = 'FP=FP SIGFP=SIGFP' set labin_cont = '' # # input model # set pdb_in = PARTIAL_MODEL.pdb # # resolution # set dmin = NONE # NONE to use all data...high-res limit set dmax = NONE # NONE to use all data...low-res limit # #============================================================================== # Normally no need to edit below here... #============================================================================== #============================================================================== # set main_version_minimum = 2 set minor_version_minimum = 08 # setenv SYMOP $SOLVEDIR/symop.lib setenv SYMINFO $SOLVEDIR/syminfo.lib setenv CCP4_OPEN UNKNOWN unlimit limit coredumpsize 0 # set ip = 0 #-------------------------------------------------------------- # check for all the library files we will need etc # if ( $resolve == NONE ) then echo "Sorry, you need to define resolve ..." exit endif foreach program ($resolve) if ( $ip ) echo "Checking for the program $program ..." if ( -f $program ) then if ( $ip ) echo "OK" goto ok endif if ( $program == NONE ) then if ( $ip ) echo "This program is not used" goto ok endif which $program >& tmp.dat set test = `head -1 tmp.dat` if ( $#test != 1 ) goto bad if ( -f $test ) then if ( $ip ) echo "OK" goto ok endif bad: echo "Sorry, the program $program does not exist?" echo "Please check its definition in this script..." exit endif ok: end # # foreach lib_file ( symop.lib syminfo.lib) # if ( $ip ) echo "Checking for library file $SOLVEDIR/$lib_file..." if ( ! -f $SOLVEDIR/$lib_file) then echo "Sorry, the library file $lib_file does not exist?" echo "Please check the definition of SOLVEDIR in your script: $SOLVEDIR" exit endif end #-------------------------------------------------------------- # # check for resolve if ( -f resolve.ok ) rm resolve.ok if ( -f resolve.version ) rm resolve.version $resolve <& resolve.log quit EOD if ( ! -f resolve.ok ) then echo "Sorry please check the location of resolve..." echo " is it really $resolve?" exit endif # make sure this sort of worked... set test_ok = `cat resolve.ok` set test_ok_mem = $test_ok[$#test_ok-$#test_ok] if ( $test_ok_mem != "ALLOCATED" ) then echo "Sorry, resolve was not able to run properly at all" echo "The end of the resolve log file says..." echo "---------------------------------------------------------" tail -12 resolve.log echo "---------------------------------------------------------" exit endif if ( ! -f resolve.version ) then echo "Sorry, this script requires version $main_version_minimum.$minor_version_minimum or higher of resolve" exit endif @ version = `cat resolve.version|head -1` set version_minimum = "$main_version_minimum$minor_version_minimum" if ( $version < $version_minimum )then echo "Sorry, this script requires version $main_version_minimum.$minor_version_minimum or higher of resolve" exit else if ( $ip ) echo "Running version $version of resolve" endif # # make sure we have these files... # if ( -f $hklin ) then echo "Data are in the mtz file $hklin" else echo "Sorry, cannot find the mtz file $hklin" exit endif echo "LABIN information: $labin $labin_cont" echo " " # if ( ( $pdb_in != NONE ) && ( ! -f $pdb_in ) ) then echo "Sorry, cannot find your pdb_in file $pdb_in" exit endif # #-------------------------------------------------------------- # figure out if this machine uses grep -a or just grep for text files: echo "A" > test_a.dat set test_grep = `grep -a "a" test_a.dat >& tmp.dat` if ( $status ) then # there was an error...do not use grep -a set grep_type = "grep" else set grep_type = "grep -a" endif set test_grep = `$grep_type "A" test_a.dat` if ( $#test_grep != 1 ) then echo "Sorry, unable to set the grep command on this system...giving up" exit endif rm test_a.dat #-------------------------------------------------------------- # @ grep_phib = `echo $labin $labin_cont | $grep_type 'PHIB='|wc -m` @ grep_fp = `echo $labin $labin_cont | $grep_type 'FP='|wc -m` # if ( $grep_fp == 0 ) then echo "Sorry, FP is always required in the labin line..." exit endif if ( $pdb_in == NONE ) then echo "Sorry you need a pdb_in file" exit endif # if ( $dmin == NONE || $dmax == NONE )then set resolution_line = "" else set resolution_line = "resolution $dmin $dmax" endif echo " " echo "${resolution_line} " echo " " # set blank = " " # # SETUP: # # ======================================================================= # ======================================================================= # hklin_image will be our combined phase information # set hklin_image = start_image.mtz set labin_image = 'FP=FP PHIB=PHIM FOM=FOMM HLA=HLAM HLB=HLBM HLC=HLCM HLD=HLDM' set labin_image_cont = 'FreeR_flag=FreeR_flag' # set hklin_exp = exp.mtz set labin_exp = 'FP=FP PHIB=PHIM FOM=FOMM HLA=HLAM HLB=HLBM HLC=HLCM HLD=HLDM' set labin_exp_cont = 'FreeR_flag=FreeR_flag' # echo "Copying information from $hklin to $hklin_exp" ${resolve}<>resolve.log ! Copying over $hklin to $hklin_exp hklin $hklin labin $labin labin $labin_cont hklout $hklin_exp $resolution_line mask_cycles 1 minor_cycles 0 no_build EOD # # make sure this sort of worked... if ( `cat resolve.ok` != 'OK' ) then echo "Sorry, resolve was not able to finish even the first cycle" echo "The end of the resolve log file says..." echo "---------------------------------------------------------" tail -10 resolve.log echo "---------------------------------------------------------" exit endif # # set pdb_start = $pdb_in # starting PDB file cp $pdb_in refine.pdb_0 # echo " " # ${resolve}<>resolve.log hklin $hklin_exp labin $labin_exp labin $labin_exp_cont $resolution_line fcalc $pdb_in hklout fcalc.mtz EOD # # make sure this sort of worked... if ( `cat resolve.ok` != 'OK' ) then echo "Sorry, resolve was not able to finish on the first cycle" echo "The end of the resolve log file says..." echo "---------------------------------------------------------" tail -10 resolve.log echo "---------------------------------------------------------" exit endif # $resolve<>resolve.log hklin $hklin_exp labin $labin_exp labin $labin_exp_cont hklperfect fcalc.mtz labperfect FP=FP PHIB=PHIM difference_map phase_with_perf hklout resolve_diff.mtz EOD # if ( -f resolve_map.mtz ) then $resolve<>resolve.log hklin resolve_diff.mtz labin FP=FP PHIB=PHIM FOM=FOMM mask_cycles 1 minor_cycles 0 no_build ccp4_map_file resolve_diff.map EOD echo "resolve_diff.mtz ... Coefficients for difference map only FP PHIM FOMM" echo "resolve_diff.map ... ccp4-style map from resolve_diff.mtz" endif #==================================================================