Miscellaneous Commands: Carry out various SPARX commands on image series, and generate data and initialize database for demo script.
Usage in command line
sp_process.py inputfile outputfile micrograph_prefix --order --order_lookup --order_metropolis --order_pca --initial=INITIAL --circular --radius=RADIUS --changesize --ratio=RATIO --pw --wn=WN --phase_flip --makedb=param1=value1:param2=value2 --generate_projections=param1=value1:param2=value2 --isacgroup=ISACGROUP --isacselect --params=PARAMS --adjpw --rotpw=ROTPW --transformparams=TRANSFORMPARAMS --importctf=IMPORTCTF --input=INPUT --defocuserror=DEFOCUSERROR --astigmatismerror=ASTIGMATISMERROR --scale=SCALE --adaptive_mask --nsigma=NSIGMA --threshold=THRESHOLD --mol_mass=MOL_MASS --ndilation=NDILATION --edge_type=EDGE_TYP --edge_width=EDGE_WIDTH --binary_mask --combinemaps --output_dir=DIRECTORY --output=OUTPUT --pixel_size=PIXEL_SIZE --mask=MASK --do_adaptive_mask --mtf=MTF_FILE_NAME --fsc_adj --B_enhance=B_ENHANCE --B_start=B_START --B_stop=B_STOP --fl=lpf_cutoff_freq --aa=lpf_falloff --window_stack --box=BOX --balance_angular_distribution --max_occupy=MAX_ORIENTATIONS --angstep=ANGULAR_STEP --symmetry=SYMMETRY --nerosion=NEROSION --do_approx
sp_process does not support MPI.
1. Phase flip a stack of images and write output to new file:
sp_process.py input_stack.hdf output_stack.hdf --phase_flip
2. Change size of image or map (resample, decimation or interpolation up). The process also changes the pixel size and window size accordingly.
sp_process input.hdf output.hdf --changesize --ratio=0.5
3. Compute average power spectrum of a stack of 2D images with optional padding (option wn) with zeroes.
sp_process.py input_stack.hdf powerspectrum.hdf --pw [--wn=1024]
4. Generate a stack of projections bdb:data and micrographs with prefix mic (i.e., mic0.hdf, mic1.hdf etc) from structure input_structure.hdf, with CTF applied to both projections and micrographs.
sp_process.py input_structure.hdf data mic --generate_projections format="bdb":apix=5.2:CTF=True:boxsize=64
5. Retrieve original image numbers in the selected ISAC group (here group 12 from generation 3).
sp_process.py bdb:test3 class_averages_generation_3.hdf list3_12.txt --isacgroup=12 --params=originalid
6. Retrieve original image numbers of images listed in ISAC output stack of averages/
sp_process.py select1.hdf ohk.txt
7. Adjust rotationally averaged power spectrum of an image to that of a reference image or a reference 1D power spectrum stored in an ASCII file. Optionally use a tangent low-pass filter. Also works for a stack of images, in which case the output is also a stack.
sp_process.py vol.hdf ref.hdf avol.hdf < 0.25 0.2> --adjpw sp_process.py vol.hdf pw.txt avol.hdf < 0.25 0.2> --adjpw
8. Generate a 1D rotationally averaged power spectrum of an image.
sp_process.py vol.hdf --rotpw=rotpw.txt
Output will contain three columns:
9. Apply 3D transformation (rotation and/or shift) to a set of orientation parameters associated with projection data.
sp_process.py --transfromparams=phi,theta,psi,tx,ty,tz input.txt output.txt
The output file is then imported and 3D transformed map computed.
sp_header.py bdb:p --params=xform.projection --import=output.txt mpirun -np 2 sp_recons3d_n.py bdb:p tvol.hdf --MPI
The reconstructed map is in the position of the map computed using the input.txt parameters and then transformed with rot_shift3D(vol, phi,theta,psi,tx,ty,tz).
10. Import ctf parameters from the output of sp_cter into windowed particle headers.
There are three possible input files formats: (1) all particles are in one stack, (2) and/or (3) particles are in stacks, each stack corresponds to a single micrograph. In each case the particles should contain a name of the micrograph of origin stores using attribute name 'ptcl_source_image'. Normally this is done by e2boxer.py during windowing. Particles whose defocus or astigmatism error exceed set thresholds will be skipped, otherwise, virtual stacks with the original way preceded by G will be created.
sp_process.py --input=bdb:data --importctf=outdir/partres --defocuserror=10.0 --astigmatismerror=5.0
Output will be a vritual stack bdb:Gdata.
sp_process.py --input="bdb:directory/stacks*" --importctf=outdir/partres --defocuserror=10.0 --astigmatismerror=5.0
To concatenate output files,
cd directory e2bdb.py . --makevstack=bdb:allparticles --filt=G
IMPORTANT: Please do not move (or remove!) any input/intermediate EMAN2DB files as the information is linked between them.
11. Scale 3D shifts. The shifts in the input five columns text file with 3D orientation parameters will be DIVIDED by the scale factor.
sp_process.py orientationparams.txt scaledparams.txt scale=0.5
12. Generate soft-edged 3D mask from input 3D map automatically or using the user-provided threshold.
Automatically compute the threshold to intially obtain the largest density cluster.
sp_process.py vol3d.hdf mask3d.hdf --adaptive_mask --fl=12.0 --aa=0.02 --pixel_size=3.1 --nsigma=3.0 --ndilation=1 --edge_width=3 --edge_type="G" --mol_mass=1500.0
Use the user-provided threshold to intially obtain the largest density cluster.
sp_process.py vol3d.hdf mask3d.hdf --adaptive_mask --threshold=0.05 --ndilation=0 --edge_width=5
13. Generate binary 3D mask from input 3D map using the user-provided threshold.
sp_process.py vol3d.hdf mask3d.hdf --binary_mask --threshold=0.05 --ndilation=0 --nerosion=0
14. PostRefiner - Post-refine maps or images by enhancing the power spectrum after 2D averaging, 3D refinement, or 3D sorting run.
(1) Half-set Maps Mode
For a pair of unfiltered odd & even halfset maps, as produced by MERIDIEN, this command executes the following steps:
Options are independent of each others.
sp_process.py --combinemaps vol_0_unfil.hdf vol_1_unfil.hdf --output_dir=outdir_postrefine --output=postrefine_fullset_vol3d.hdf --pixel_size=1.12 --mask=mask3d.hdf --mtf=mtf.txt --fl=-1 --fsc_adj sp_process.py --combinemaps vol_0_unfil.hdf vol_1_unfil.hdf --output_dir=outdir_postrefine --pixel_size=1.12 --mask=mask3d.hdf --mtf=aa.txt --fl=4.7 --aa=0.02 --fsc_adj sp_process.py --combinemaps vol_0_unfil.hdf vol_1_unfil.hdf --output_dir=outdir_postrefine --output=postrefine_fullset_vol3d.hdf --pixel_size=1.12 --do_adaptive_mask --mtf=mtf.txt --fl=3.9 --aa=0.01 --B_enhance=280
(2) Cluster Maps Mode or Single Map Mode:
For cluster maps produced by SORT3D_DEPTH, this command executes the following processes:
Options are independent of each others.
Note that this mode is mainly designed for SORT3D_DEPTH outputs but also applicable to ANY maps.
sp_process.py --combinemaps vol_cluster*.hdf --output_dir=outdir_postrefine_cluster_vols --output=postrefine_cluster_vol3d.hdf --pixel_size=1.12 --do_adaptive_mask --mtf=mtf.txt --fl=3.9 --aa=0.01 --B_enhance=280
To process one single map, simply specify the input volume path (without wild card '*'). This executes the same processes as above but on one single map:
sp_process.py --combinemaps vol.hdf --output_dir=outdir_postrefine_single_vol --output=spostrefine_vol3d.hdf --pixel_size=1.12 --do_adaptive_mask --mtf=mtf.txt --fl=3.9 --aa=0.01 --B_enhance=280
(3) Images Mode - for 2D images
Calculate B-factor and apply negative B-factor to 2D images.
15. Window stack file -reduce size of images without changing the pixel size.
sp_process.py input.hdf output.hdf --box=new_box_size
16. Pad stack file –pad images to a larger size and set surround background to request value (default 0.0).
sp_process.py input.hdf output.hdf --box=new_box_size --background=3.0
17. Create angular distribution .build file
sp_process.py --angular_distribution inputfile=example/path/params.txt --pixel_size=1.0 --round_digit=5 --box_size=500 --particle_radius=175 --cylinder_width=1 --cylinder_length=10000
18. Subtract from images in the first stack images in the second stack and write results to the third stack.
If the name of the output stack is the same as the second stack, the results will be written to the second stack (it will be overwritten).
sp_process.py bdb:orgstack bdb:proj/data bdb:proj/sdata bdb:proj/odata --subtract_stack
19. Balance angular distribution.
Input ASCII file with 3D orientation parameters, compute a histogram of distribution of angles using user-provided angular step, retain a subset of randomly selected projection direction per angular bin using user-provided threshold, and write the list of the all retained projection directions. (In order to create a substack with retained images, use e2bdb.py with options makevstack and list).
sp_process.py --balance_angular_distribution params.txt select.txt --max_occupy=100 --angstep=15 --symmetry=d3
Pawel Penczek
Category 1:: UTILITIES Category 1:: APPLICATIONS
sparx/bin/sp_process.py
Beta:: Under evaluation and testing. Please let us know if there are any bugs.
There are no known bugs so far.