First-time autoscreening setup » History » Version 2
Anchi Cheng, 02/28/2022 10:44 PM
| 1 | 1 | Anchi Cheng | h1. Smart-leginon multi-grid autoscreening |
|---|---|---|---|
| 2 | |||
| 3 | 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. |
||
| 4 | |||
| 5 | 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. |
||
| 6 | |||
| 7 | * 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. |
||
| 8 | |||
| 9 | 2 | Anchi Cheng | h2. Square finding localization and classification using MosaicExternalScoreFinder |
| 10 | 1 | Anchi Cheng | |
| 11 | 2 | Anchi Cheng | (node alias Square Finding) |
| 12 | |||
| 13 | h3. Setting up: |
||
| 14 | |||
| 15 | h4. Install Ptolemy according to its instruction |
||
| 16 | |||
| 17 | h4. Create a shell script to run Ptolemy lowmag_cli.py |
||
| 18 | |||
| 19 | 1 | Anchi Cheng | * Within Leginon MosaicExternalScoreFinder instance defines, for each incoming gr image: |
| 20 | 2 | Anchi Cheng | ** the shell script to run Ptolemy (user set it in *Blobs settings*) |
| 21 | 1 | Anchi Cheng | ** the mrc file path of the gr image leginon is currently processing as ptolemy input (leginon decides this for you) |
| 22 | 2 | Anchi Cheng | ** the output json file path leginon will later look for the result. (leginon decision based on the imageid of the input mrc file.) |
| 23 | 1 | Anchi Cheng | |
| 24 | Here is an example how we write this shell script sq_finding.sh |
||
| 25 | |||
| 26 | <pre> |
||
| 27 | #!/bin/sh -f |
||
| 28 | # Local runs |
||
| 29 | source /usr/local/anaconda3/etc/profile.d/conda.sh |
||
| 30 | conda activate /opt/condaenvs/ptolemy_env |
||
| 31 | # variable 1 is the outputname without json extension. |
||
| 32 | # variable 2 is the input mrc path |
||
| 33 | echo $1 |
||
| 34 | echo $2 |
||
| 35 | mrc_path=$2 |
||
| 36 | 2 | Anchi Cheng | python /home/your_name/packages/ptolemy/lowmag_cli.py -f json $2 > $1 |
| 37 | 1 | Anchi Cheng | conda deactivate |
| 38 | # mv the result to leginon session rawdata directory |
||
| 39 | mv $1 ${mrc_path%%rawdata/*}rawdata/$1.json |
||
| 40 | echo ${mrc_path%%rawdata/*}rawdata/$1.json |
||
| 41 | </pre> |
||
| 42 | 2 | Anchi Cheng | |
| 43 | Test example, assuming you have /data/leginon/22feb28a/rawdata/22feb28a_00001gr.mrc, you can test ptolemy with |
||
| 44 | <pre> |
||
| 45 | ./sq_finding.sh test_1 /data/leginon/22feb28a/rawdata/22feb28a_00001gr.mrc |
||
| 46 | </pre> |
||
| 47 | Output test_1.json should end up in /data/leginon/22feb28a/rawdata/ |
||
| 48 | |||
| 49 | h3. Upload MSI-Ptolemy application into leginon database |
||
| 50 | |||
| 51 | Follow the instruction in [[Applications|web application tools]] |
||
| 52 | * Note: If your system needs two Leginon client opened, each on a different pc, use MSi-Ptolemy2.xml |
||
| 53 | |||
| 54 | If you have your own application you can do the following replacement by [[Use_the_Application_Editor_to_create_Leginon_applications|editing your application]] : |
||
| 55 | |||
| 56 | Square Targeting Node : MosaicClickTargetFinder class => MosaicScoreTargetFinder |
||
| 57 | Exposure Targeting Node: JAHCFinder => ScoreTargetFinder |
||
| 58 | |||
| 59 | h3. Define target area size sampling in Leginon |
||
| 60 | |||
| 61 | Do this in the settings next to "acquisition" target panel. Enter |
||
| 62 | |||
| 63 | # Maximal number of squares to select |
||
| 64 | # Number of target group to sample |
||
| 65 | |||
| 66 | 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. |
||
| 67 | |||
| 68 | h4. Set the limits of square area range |
||
| 69 | |||
| 70 | 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. |