Setup Ptolemy CLI shell script » History » Version 5
Anchi Cheng, 03/31/2023 02:29 PM
| 1 | 2 | Anchi Cheng | h1. Setup Ptolemy CLI shell script for Square Finding |
|---|---|---|---|
| 2 | 1 | Anchi Cheng | |
| 3 | 3 | Anchi Cheng | The script needs to take three variables |
| 4 | 1 | Anchi Cheng | |
| 5 | # the output json file name without the extension |
||
| 6 | # input mrc file path |
||
| 7 | 3 | Anchi Cheng | # the directory that contains the grid tile mrc file. This is redundant information, but is kept to give consistent 3 option input as the Hole Finding script |
| 8 | 1 | Anchi Cheng | |
| 9 | 3 | Anchi Cheng | * Within Leginon MosaicExternalScoreFinder instance defines, for each incoming gr image, a unique name from mosaic label and image id to form the value of variable 1. |
| 10 | 1 | Anchi Cheng | |
| 11 | 5 | Anchi Cheng | Here is an example of this bash shell script we call sq_finding.sh |
| 12 | 1 | Anchi Cheng | |
| 13 | <pre> |
||
| 14 | #!/bin/sh -f |
||
| 15 | 4 | Anchi Cheng | #python3 /your_ptlomy/bin/runPtolemyLmm.py $1 $2 $3 |
| 16 | 3 | Anchi Cheng | |
| 17 | # This runs ptolemy locally using conda environment. |
||
| 18 | 1 | Anchi Cheng | source /usr/local/anaconda3/etc/profile.d/conda.sh |
| 19 | conda activate /opt/condaenvs/ptolemy_env |
||
| 20 | 3 | Anchi Cheng | # variable 1 is the outputname without json extension |
| 21 | 1 | Anchi Cheng | # variable 2 is the input mrc path |
| 22 | 3 | Anchi Cheng | # variable 3 is the directory that contains the grid tile mrc file |
| 23 | 1 | Anchi Cheng | echo $1 |
| 24 | echo $2 |
||
| 25 | mrc_path=$2 |
||
| 26 | 4 | Anchi Cheng | python /your/ptolemy/ptolemy/lowmag_cli.py -f json $2 > $1 |
| 27 | 1 | Anchi Cheng | conda deactivate |
| 28 | mv $1 ${mrc_path%%rawdata/*}rawdata/$1.json |
||
| 29 | echo ${mrc_path%%rawdata/*}rawdata/$1.json |
||
| 30 | </pre> |
||
| 31 | |||
| 32 | Test example, assuming you have /data/leginon/22feb28a/rawdata/22feb28a_00001gr.mrc, you can test ptolemy with |
||
| 33 | <pre> |
||
| 34 | 3 | Anchi Cheng | ./sq_finding.sh test_1 /data/leginon/22feb28a/rawdata/22feb28a_00001gr.mrc dummy |
| 35 | 1 | Anchi Cheng | </pre> |
| 36 | Output test_1.json should end up in /data/leginon/22feb28a/rawdata/ |