Project

General

Profile

Actions

First-time autoscreening setup » History » Revision 2

« Previous | Revision 2/17 (diff) | Next »
Anchi Cheng, 02/28/2022 10:44 PM


Smart-leginon multi-grid autoscreening

Automated square and hole finders are added to leginon to use Ptolemy (https://arxiv.org/abs/2112.01534) to determine optimal targets using computer vision algorithm and Convolutional Neural Network trained on user target selections accumulated at Simons Electron Microscopy Center at New York Biology Center (SEMC@NYSBC.

This implementation requires Ptolemy which has a separate license. For this release, the communication is through command line interface and rely on shared file system.

  • At SEMC@NYSBC, Ptolemy, which was tested on python 3.9, runs in anaconda environment on the same CentOS7 computer where the main leginon process is.

Square finding localization and classification using MosaicExternalScoreFinder

(node alias Square Finding)

Setting up:

Install Ptolemy according to its instruction

Create a shell script to run Ptolemy lowmag_cli.py

  • Within Leginon MosaicExternalScoreFinder instance defines, for each incoming gr image:
    • the shell script to run Ptolemy (user set it in Blobs settings)
    • the mrc file path of the gr image leginon is currently processing as ptolemy input (leginon decides this for you)
    • the output json file path leginon will later look for the result. (leginon decision based on the imageid of the input mrc file.)

Here is an example how we write this shell script sq_finding.sh

#!/bin/sh -f
# Local runs
source /usr/local/anaconda3/etc/profile.d/conda.sh
conda activate /opt/condaenvs/ptolemy_env
# variable 1 is the outputname without json extension.
# variable 2 is the input mrc path
echo $1
echo $2
mrc_path=$2
python /home/your_name/packages/ptolemy/lowmag_cli.py -f json $2 > $1
conda deactivate
# mv the result to leginon session rawdata directory
mv $1 ${mrc_path%%rawdata/*}rawdata/$1.json
echo ${mrc_path%%rawdata/*}rawdata/$1.json

Test example, assuming you have /data/leginon/22feb28a/rawdata/22feb28a_00001gr.mrc, you can test ptolemy with

./sq_finding.sh test_1 /data/leginon/22feb28a/rawdata/22feb28a_00001gr.mrc

Output test_1.json should end up in /data/leginon/22feb28a/rawdata/

Upload MSI-Ptolemy application into leginon database

Follow the instruction in web application tools
  • Note: If your system needs two Leginon client opened, each on a different pc, use MSi-Ptolemy2.xml

If you have your own application you can do the following replacement by editing your application :

Square Targeting Node : MosaicClickTargetFinder class => MosaicScoreTargetFinder
Exposure Targeting Node: JAHCFinder => ScoreTargetFinder

Define target area size sampling in Leginon

Do this in the settings next to "acquisition" target panel. Enter

  1. Maximal number of squares to select
  2. Number of target group to sample

For example, total of 12 squares selected in 3 groups means the program divided out all blob squares with valid area range into 3 size group (small, medium,and large). It then choose 4 blob squares in each group with highest score given by Ptolemy as the output square targets. High score in Ptolemy result means it is more likely to be a good square.

Set the limits of square area range

This is set in "Thresholded" settings. However, it is easier to set by select examples once you acquire your first grid atlas in this node.

Updated by Anchi Cheng over 2 years ago · 2 revisions