### Sidebar

#### Release history

pipeline:meridien:sp_polishing
This version (2021/03/16 10:44) is a draft.
Approvals: 0/1

## sp_polishing

Bayesian Polishing : Apply Relion Bayesian Polishing on SPHIRE generated stack.

## Usage

Usage in command line

  sp_polishing.py post_refine_folder motioncorr_starfile output_folder training_params --first_frame --last_frame --bfac_minfreq --bfac_maxfreq --min_no_particles --submission_template --submission_command --relion_mpirun_executable --relion_polishing_executable --mpi_procs --no_of_threads --mrc_reloc_folder


## Typical usage

sp_polishing exists in both MPI and non-MPI versions (Running MPI version does not require –MPI flag).

The purpose of sp_polishing.py is to :

: Apply Relion Bayesian Polishing using the stack generated from Meridien.

: The SPHIRE module provides a wrapper around the polishing command for training as well
motion estimation

: After running the polishing routine, the wrapper automatically converts the shiny.star in
the Output folder to a BDB stack and saves it in the folder name of Polish Stack.


## Input

#### Main Parameters

post_refine_folder
The user has to be provide the location of the post refiner directory so that the script can automatically detect all the required information for the polishing. (default required string)
motioncorr_starfile
The metadata star file which is being generated by MotionCorr. (default required string)
output_directory
Toplevel directory where outputs will be written. (default required string)
--training_params
In case if the user wants to do the training part of the polishing then this is None. Otherwise provide the optimize_params.txt file. (default none)
--min_no_particles
Number of particles to inlcude for training. (default 5000)
--submission_template
Submission template for MPI command. In case of running this tool on a cluster, always a submission template. The number of MPI processors and threads in the submission template should be the same as the one specified below in the MPI procs and threads value.(default none)
--submission_command
Submission commmand for cluster (default sbatch)
--relion_mpirun_executable
Since there can be more than one mpirun environment installed on a workstation or on a cluster. It can be sometimes necessary to provide the relion specific mpirun executable. Just type which mpirun -a in a terminal and choose the one which relion requires. (default mpirun)
--relion_polishing_executable
Similar to the issue of relion mpirun executable, it can be sometime necessary to provide the specific relion polishing executable also. Just type which relion_motion_refine_mpi and copy the path here. (default relion_motion_refine_mpi)
--mpi_procs
The number of MPI processors used for Relion multiprocessing. For training part only one MPI processors is used. In case when running the program on cluster, the MPI processors value should be same as used in the submission template.(default 1)
The number of threads use during the polishing. In case when running the program on cluster, the thread value should be same as used in the submission template.(default 1)

--first_frame
The 1st frame number from where it should start. (default 1)
--last_frame
The last frame number where it should end. (default -1)
--bfac_minfreq
The minimum frequency range which is normally the maximum inner shell to include in enhancement. (default 20)
--bfac_maxfreq
The minimum frequency range which is normally the maximum outer shell to include in enhancement. (default -1)
--mrc_reloc_folder
In case if the mrcs images were moved from original location where they were generated to a new location. Then the user has to provide a path directory link to the new location . (default none)

## Output

shiny.star
Output star file for polishing particles.
bdb:polished_stack
: Polished particles stack.
BDB2STAR
Using sphire2relion tool , the bdb stack is converted to star file so that it can be used in relion. The star file is saved in BDB2STAR folder.
PostProcess
Since the input to the tool is Post refiner directory, the tool can automatically create the necessary file in PostProcess folder which is necessary to provide for polishing.

To run it properly on cluster. Do the following task before running in case if you are running from MPI dortmund. These settings can be different if you are using it outside.

module unload sphire (unload the module sphire)

module load sphire/clem/Polishing_SPHIRE_v1.2 or sphire/clr/Polishing_SPHIRE_v1.2 (this has to be done only in case if you have a different installation then the default one, since this tool is still not released, the git branch is different).



Then go to the directory where you have all the data folders. Like Meridien , Post Refiner, ISAC etc etc. It is recommended to start SPHIRE in the folder structure where all the output folders are present e.g Post refinenment output folder, motioncorr output folder , ISAC substack output folder.

## Description

### Reference

Jasenko Zivanov, Takanori Nakane and Sjors H W Scheres: A Bayesian approach to beam-induced motion correction in cryo-EM single-particle analysis, IUCrJ 6, 5-17, January, 2019..

### Developer Notes

Applying polishing using SPHIRE GUI.

### Keywords

Category 1:: APPLICATIONS

### Files

sphire/bin/sp_polishing.py