;
; ; SOURCE: spider/docs/techs/recon1/Procs/refine.spi ; New ArDean Leith Nov 2000 ; Rewritten ArDean Leith Mar 2004 ; [] variables ArDean Leith Dec 2005 ; Ampenhance ArDean Leith May 2006 ; More stacks ArDean Leith Dec 2006 ; Small angles limits ArDean Leith Oct 2010 ; pixsiz, resol headers,r2,... ArDean Leith Aug 2012 ; For CTF corrected images ArDean Leith Oct 2013 ; For gold standard reconstruction ArDean Leith May 2014 ; ; PURPOSE: Controls serial reconstruction refinement. This is master procedure for ; serial refinement over several iterations. Data may be in one or more groups. ; ; USAGE: clean ; ./spider spi/dat @refine ; ; I/O Registers and files are set in: refine-settings.spi ; ; VARIABLE REGISTERS: ; [pixsiz] Pixel size ; [r2] Radius of object ; [alignsh] Shift allowed is +- this value ; [prj-radius] Radius of object for projection ; [iter1] Starting iteration ; [iter-end] Ending iteration ; [smallang-yn] Small angle refinement flag (1 == true) ; ; INPUT FILES: ('***' denotes group here) ; [vol_orig] ../Reconstruction/vol_01 Initial volume file (one) ; [sel_group_orig] ../Reconstruction/input/bp_sel_group Group selection file (one) ; [sel_parts_orig] ../Reconstruction/input/bp_sel_part_*** Group particle selection files (one/group) ; [unaligned_images_orig] ../Reconstruction/input/bp_data_ctfd_*** Unaligned image stacks (one/group) ; ; PROCEDURES CALLED: ; refine-settings refine-settings.spi ; refine-show-r2 refine-show-r2.spi ; refine-setrefangles refine-setrefangles.spi ; pub-prjrefs pub-prjrefs.spi ; refine-loop refine-loop.spi ; refine-smangloop refine-smangloop.spi ; refine-bp refine-bp.spi ; merge-fsc-filt merge-fsc-filt.spi ; .. sphdecon sphdecon.spi ; .. enhance (optional) enhance.spi ; ; --------------------------------- END BATCH HEADER -------------------------- MD TR OFF ; Loop info turned off MD VB OFF ; File info turned off MD SET MP ; Use only one or two processors if using master node!! 0 ; Input initial parameters & file names but not angular steps @refine-settings([pixsiz],[r2],[alignsh],[prj-radius],[iter1],[iter-end],[sphdecon],[smallang-yn],[qsub],[incore-yn],[gold-std],[bp-type]) SYS echo -e " Alignment shift: {%I0%[alignsh]} Alignment radius: {%I0%[r2]}" SYS echo " Projection radius: {%I0%[prj-radius]}" ; echo SYS ; Create output directories if not present mkdir -p [out_dir] [work_dir] SD / ITERATION MASKED-RES RESOLUTION [iter_resol] ; Resolution doc file (output) SD E [iter_resol] ; Resolution doc file (finished) UD N [num-grps] ; Find number of groups [sel_group] ; Group selection file (input) IF ( [iter1] == 1 ) THEN ; Ensure that starting input files exist [iter] = 1 DO [s] = 1,2 ; Create subset volumes from initial model CP [vol_orig] ; Starting initial model == reference volume [vol_s] ; Starting subset reference volume ENDDO DO [grp] = 1,[num-grps] ; Must create odd and even particle selection lists for all groups DE [sel_parts]_s1 ; Odd particle selection doc file (removed) DE [sel_parts]_s2 ; Even particle selection doc file (removed) DOC SPLIT [sel_parts] ; Particle selection doc file (input) [sel_parts]_s1 ; Odd particle selection doc file (output) [sel_parts]_s2 ; Even particle selection doc file (output) ENDDO ENDIF ; Show alignment and projection radii on center slice of reference volume [s] = 1 !@refine-show-r2([r2],[alignsh],[prj-radius]) ! final/vol_01_s1 ; Reference volume IF ( [smallang-yn] == 1 ) THEN ; List desired offset angles for reference projections in a doc file. @refine-setrefangles([iter],[smallang-yn],[ampenhance],[ang-step],[ang-limit],[num-angs]) ENDIF DO [iter]=[iter1],[iter-end] ; Loop over all iterations ---------------------------------- IF ( [smallang-yn] == 0 ) THEN ; List desired angles ('VO EA') for reference projections in a doc file. @refine-setrefangles([iter],[smallang-yn],[ampenhance],[ang-step],[ang-limit],[num-angs]) ; Create reference projection stacks ('PJ 3F') from both subset reference volumes. @pub-prjrefs([iter],1,[prj-radius],[qsub]) ENDIF ; Process all groups serially one-by-one DO [grp] = 1,[num-grps] ; Loop over all groups ----------------- SYS echo ; echo -n " Iteration: {%I0%[iter]} Refining group: {%I4%[grp]} " ; date '+ TIME: %x %X' ; echo MY FL ; Flush results file IF ( [smallang-yn] == 0 ) THEN ; For regular angle alignment @refine-loop([ang-step],[ang-limit],[r2],[alignsh],[prj-radius],[iter],[grp],[pixsiz],[incore-yn],[bp-type],[iter-end]) ELSE ; For small angle alignment around a determined position @refine-smangloop([ang-step],[r2],[alignsh],[prj-radius],[iter],[grp]],[pixsiz],[bp-type],[iter-end]) ENDIF MY FL ; Flush results file ENDDO ; End of: Loop over all groups ------------------- UD E ; Finished with incore doc file ; Merge ('AS S') the group volumes into two subset output volumes, ; find resolution ('FSC') by comparing FSC of the two subsets, ; filter ('FD C') the combined volumes using FSC curve to limit resolution, ; merge ('AS S') the two subset output volumes into single overall output volume. @merge-fsc-filt([pixsiz],[iter],[ampenhance],[r2],[sphdecon],[gold-std],[qsub]) SYS echo " Iteration: {%I0%[iter]} Finished" ; echo MY FL ; Flush results ENDDO ; End of loop over all iterations ---------------------------- SYS ; Echo current time echo -n " Refinement finished after iteration: {**[iter]} " ; date '+ TIME: %x %X' ; echo EN ;