Version : 970613
Author : Gerard J. Kleywegt & T. Alwyn Jones,
Dept. of Cell and Molecular Biology,
Uppsala University, Biomedical Centre, Box 590,
SE-751 24 Uppsala, SWEDEN
E-mail : gerard@xray.bmc.uu.se
Purpose : averaging of electron-density maps
Package : RAVE
For literature references, see the output or manuals for the individual RAVE programs.
930331 - first version
930616 - new options in MAMA (spherical and cubic masks;
expansion into asymmetric unit); bugs removed
from BONES options; simple macro facility
- averaging and expansion step separated in AVE;
note: INPUT HAS CHANGED !!! alter your scripts !
- smaller versions, specifically for ESVs, of DATAMAN,
MAPMAN and MAMA
- included MAPMAN and NCS6D
- much improved C-shell script for N cycles of single-
crystal averaging !!!
- improved documentation for some of the programs
- AVE and MAVE print corr. coeff. between first
NCS operator density and each of the others
- MAMA, MAPMAN and DATAMAN support shell commands ($)
- see the individual manuals for more info
931129 - better SCA script
- added iterative skeletonisation script
- some minor changes
931216 - included multiple-domain averaging & positivity
931221 - cleaned up (old stuff is now in "paper" manual)
940803 - added some FAQs to this document
960410 - wrote CRAVE -> automatically generates a complete C-shell
script to do multiple-crystal averaging (single-domain
only) from a simple input file; see the CRAVE manual for
details !
961126 - dynamic memory allocation in most programs
970613 - changed some hyperlinks
From the end of November, 1996, basically all RAVE programs use dynamic memory allocation. This means that you can set the maximum size of maps and masks that the programs can handle, as well as the maximum number of maps for MAPMAN and the maximum number of masks for MAMA (both can be set to any number between 1 and 10).
You can set these parameters in two different ways:
(1) use environment variables MAPSIZE, MASKSIZE, NUMMAPS and NUMMASKS (these names must be in all-capitals). For instance, you could put the following into your .cshrc file:
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- setenv MAPSIZE 10000000 setenv NUMMAPS 2 setenv MASKSIZE 5000000 setenv NUMMASKS 4 ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
(2) to change the settings on the fly, you can use command-line arguments, for example:
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- run ave -b mapsize 20000000 < ave.inp >& ave.out run mapman nummaps 2 mapsize 15000000 run mapman nummaps 10 mapsize 2000000 run mama masksize 3000000 nummasks 8 ------ EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
The following table shows how many maps and/or masks each program allocates, so you can figure out the memory requirements:
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- - MAPMAN (version 5.0; NUMMAPS + 1 maps ) - MAMA (version 4.0; NUMMASKS + 2 masks) - AVE (version 4.0; 2 maps, 1 mask ) - NCS6D (version 2.0; 1 map ) - IMP (version 2.0; 2 maps, 1 mask ) - MAVE (version 3.0; 2 maps, 1 mask ) - COMAP (version 2.0; 3 maps ) - COMDEM (version 2.0; 3 maps ) - MAPFIX (version 2.0; 1 map ) ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
NOTE: DATAMAN 5.0 also uses dynamic memory allocation, but uses other control parameters (NUMSETS and SETSIZE). See the DATAMAN manual for details.
NOTE: a complete and up-to-date list of FAQs can be retrieved
from the Uppsala ftp-server, the filename is:
pub/bin/gerard/omac/software.faq
This document also tells you how to browse the FAQ using Mosaic.
An even quicker way to get the FAQ is to use:
finger gerard@sarek.bmc.uu.se > software.faq
read m1 oldmask
new same m1
new padding 10 10 10
new copy m2 m1
write m2 newmask
setenv CCP4_OPEN UNKNOWN
* add a title
* alter the write-order of the axes
* add (or change) the spacegroup's symmetry operators
There is a tutorial for using RAVE in the case of single-domain, single-crystal averaging (using P2 myelin data). Get the following file: ftp://alpha2.bmc.uu.se/pub/gerard/rave/exam.tar.Z
This is a compressed, tar-ed directory that contains all the files you need to do the averaging as described in RAVE_TUTORIAL; it also contains worked answers and a sub-directory with all the files that are generated if you re-work the exercises and answers.
NOTE: the example directory also contains the skeleton of P2 myelin. You could use this to learn or teach the use of O for building protein structures from a set of Bones atoms.
- limit - this gives the limits on CPU usage, stack size etc.:
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- % 1190 gerard rigel 20:59:38 home/gerard > limit cputime unlimited filesize 2097151 kbytes datasize 262143 kbytes stacksize 262143 kbytes coredumpsize 0 kbytes memoryuse 29759 kbytes ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
Try increasing the stack size, for example, by simply typing:
limit stacksize 300000 (or some other number).
Note that the coredumpsize is set to zero, which means that you get
empty cores (no clogging of your disks) AND extremely fast "coredumps".
- swap - this shows the allocated swap space (ask your system manager to increase this, if necessary):
* on SGI:
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- # 248 root sirius 20:53:42 nfs/public > /etc/swap -l path dev swaplo blocks free /dev/dsk/dks0d1s1 22,33 0 81600 55520 ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
* on ESV:
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- <622 vega average/esv> /etc/swap -l path dev swaplo blocks free /dev/dsk/isc0d0s1 16,1 0 65536 60696 /dev/dsk/isc0d0s7 16,7 0 156672 151912 ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
* on Dec/Alpha/OSF1:
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- # swapon -s Total swap allocation: Allocated space: 139258 pages (1087MB) Reserved space: 19646 pages ( 14%) Available space: 119612 pages ( 85%) ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
940124: Note that if you put the "limit" statements in your .login file, they may or may not take effect, depending on how you start your session. If you use rlogin, for example, your .login file will NOT be executed, whereas if you use telnet, it will !
"Is there any way to "SKEW" a map using MAPMAN ? I am aware of the possibility of multiplying, dividing, adding and so on. I have a map of my molecule in the crystal cell. I want to relate that to the standard orientation of the molecule."
There's no option in MAPMAN to do this, but you can probably use the averaging program AVE (or MAVE) to do it. I would try this:
- take your standard molecule and generate a mask with MAMA (use the NEw PDb command with a large radius around the atoms)
- run AVE (or MAVE if you put your standard molecule in a different cell) to merely average the density (i.e., do not expand)
- get the Cartesian operator FROM your standard molecule TO the one in the cell around which the mask was calculated (e.g., with O or LSQMAN)
- supply only one operator to AVE, namely the one you generated in the previous step (if you use MAVE, supply this operator as the inter-crystal operator and supply the identity operator as the only NCS operator)
- run MAPMAN to mappage the resulting map
Of course, the simple way of doing things is to draw the map
around the molecule in the cell and then use the O command
"Rot_tran_obj" to bring the map on top of your standard molecule.
This also requires an operator, but now FROM your molecule
in the crystal TO the standard molecule.
ABBREVIATIONS
NCS non-crystallographic symmetry
RT rotation-translation (operator)
MIR multiple-isomorphous replacement
CC correlation coefficient
Fo observed structure-factor amplitudes
Fc calculated structure-factor amplitudes
SCA single-crystal averaging
MCA multiple-crystal averaging
MDA multiple-domain averaging
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- #!/bin/csh -f AVE -b << EOF both average and expand abc.E m12a_edit.mask av_0.E symop.o rt_unit.o rt_a_to_b.o rt_a_to_c.oEOF ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- #!/bin/csh -f AVE -b << EOF average only av_2.E m12a_edit.mask av_2x.E symop.o rt_unit.oEOF
MAPMAN -b << EOF read m1 av_2x.E ccp4 range m1 0 50 (sets "prod" and "plus"; optional) mappage m1 av_2x.map quit EOF ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- #!/bin/csh -f#alias run '/nfs/taj/gerard/bin/run'
# do N cycles of single-crystal averaging with RAVE/CCP4 # includes error checks to test if the appropriate files # exist or have been generated
# Gerard J. Kleywegt @ 931104 # E-mail: "gerard@xray.bmc.uu.se"
# edit this file, then execute with: # script_name | tee rave.log # or # nohup script_name >& rave.log &
# Molecular Replacement version
set version='molrep_averaging @ 931104 / gj kleywegt' set starttime=`date`
# set echo
# IMPORTANT: when you start RAVE-ing, a map file called # "$scrat/{$myid}_{$prev}.E" MUST exist ! # EXAMPLE: if your scratch directory is $SCR, # your id is "model1" and the previous # cycle number is "0", then the map file # $SCR/model1_0.E must exist
# change the following symbols as appropriate #################
# re-assign CCP4 scratch areas (not necessary) setenv CCP4_SCR /nfs/scr_uu5/gerard/scratch setenv BINSORT_SCR /nfs/scr_uu1/gerard/binsort
# CCP4 2.2 temporary patch (problems with path names) set path=($CBIN $path) rehash # echo $path
# go to YOUR work directory cd /nfs/gerard/proteins/eg1/average
# set id (e.g., the ID of this macro-cycle) set myid=o13
# NEXT cycle NUMBER (MUST BE A NUMBER !!!) @ cycle = 1 # note that a map with ($cycle - 1) in the name MUST exist # see "IMPORTANT" note above
# final cycle nr (I.E.: NOT THE NUMBER OF CYCLES !!!) (MUST BE A NUMBER !!!) @ end = 4
# scratch directory (where map, scratch and log files go to) set scrat=/nfs/scr_uu1/gerard/scratch
# input reflection file (MTZ) # use full path name if not in your work directory set hklin=../hkl/eg1_36.mtz
# define labels in your input MTZ file # observed structure factor amplitude and its sigma set lab_fp='F' set lab_sf='SIGF'
# grid & map extent set grid="132 132 264" set ext="0 131 0 131 0 263"
# resolution limits set lores=8.0 set hires=3.6
# current mask file set mask=m13.mask
# spacegroup symmetry operators in "O" datablock file set sgs=p41212.sym
# current NCS operator(s) in "O" datablock files set opers='rt_unit.o rt_m10a_to_b.o'
# FFT symmetry set fftsym='1'
# the following is needed if you don't do your FFT in P1 set extend='/bin/false' set asu_ext='0 98 0 152 0 190'
# delete intermediate maps ? set delmap='/bin/false'
# end of user input ############################################
# say hello echo "" banner " R A V E" echo "" echo ... SINGLE-CRYSTAL AVERAGING RUN ... echo "" echo ... Version $version echo "" echo ... Started at $starttime ... echo ""
@ prev = $cycle - 1
# save some stuff set first_cycle=$cycle set last_cycle=$end
# # derive other file names automagically #
# various scratch files set scr1=$scrat/scr_{$myid}.R set scr2=$scrat/scr_scaled_{$myid}.R set scr3=$scrat/scr_{$myid}.E set scr4=$scrat/temp_{$myid}.E
# temporary input files set qqq={$myid}.tmp
# statistics file set stats=averaging_{$myid}_{$first_cycle}_to_{$last_cycle}.log cat > $stats << EOF
RAVE SINGLE-CRYSTAL AVERAGING RUN ID $myid CYCLES $first_cycle TO $last_cycle VERSION $version STARTED $starttime
EOF
echo "Cycle SFALL RSTATS FFT AVE" >> $stats echo " Nr RelInd Rover CCover Sigma CCs and Rs for operators" >> $stats echo "===== ====== ====== ====== ====== ========================" >> $stats
# catch interrupts onintr erreur
# echo input echo "... Overview of your input ................ " echo "" echo "... Id .................................... " $myid echo "... First cycle will be number ............ " $cycle echo "... Final cycle will be number ............ " $end echo "... Scratch directory ..................... " $scrat echo "... Input MTZ file ........................ " $hklin echo "... Labels for Fobs and Sigma(Fobs) ....... " $lab_fp $lab_sf echo "... Resolution limits (A) ................. " $lores $hires echo "... Grid to use for SF and MAP calcns ..... " $grid echo "... Extent of output MAPs ................. " $ext echo "... FFT spacegroup ........................ " $fftsym echo "... Current mask file ..................... " $mask echo "... Spacegroup operator file (O-style) .... " $sgs foreach x ($opers) echo "... NCS operator file (O-style) ........... " $x end
if ($extend == "/bin/true") then echo "... You want to extend the maps" echo "... Extend of ASU plus a few points ....... " $asu_ext else echo "... You do not want to extend the maps" endif
if ($delmap == "/bin/true") then echo "... You want to delete intermediate maps" else echo "... You do not want to delete intermediate maps" endif echo ""
set exit_status='0'
# major loop starts here looper:
echo "" banner " Cycle $cycle" echo "" echo ... starting cycle $myid $cycle ... echo ""
# input map from previous cycle set inmap=$scrat/{$myid}_{$prev}.E
# remove scratch files from previous cycle if (-e $scr1) \rm $scr1 if (-e $scr2) \rm $scr2 if (-e $scr3) \rm $scr3 if (-e $scr4) \rm $scr4
# log files set logfi=$scrat/rstats_{$myid}_{$cycle}.log set logav=$scrat/ave_{$myid}_{$cycle}.log set logsf=$scrat/sfall_{$myid}_{$cycle}.log set logft=$scrat/fft_{$myid}_{$cycle}.log set logex=$scrat/extend_{$myid}_{$cycle}.log
# output map from this cycle set outmap=$scrat/{$myid}_{$cycle}.E
# check if files (still) exist
if (! (-e $hklin) ) then echo ... ERROR ... echo ... reflection file $hklin does not exist echo ... ERROR ... goto tyvaer endif
if (! (-e $inmap) ) then echo ... ERROR ... echo ... previous map $inmap does not exist echo ... ERROR ... goto tyvaer endif
if (! (-e $mask) ) then echo ... ERROR ... echo ... mask file $mask does not exist echo ... ERROR ... goto tyvaer endif
if (! (-e $sgs) ) then echo ... ERROR ... echo ... spacegroup symmetry operator file $sgs does not exist echo ... ERROR ... goto tyvaer endif
foreach fil ($opers) if (! (-e $fil) ) then echo ... ERROR ... echo ... NCS symmetry operator file $fil does not exist echo ... ERROR ... goto tyvaer endif end
# calculate structure factors
echo '... starting SFALL - structure factor calculation'
cat > $qqq << EOF TITLE This is to produce calculated F, PHI MODE SFCALC MAPIN HKLIN RESOLUTION $lores $hires SFSGRP $fftsym BINS 40 RSCB $lores $hires GRID $grid BADD 0 NGAU 2 FORM C H N O S P LABIN FP=$lab_fp SIGFP=$lab_sf LABOUT FC=FCALC PHIC=PHICALC END EOF
sfall HKLIN $hklin MAPIN $inmap HKLOUT $scr1 > $logsf < $qqq
set x=`grep "Overall Reliability index is" $logsf` echo $x grep -i error $logsf set relind=`echo $x | cut -d" " -f5`
# delete map UNLESS first or last cycle if ($delmap == "/bin/true") then if ($cycle != $first_cycle && $cycle != $last_cycle) then if (-e $inmap) /bin/rm $inmap endif endif
# Scale the F's together
echo '... starting RSTATS - scaling Fobs and Fcalc'
if (! (-e $scr1) ) then echo ... ERROR ... echo ... new reflection file $scr1 with Fcalc does not exist echo ... ERROR ... goto tyvaer endif
cat > $qqq << EOF TITLE scale Fobs and Fcalc together and get statistics PROCESS FCAL SCALE 1.0 OUTPUT ASIN LABIN FP=$lab_fp SIGFP=$lab_sf FC=FCALC PHIC=PHICALC RESOLUTION $lores $hires WIDTH_OF_BINS RTHETA=0.01 FBINR=500 PRINT ALL CYCLES 5 LIST 1000000 WEIGHTING_SCHEME NONE EOF
rstats HKLIN $scr1 HKLOUT $scr2 > $logfi < $qqq
cp $scr2 $scrat/last_phases_{$myid}.R
set x=`grep "Overall Totals:" $logfi | tail -1` echo $x grep -i error $logfi set rover=`echo $x | cut -d" " -f4` set ccover=`echo $x | cut -d" " -f11`
# Calculate a new 2Fo-Fc map
echo '... starting FFT - calculating a new map'
if (! (-e $scr2) ) then echo ... ERROR ... echo ... scaled reflection file $scr2 does not exist echo ... ERROR ... goto tyvaer endif
cat > $qqq << EOF TITLE new 2Fo-Fc map RESOLUTION $lores $hires SCALE F1 2.0 0.0 SCALE F2 1.0 0.0 FFTSYMMETRY $fftsym GRID $grid XYZLIMIT $ext LABIN F1=$lab_fp SIG1=$lab_sf F2=FCALC SIG2=$lab_sf PHI=PHICALC RHOLIM 100.0 EOF
fft HKLIN $scr2 MAPOUT $scr3 > $logft < $qqq
set x=`grep "Rms deviation from mean density ................." $logft` echo $x grep -i error $logft set sigma=`echo $x | cut -d" " -f7 | cut -c1-7`
# extend map if required
if ($extend == "/bin/true") then
echo '... starting EXTEND - extending the new map'
if (! (-e $scr3) ) then echo ... ERROR ... echo ... new map file $scr3 does not exist echo ... ERROR ... goto tyvaer endif
cat > $qqq << EOF XYZLIM $asu_ext EOF
extend MAPIN $scr3 MAPOUT $scr4 < $qqq > $logex
set x=`grep "Rms deviation from mean density ................." $logex | tail -1` echo $x grep -i error $logex
if (-e $scr4) then mv $scr4 $scr3 else echo ... ERROR ... echo ... extended map $scr4 not created echo ... ERROR ... goto tyvaer endif
endif
# average the new map
echo '... starting AVE - averaging the density'
if (! (-e $scr3) ) then echo ... ERROR ... echo ... new map file $scr3 does not exist echo ... ERROR ... goto tyvaer endif
echo Both average and expand > $qqq echo $scr3 >> $qqq echo $mask >> $qqq echo $outmap >> $qqq echo $sgs >> $qqq foreach fil ($opers) echo $fil >> $qqq end echo " " >> $qqq
# /nfs/public/ALPHA/bin/VIRUS_AVE -b < $qqq >& $logav run ave -b < $qqq >& $logav
grep "Corr. coeff. for operator" $logav grep "R-factor for operator" $logav grep "Rms deviation from mean =" $logav grep -i error $logav grep -i warning $logav
@ cnt = 0 set ccopers=" " set rfopers=" " foreach x ($opers) @ cnt ++ set x=`grep "Corr. coeff. for operator" $logav | head -{$cnt} | tail -1` set y=`echo $x | cut -d" " -f7 | cut -c1-5` set ccopers=`echo -n $ccopers $y ` set x=`grep "R-factor for operator" $logav | head -{$cnt} | tail -1` set y=`echo $x | cut -d" " -f9 | cut -c1-5` set rfopers=`echo -n $rfopers $y ` end
if (! (-e $outmap) ) then echo ... ERROR ... echo ... averaged map file $outmap not created echo ... ERROR ... goto tyvaer endif
ls -FartCos $outmap
# add to statistics file echo "$cycle $relind $rover $ccover $sigma $ccopers $rfopers" >> $stats
# DO ANOTHER CYCLE ?
@ cycle ++
if ($cycle > $end) goto finalbits
@ prev = $cycle - 1
goto looper
finalbits:
# 950211 - final bits added
@ cycle --
# log files set logav=$scrat/ave_extract_{$myid}_{$cycle}.log set logm1=$scrat/2fofc_mappage_{$myid}_{$cycle}.log set logft=$scrat/fofc_{$myid}_{$cycle}.log set loga2=$scrat/fofc_extract_{$myid}_{$cycle}.log set logm2=$scrat/fofc_mappage_{$myid}_{$cycle}.log
# output maps from this step set finmap=$scrat/{$myid}_{$cycle}.xE set diffmap=$scrat/fofc_{$myid}_{$cycle}.E set difamap=$scrat/fofc_{$myid}_{$cycle}.xE set finomap=$scrat/{$myid}_{$cycle}.map set finamap=$scrat/fofc_{$myid}_{$cycle}.map
# get final map inside the mask
echo "" echo '... starting AVE - extracting final 2Fo-Fc map inside mask'
if (! (-e $outmap) ) then echo ... ERROR ... echo ... new map file $outmap does not exist echo ... ERROR ... goto tyvaer endif
set unit=`echo $opers | cut -d' ' -f1` echo Average only > $qqq echo $outmap >> $qqq echo $mask >> $qqq echo $finmap >> $qqq echo $sgs >> $qqq echo $unit >> $qqq echo " " >> $qqq
# /nfs/public/ALPHA/bin/VIRUS_AVE -b < $qqq >& $logav run ave -b < $qqq >& $logav
grep "Corr. coeff. for operator" $logav grep "R-factor for operator" $logav grep "Rms deviation from mean =" $logav grep -i error $logav grep -i warning $logav
# mappage final map inside the mask
echo "" echo '... starting MAPMAN - mappaging the final extracted 2Fo-Fc map'
if (! (-e $finmap) ) then echo ... ERROR ... echo ... new map file $finmap does not exist echo ... ERROR ... goto tyvaer endif
echo read m1 $finmap ccp4 > $qqq echo mappage m1 $finomap >> $qqq echo quit >> $qqq
# /nfs/public/ALPHA/bin/VIRUS_MAPMAN -b < $qqq >& $logm1 run mapman -b < $qqq >& $logm1
# calculate difference map with the final averaged phases
echo "" echo '... starting FFT - calculating an Fo-Fc map with the final phases'
if (! (-e $scr2) ) then echo ... ERROR ... echo ... scaled reflection file $scr2 does not exist echo ... ERROR ... goto tyvaer endif
cat > $qqq << EOF TITLE Fo-Fc map with averaged, solvent-flattened phases RESOLUTION $lores $hires SCALE F1 1.0 0.0 SCALE F2 1.0 0.0 FFTSYMMETRY $fftsym GRID $grid XYZLIMIT $ext LABIN F1=$lab_fp SIG1=$lab_sf F2=FCALC SIG2=$lab_sf PHI=PHICALC RHOLIM 100.0 EOF
fft HKLIN $scr2 MAPOUT $diffmap > $logft < $qqq
set x=`grep "Rms deviation from mean density ................." $logft` echo $x grep -i error $logft
# extract the new map
echo "" echo '... starting AVE - extracting the Fo-Fc map'
if (! (-e $diffmap) ) then echo ... ERROR ... echo ... new map file $diffmap does not exist echo ... ERROR ... goto tyvaer endif
set unit=`echo $opers | cut -d' ' -f1` echo Average only > $qqq echo $diffmap >> $qqq echo $mask >> $qqq echo $difamap >> $qqq echo $sgs >> $qqq echo $unit >> $qqq echo " " >> $qqq
# /nfs/public/ALPHA/bin/VIRUS_AVE -b < $qqq >& $loga2 run ave -b < $qqq >& $loga2
grep "Corr. coeff. for operator" $loga2 grep "R-factor for operator" $loga2 grep "Rms deviation from mean =" $loga2 grep -i error $loga2 grep -i warning $loga2
# mappage final difference map inside the mask
echo "" echo '... starting MAPMAN - mappaging the final extracted Fo-Fc map'
if (! (-e $difamap) ) then echo ... ERROR ... echo ... new map file $difamap does not exist echo ... ERROR ... goto tyvaer endif
echo read m1 $difamap ccp4 > $qqq echo mappage m1 $finamap >> $qqq echo quit >> $qqq
# /nfs/public/ALPHA/bin/VIRUS_MAPMAN -b < $qqq >& $logm2 run mapman -b < $qqq >& $logm2
# all done; just clean up
done:
echo ""
# remove scratch files from last cycle if (-e $scr1) \rm $scr1 if (-e $scr2) \rm $scr2 if (-e $scr3) \rm $scr3 if (-e $scr4) \rm $scr4
set stoptime=`date`
echo "" echo ... Started at $starttime ... echo ... Finished at $stoptime ... echo "" ls -FartCos $scrat echo ""
echo "" >> $stats echo "FINISHED $stoptime" >> $stats echo "" >> $stats
echo "" banner "STATISTICS" echo "" cat $stats echo ""
set x=`hostname` set y=`grep $x /etc/hosts` set x=`whoami`
# mail user when done cat > $qqq << EOF Rave Single-Crystal Averaging Run Finished Version $version Run by $x On machine $y From $starttime Until $stoptime First cycle $first_cycle Last cycle $last_cycle Exit status (0=OKAY) $exit_status
EOF
cat $stats >> $qqq mail $x < $qqq /bin/rm $qqq
exit $exit_status
# interrupt trap erreur: echo "" echo "... ERROR - process interrupted" echo "" set exit_status='-9' goto done
# error trap tyvaer: echo "" echo "... Alas, a FATAL error ..." echo "" set exit_status='-1' goto done
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
IMPORTANT: use CRAVE to auto-generate a C-shell script if you want to do multiple crystal averaging (single-domain only) !!! See the CRAVE manual for details.
The following scripts were written for lipase; reference crystal is P21; additional crystal is P212121. First, two "master scripts" are given, then the individual scripts executed by the master scripts.
Note that in between two cycles only TWO lines have to be edited in p21_cycle.com and p212121_cycle.com, and five lines in comex.com !!
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- #!/bin/csh -f cd /nfs/user1/gerard/lipasesource p21_av0.com source p212121_av0.com source comap0.com source p21_ex0.com source p212121_ex0.com exit 0 ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- #!/bin/csh -f cd /nfs/user1/gerard/lipasesource p21_cycle.com source p212121_cycle.com source comex.com exit 0 ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- MAVE -b << EOF > p21_av0.log average p21_start.E p21_start.mask rt_unit.o p21.sym rt_unit.o p21_a_to_b.op21_start.E /nfs/scratch/gerard/p21_0x.E EOF ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- MAVE -b << EOF > p212121_av0.log average p212121_start.E p21_start.mask p21_to_p212121.o p212121.sym rt_unit.o/nfs/scratch/gerard/p21_0x.E /nfs/scratch/gerard/p212121_0x.E EOF ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- COMAP -b << EOF > comap0.log /nfs/scratch/gerard/p21_0x.E 2.0 2 * NCS for P21 /nfs/scratch/gerard/p212121_0x.E 1.0 no NCS for P212121/nfs/scratch/gerard/comap_0x.E EOF ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- MAVE -b << EOF > p21_ex0.log expand /nfs/scratch/gerard/comap_0x.E p21_start.mask rt_unit.o p21.sym p21.sym rt_unit.o p21_a_to_b.op21_start.E /nfs/scratch/gerard/p21_1.E EOF ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- MAVE -b << EOF > p212121_ex0.log expand /nfs/scratch/gerard/comap_0x.E p21_start.mask p21_to_p212121.o p21.sym p212121.sym rt_unit.op212121_start.E /nfs/scratch/gerard/p212121_1.E EOF ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- #!/bin/csh -f # # This script carries out one cycle of averaging. # It requires an averaged map as input and a suitable reflection file. # The output is a new averaged map.# modified by GJK @ 920903, 930127, 930308, 930329
# set echo
# change the following symbols as appropriate
# set up for CCP4 on SGIs source /nfs/public/IRIX/ccp4/include/ccp4.setup
# go to YOUR work directory cd /nfs/user1/gerard/lipase
# new cycle id set cycle=p21_1c
# previous cycle id set prev=p21_1
# current mask file set mask=p21_start.mask
# current symmetry & NCS operator(s) set symop=p21.sym set oper1=rt_unit.o set oper2=p21_a_to_b.o
# scratch directory set scrat=/nfs/scratch/gerard
# reflection file (MTZ) set hklin=p21.mtz
# average executable set avexe=/home/gerard/progs/average/MAVE
# # derive other file names automagically #
set inmap=$scrat/$prev.E set scr1=$scrat/scr.R set scr2=$scrat/scr_scaled.R set scr3=$scrat/scr.E set logfi=rstats_$cycle.log set logav=mave_$cycle.log set outmap=$scrat/$cycle.E
# check if files exist
if (! (-e $hklin) ) then echo ... ERROR ... echo ... reflection file $hklin does not exist echo ... ERROR ... exit -1 endif
if (! (-e $inmap) ) then echo ... ERROR ... echo ... previous map $inmap does not exist echo ... ERROR ... exit -1 endif
if (! (-e $mask) ) then echo ... ERROR ... echo ... mask file $mask does not exist echo ... ERROR ... exit -1 endif
if (! (-e $oper1) ) then echo ... ERROR ... echo ... symmetry operator file $oper1 does not exist echo ... ERROR ... exit -1 endif
if (! (-e $oper2) ) then echo ... ERROR ... echo ... symmetry operator file $oper2 does not exist echo ... ERROR ... exit -1 endif
# calculate structure factors
echo '... starting averaging cycle ' $cycle ' ...' echo '... starting SFALL - structure factor calculation'
sfall HKLIN $hklin MAPIN $inmap \ HKLOUT $scr1 > sfall_$cycle.log <<'SFALL EOF' ! TITLE This is to produce calculated F, PHI MODE SFCALC MAPIN HKLIN RESOLUTION 3.0 8.0 ! (RMIN,RMAX) SFSGRP 1 ! (FFT space group) BINS 40 ! (number of resol bins) RSCB 3.0 8.0 ! (resol. range for scaling) GRID 70 48 88 ! (NX NY NZ) LABIN FP=F SIGFP=SIGF LABOUT FC=FCALC PHIC=PHICALC END 'SFALL EOF'
# Scale the F's together
echo '... starting RSTATS - scaling Fobs and Fcalc'
if (! (-e $scr1) ) then echo ... ERROR ... echo ... new reflection file $scr1 with Fcalc does not exist echo ... ERROR ... exit -1 endif
rstats HKLIN $scr1 HKLOUT $scr2 \ << 'EOF-rstats' > $logfi ! TITLE Rstats of lipase P21, averaging PROCESS FCAL SCALE 1.0 OUTPUT ASIN LABIN FP=F SIGFP=SIGF FC=FCALC PHIC=PHICALC RESOLUTION 8.0 3.0 WIDTH_OF_BINS RTHETA=0.01 FBINR=500 CYCLES 5 LIST 1000000 WEIGHTING_SCHEME NONE 'EOF-rstats'
# Calculate a 2Fo-Fc map
fft:
echo '... starting FFT - calculating a new map'
if (! (-e $scr1) ) then echo ... ERROR ... echo ... scaled reflection file $scr2 does not exist echo ... ERROR ... exit -1 endif
fft HKLIN $scr2 \ MAPOUT $scr3 > fft_$cycle.log <<'FFT EOF' ! TITLE Map -2fo-fc - averaging RESOLUTION 3.0 8.0 ! (RMIN,RMAX) SCALE F1 2.0 0.0 ! (SCALE1,TF1) SCALE F2 1.0 0.0 ! (SCALE2,TF2) FFTSYMMETRY 1 ! (FFT space group) SYMMETRY 4 ! (real space group) GRID 70 48 88 ! (NX NY NZ) XYZLIMIT 0 70 0 48 0 88 ! (x,y,z limits) LABIN F1=F SIG1=SIGF F2=FCALC SIG2=FCALC PHI=PHICALC RHOLIM 100.0 ! limit density values 'FFT EOF'
# create the input file for MAVE
echo average > ave.inp echo $scr3 >> ave.inp echo $mask >> ave.inp echo rt_unit.o >> ave.inp echo $symop >> ave.inp echo $oper1 >> ave.inp echo $oper2 >> ave.inp echo " " >> ave.inp echo $scrat/p21_0x.E >> ave.inp echo $outmap >> ave.inp
# Average the density
echo '... starting AVERAGE - averaging the density'
if (! (-e $scr3) ) then echo ... ERROR ... echo ... new map file $scr3 does not exist echo ... ERROR ... exit -1 endif
$avexe < ave.inp > $logav
if (! (-e $outmap) ) then echo ... ERROR ... echo ... averaged map file $outmap not created echo ... ERROR ... exit -1 endif
ls -FartCos $outmap
exit 0 ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- #!/bin/csh -f # # This script carries out one cycle of averaging. # It requires an averaged map as input and a suitable reflection file. # The output is a new averaged map.# modified by GJK @ 920903, 930127, 930308, 930329
# set echo
# change the following symbols as appropriate
# set up for CCP4 on SGIs source /nfs/public/IRIX/ccp4/include/ccp4.setup
# go to YOUR work directory cd /nfs/user1/gerard/lipase
# new cycle id set cycle=p212121_1c
# previous cycle id set prev=p212121_1
# current mask file set mask=p21_start.mask
# current symmetry & NCS operator(s) & ORTHO-to-ORTHO operator set symop=p212121.sym set oper1=rt_unit.o set or2or=p21_to_p212121.o
# scratch directory set scrat=/nfs/scratch/gerard
# reflection file (MTZ) set hklin=p212121.mtz
# average executable set avexe=/home/gerard/progs/average/MAVE
# # derive other file names automagically #
set inmap=$scrat/$prev.E set scr1=$scrat/scr.R set scr2=$scrat/scr_scaled.R set scr3=$scrat/scr.E set logfi=rstats_$cycle.log set logav=mave_$cycle.log set outmap=$scrat/$cycle.E
# check if files exist
if (! (-e $hklin) ) then echo ... ERROR ... echo ... reflection file $hklin does not exist echo ... ERROR ... exit -1 endif
if (! (-e $inmap) ) then echo ... ERROR ... echo ... previous map $inmap does not exist echo ... ERROR ... exit -1 endif
if (! (-e $mask) ) then echo ... ERROR ... echo ... mask file $mask does not exist echo ... ERROR ... exit -1 endif
if (! (-e $oper1) ) then echo ... ERROR ... echo ... symmetry operator file $oper1 does not exist echo ... ERROR ... exit -1 endif
# calculate structure factors
echo '... starting averaging cycle ' $cycle ' ...' echo '... starting SFALL - structure factor calculation'
sfall HKLIN $hklin MAPIN $inmap \ HKLOUT $scr1 > sfall_$cycle.log <<'SFALL EOF' ! TITLE This is to produce calculated F, PHI MODE SFCALC MAPIN HKLIN RESOLUTION 3.0 8.0 ! (RMIN,RMAX) SFSGRP 1 ! (FFT space group) BINS 40 ! (number of resol bins) RSCB 3.0 8.0 ! (resol. range for scaling) GRID 60 48 90 ! (NX NY NZ) LABIN FP=F SIGFP=SIGF LABOUT FC=FCALC PHIC=PHICALC END 'SFALL EOF'
# Scale the F's together
echo '... starting RSTATS - scaling Fobs and Fcalc'
if (! (-e $scr1) ) then echo ... ERROR ... echo ... new reflection file $scr1 with Fcalc does not exist echo ... ERROR ... exit -1 endif
rstats HKLIN $scr1 HKLOUT $scr2 \ << 'EOF-rstats' > $logfi ! TITLE Rstats of lipase P212121, averaging PROCESS FCAL SCALE 1.0 OUTPUT ASIN LABIN FP=F SIGFP=SIGF FC=FCALC PHIC=PHICALC RESOLUTION 8.0 3.0 WIDTH_OF_BINS RTHETA=0.01 FBINR=500 CYCLES 5 LIST 1000000 WEIGHTING_SCHEME NONE 'EOF-rstats'
# Calculate a 2Fo-Fc map
fft:
echo '... starting FFT - calculating a new map'
if (! (-e $scr1) ) then echo ... ERROR ... echo ... scaled reflection file $scr2 does not exist echo ... ERROR ... exit -1 endif
fft HKLIN $scr2 \ MAPOUT $scr3 > fft_$cycle.log <<'FFT EOF' ! TITLE Map -2fo-fc - averaging RESOLUTION 3.0 8.0 ! (RMIN,RMAX) SCALE F1 2.0 0.0 ! (SCALE1,TF1) SCALE F2 1.0 0.0 ! (SCALE2,TF2) FFTSYMMETRY 1 ! (FFT space group) SYMMETRY 19 ! (real space group) GRID 60 48 90 ! (NX NY NZ) XYZLIMIT 0 60 0 48 0 90 ! (x,y,z limits) LABIN F1=F SIG1=SIGF F2=FCALC SIG2=FCALC PHI=PHICALC RHOLIM 100.0 ! limit density values 'FFT EOF'
# create the input file for MAVE
echo average > ave.inp echo $scr3 >> ave.inp echo $mask >> ave.inp echo $or2or >> ave.inp echo $symop >> ave.inp echo $oper1 >> ave.inp echo " " >> ave.inp echo $scrat/p21_0x.E >> ave.inp echo $outmap >> ave.inp
# Average the density
echo '... starting AVERAGE - averaging the density'
if (! (-e $scr3) ) then echo ... ERROR ... echo ... new map file $scr3 does not exist echo ... ERROR ... exit -1 endif
$avexe < ave.inp > $logav
if (! (-e $outmap) ) then echo ... ERROR ... echo ... averaged map file $outmap not created echo ... ERROR ... exit -1 endif
ls -FartCos $outmap
exit 0 ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- #!/bin/csh -f ## go to YOUR work directory cd /nfs/user1/gerard/lipase
# scratch directory set scrat=/nfs/scratch/gerard
set mask=p21_start.mask set unit=rt_unit.o
set c1old=p21_5c.E set c1new=p21_6.E set c2old=p212121_5c.E set c2new=p212121_6.E set combi=5x
# the following symbols shouldn't change set sym1=p21.sym set ncs1=2 set rt11=rt_unit.o set rt12=p21_a_to_b.o set c1ex=p21_1.E
set or2or=p21_to_p212121.o
set sym2=p212121.sym set ncs2=1 set rt21=rt_unit.o set c2ex=p212121_1.E
# derive other file names
set newmap=comap_$combi.E
# create input file for COMAP
echo $scrat/$c1old > comap.inp echo $ncs1 >> comap.inp echo $scrat/$c2old >> comap.inp echo $ncs2 >> comap.inp echo " " >> comap.inp echo $scrat/$newmap >> comap.inp
# run COMAP
COMAP -b < comap.inp > comap.log
# expand reference crystal form
echo expand > mave1.inp echo $scrat/$newmap >> mave1.inp echo $mask >> mave1.inp echo $unit >> mave1.inp echo $sym1 >> mave1.inp echo $sym1 >> mave1.inp echo $rt11 >> mave1.inp echo $rt12 >> mave1.inp echo " " >> mave1.inp echo $scrat/$c1ex >> mave1.inp echo $scrat/$c1new >> mave1.inp
MAVE -b < mave1.inp > mave1.log
# expand additional crystal form
echo expand > mave2.inp echo $scrat/$newmap >> mave2.inp echo $mask >> mave2.inp echo $or2or >> mave2.inp echo $sym1 >> mave2.inp echo $sym2 >> mave2.inp echo $rt21 >> mave2.inp echo " " >> mave2.inp echo $scrat/$c2ex >> mave2.inp echo $scrat/$c2new >> mave2.inp
MAVE -b < mave2.inp > mave2.log
exit 0 ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----
The following C-shell script can be used for iterative skeletonisation with RAVE and CCP4 programs. We haven't obtained any spectacular results with it, but you're welcome to give it a try. Please report your experiences to "gerard@xray.bmc.uu.se".
----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- #!/bin/csh -falias run '/home/gerard/bin/run'
# do N cycles of iterative skeletonisation with RAVE/CCP4 # includes error checks to test if the appropriate files # exist or have been generated
# Gerard J. Kleywegt @ 931001,04,05,06,07 # E-mail: "gerard@xray.bmc.uu.se"
# edit this file, then execute with: # script_name | tee rave.log # or # nohup script_name >& rave.log &
# MIR version (includes phase-combination step and # optional solvent flattening) # can also be used for Molecular Replacement
set version='mir_molrep_iterskel_flatten @ 931007 / gj kleywegt' set starttime=`date`
# set echo
# IMPORTANT: when you start RAVE-ing, a map file called # "$scrat/{$myid}_{$prev}.E" MUST exist ! # EXAMPLE: if your scratch directory is $SCR, # your id is "model1" and the previous # cycle number is "0", then the map file # $SCR/model1_0.E must exist
# change the following symbols as appropriate
# re-assign CCP4 scratch areas (not necessary) setenv CCP4_SCR /nfs/alien/gerard/scratch/lipase setenv BINSORT_SCR /nfs/alien/gerard/scratch/binsort
# go to YOUR work directory cd /nfs/alien/gerard/dirs/lipase
# set id (e.g., the ID of this macro-cycle) set myid=ortho
# NEXT cycle NUMBER @ cycle = 1 # note that a map with ($cycle - 1) in the name MUST exist # see "IMPORTANT" note above
# final cycle nr (I.E.: NOT THE NUMBER OF CYCLES !!!) @ end = 1
# scratch directory (where map, scratch and log files go to) set scrat=/nfs/alien/gerard/scratch/lipase
# set to '/bin/true' for MIR, '/bin/false' for Mol Rep set mir='/bin/true'
# input reflection file (MTZ) # use full path name if not in your work directory set hklin=ortho.mtz
# grid & map extent # 1 A set grid="60 48 90" set grid="84 64 120" set ext="0 83 0 63 0 119"
# define labels in your input MTZ file # observed structure factor amplitude and its sigma set lab_fp='FP' set lab_sf='SIGFP' # your squash or mir or whatever phase and its figure-of-merit # not needed for Mol Repl set lab_ph='PHI' set lab_fm='FOM'
# resolution limits set lores=10.0 set hires=3.0
# skeletonisation parameters # sigma of INPUT map (add zeroes for increased precision) set sigma='0.20823' # base level for skeletonisation IN SIGMAS (add zeroes) set base='1.2000' # step level for skeletonisation IN SIGMAS (add zeroes) set step='0.500' # minimum length for main-chain fragments set mclength='8' # uniform temperature factor for all BONES atoms set bfac='5.0'
# the following is for solvent flattening set flatten='/bin/false' # if flatten is NOT equal to "/bin/true" the following lines # don't matter set mama_cell='62.1 46.7 92.1 90.0 90.0 90.0' set mama_rad='3.5' # note: make the extent 4 points smaller than your unit cell set mama_ext='56 44 86' # note: since we only do solvent flattening in the whole # unit cell, we need only the unit operator, both # for the spacegroup symmetry & for the NCS symmetry # use full path names if not in your work directory set spcgrp='rt_unit.o' set rtunit='rt_unit.o'
# end of user input
# say hello echo "" banner " R A V E" echo "" echo ... ITERATIVE SKELETONISATION RUN ... echo "" echo ... Version $version echo "" echo ... Started at $starttime ... echo ""
@ prev = $cycle - 1
# save some stuff set first_cycle=$cycle set last_cycle=$end
# NOTE: if you change the FFT symmetry, you probably # have to make more changes in this script set fftsym='1'
# # derive other file names automagically #
# BONES PDB & mask file set bones=$scrat/{$myid}_bones.pdb set bones_mask=$scrat/{$myid}_bones.mask
# various scratch files set scr1=$scrat/scr1_{$myid}.R set scr2=$scrat/scr2_{$myid}.R set scr3=$scrat/scr3_{$myid}.R set scr4=$scrat/scr4_{$myid}.R
# temporary input files set qqq={$myid}.tmp
# scratch map for solvent flattening set scrmap=$scrat/scr_{$myid}.E
# catch interrupts onintr erreur
# echo input echo "... Overview of your input ................ " echo "" echo "... Id .................................... " $myid echo "... First cycle will be number ............ " $cycle echo "... Final cycle will be number ............ " $end echo "... Scratch directory ..................... " $scrat echo "... Input MTZ file ........................ " $hklin echo "... Labels for Fobs and Sigma(Fobs) ....... " $lab_fp $lab_sf echo "... Resolution limits (A) ................. " $lores $hires echo "... Grid to use for SF and MAP calcns ..... " $grid echo "... Extent of output MAPs ................. " $ext echo "... Skeletonisation base and step (SIGMA) . " $base $step echo "... Min main-chain length for BONES ....... " $mclength echo "... Temperature factor for BONES atoms .... " $bfac echo "... Latest BONES PDB file will always be .. " $bones echo ""
if ($mir == "/bin/true") then echo "... You want to combine calculated and MIR phases" echo "... Labels for MIR Phi and FOM(Phi) ....... " $lab_ph $lab_fm else echo "... You are doing a Molecular Replacement run" endif echo ""
if ($flatten == "/bin/true") then echo "... You want to include solvent flattening" echo "... Masks are generated by MAMA with cell . " $mama_cell echo "... Radius around BONES atoms to mask (A) . " $mama_rad echo "... Extent of the intermediate mask ....... " $mama_ext echo "... Spacegroup operators (O style) ........ " $spcgrp echo "... Dummy (unit) NCS operator (O style) ... " $rtunit echo "... Name of BONES mask file will be ....... " $bones_mask echo "... Intermediate scratch map .............. " $scrmap else echo "... You do not want to include solvent flattening" endif echo ""
set exit_status='0'
# major loop starts here looper:
echo "" banner " $cycle" echo "" echo ... starting cycle $myid $cycle ... echo ""
# input map from previous cycle set inmap=$scrat/{$myid}_{$prev}.E
# remove scratch files from previous cycle if (-e $scr1) \rm $scr1 if (-e $scr2) \rm $scr2 if (-e $scr3) \rm $scr3 if (-e $scr4) \rm $scr4
# log files set logfi=$scrat/rstats_{$myid}_{$cycle}.log set logmp=$scrat/mapman_{$myid}_{$cycle}.log set logsf=$scrat/sfall_{$myid}_{$cycle}.log set logmu=$scrat/mtzutils_{$myid}_{$cycle}.log set logsa=$scrat/sigmaa_{$myid}_{$cycle}.log set logft=$scrat/fft_{$myid}_{$cycle}.log set logma=$scrat/mama_{$myid}_{$cycle}.log set logav=$scrat/ave_{$myid}_{$cycle}.log
# output map from this cycle set outmap=$scrat/{$myid}_{$cycle}.E
# check if files exist
if (! (-e $hklin) ) then echo ... ERROR ... echo ... reflection file $hklin does not exist echo ... ERROR ... exit -1 endif
if (! (-e $inmap) ) then echo ... ERROR ... echo ... previous map $inmap does not exist echo ... ERROR ... exit -1 endif
# skeletonise your map # (note: at present you have to skeletonise the entire map, # i.e., you can't "mask out" your known partial structure)
echo '... starting MAPMAN - map skeletonisation'
# calculate new base level ($base * $sigma) # uses 'dc', a Unix desk calculator echo $sigma > $qqq echo $base >> $qqq echo '*' >> $qqq echo p >> $qqq set nbase=`dc < $qqq`
# calculate new step level ($step * $sigma) # uses 'dc', a Unix desk calculator echo $sigma > $qqq echo $step >> $qqq echo '*' >> $qqq echo p >> $qqq set nstep=`dc < $qqq`
cat > $qqq << EOF read m1 $inmap ccp4 bon skele m1 $nbase $nstep 0 bon prune $bones $mclength $bfac bon conne $scrat/bones.odb itskl $mclength bon ? quit EOF
echo ... sigma = $sigma echo ... base = $nbase echo ... step = $nstep
run mapman -b < $qqq > $logmp
grep 'Nr :' $logmp | head -1
# delete map UNLESS first or last cycle if ($cycle != $first_cycle && $cycle != $last_cycle) then if (-e $inmap) /bin/rm $inmap endif
# calculate structure factors
echo '... starting SFALL - structure factor calculation'
# NOTE: change SFSGRP as required
cat > $qqq << EOF TITLE This is to produce calculated F, PHI MODE SFCALC XYZIN HKLIN RESOLUTION $lores $hires SFSGRP $fftsym BINS 40 RSCB $lores $hires GRID $grid BADD 0 NGAU 2 FORM C H N O S P LABIN FP=$lab_fp SIGFP=$lab_sf LABOUT FC=FC PHIC=PHIC END EOF
sfall HKLIN $hklin XYZIN $bones HKLOUT $scr1 > $logsf < $qqq
grep "Overall Reliability index is" $logsf grep -i error $logsf
# Scale the F's together
echo '... starting RSTATS - scaling Fobs and Fcalc'
if (! (-e $scr1) ) then echo ... ERROR ... echo ... new reflection file $scr1 with Fcalc does not exist echo ... ERROR ... exit -1 endif
cat > $qqq << EOF TITLE scale Fobs and Fcalc together and get statistics PROCESS FCAL SCALE 1.0 OUTPUT ASIN LABIN FP=$lab_fp SIGFP=$lab_sf FC=FC PHIC=PHIC RESOLUTION $lores $hires WIDTH_OF_BINS RTHETA=0.01 FBINR=500 PRINT ALL CYCLES 5 LIST 1000000 WEIGHTING_SCHEME NONE EOF
rstats HKLIN $scr1 HKLOUT $scr2 > $logfi < $qqq
grep "Overall Totals:" $logfi | tail -1 grep -i error $logfi
# do MTZ combination
if ($mir != "/bin/true") goto molrep
echo '... starting MTZUTILS - combining MTZ files'
if (! (-e $scr2) ) then echo ... ERROR ... echo ... scaled reflection file $scr2 does not exist echo ... ERROR ... exit -1 endif
cat > $qqq << EOF INCLUDE 1 ALL INCLUDE 2 $lab_ph $lab_fm RUN EOF
mtzutils HKLIN1 $scr2 HKLIN2 $hklin HKLOUT $scr3 > $logmu < $qqq
# do phase combination
echo '... starting SIGMAA - combining phases'
if (! (-e $scr3) ) then echo ... ERROR ... echo ... combined reflection file $scr3 does not exist echo ... ERROR ... exit -1 endif
cat > $qqq << EOF TITLE Phase combination of MOD and MIR phases RESOLUTION $lores $hires COMBINE RANGES 20 1000 LABI FP=$lab_fp SIGFP=$lab_sf - PHIBP=$lab_ph WP=$lab_fm - FC=FC PHIC=PHIC LABO PHCMB=PHCMB1 WCMB=MCMB1 - FWT=FWT1 PHWT=PHWT1 END EOF
sigmaa HKLIN $scr3 HKLOUT $scr4 > $logsa < $qqq
grep 'Overall Figures of Merit' $logsa grep 'CENTRIC ' $logsa
molrep: if ($mir != "/bin/true") then mv $scr2 $scr4 endif
# Calculate a new 2Fo-Fc map
echo '... starting FFT - calculating a new map'
if (! (-e $scr4) ) then echo ... ERROR ... echo ... (phase combined) reflection file $scr4 does not exist echo ... ERROR ... exit -1 endif
# NOTE: change FFTSYMMETRY as required
if ($mir == "/bin/true") then set use_label=PHCMB1 else set use_label=PHIC endif
cat > $qqq << EOF TITLE new 2Fo-Fc map RESOLUTION $lores $hires SCALE F1 2.0 0.0 SCALE F2 1.0 0.0 FFTSYMMETRY $fftsym GRID $grid XYZLIMIT $ext LABIN F1=$lab_fp SIG1=$lab_sf F2=FC SIG2=$lab_sf PHI=$use_label RHOLIM 100.0 EOF
fft HKLIN $scr4 MAPOUT $outmap > $logft < $qqq
grep "Rms deviation from mean density ................." $logft grep -i error $logft
# Rms deviation from mean density ................. 19.49101 #2345678-1-2345678-2-2345678-3-2345678-4-2345678-5-2345678-6-2345678-7-2345 set x=`grep "Rms deviation from mean density ................." $logft | cut -c61-75` if ($x != "") set sigma=$x echo ... New SIGMA = $sigma
if (! (-e $outmap) ) then echo ... ERROR ... echo ... new map file $outmap not created echo ... ERROR ... exit -1 endif
if ($flatten != "/bin/true") goto noflat
# generate mask from last bones PDB file
echo '... starting MAMA - calculating a BONES mask'
cat > $qqq << EOF new cell $mama_cell new grid $grid ! avoid the borders of the grid to prevent averaging errors new ori 2 2 2 new ext $mama_ext new make m1 ! make the mask new ori 0 0 0 new ext $grid new pad 1 1 1 new rad $mama_rad new pdb m2 $bones ! transfer it to the smaller mask and save it or m1 m2 new copy m3 m1 list m3 wr m3 $bones_mask com quit EOF
run mama -b < $qqq > $logma
grep 'Nr of points =' $logma
if (! (-e $bones_mask) ) then echo ... ERROR ... echo ... mask file $bones_mask not created echo ... ERROR ... exit -1 endif
# flatten solvent # (note: you might want to do a real averaging step here !)
echo '... starting AVE - flattening solvent'
cat > $qqq << EOF both average and expand $outmap $bones_mask $scrmap $spcgrp $rtunit
EOF
run ave -b < $qqq > $logav
if (! (-e $scrmap) ) then echo ... ERROR ... echo ... flattened map file $scrmap not created echo ... ERROR ... exit -1 endif
mv $scrmap $outmap
# done with this cycle noflat:
ls -FartCos $outmap
# DO ANOTHER CYCLE ?
@ cycle ++
if ($cycle > $end) goto done
@ prev = $cycle - 1
goto looper
done:
# remove scratch files from last cycle if (-e $scr1) \rm $scr1 if (-e $scr2) \rm $scr2 if (-e $scr3) \rm $scr3 if (-e $scr4) \rm $scr4
set stoptime=`date`
echo "" echo ... Started at $starttime ... echo ... Finished at $stoptime ... echo ""
ls -FartCos $scrat
set x=`hostname` set y=`grep $x /etc/hosts` set x=`whoami`
# mail gerard cat > $qqq << EOF Rave Iterative Skeletonisation Run Version $version By $x On $y From $starttime To $stoptime First $first_cycle Last $last_cycle Exit status $exit_status MIR $mir FLATTEN $flatten EOF mail gerard@xray.bmc.uu.se < $qqq /bin/rm $qqq
exit $exit_status
# interrupt trap erreur: echo "" echo "... ERROR - process interrupted" echo "" set exit_status='-9' goto done ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE ----- EXAMPLE -----