PyEM をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
本家様 [[https://github.com/asarnow/pyem>+https://github....
pyemのwiki [[https://github.com/asarnow/pyem/wiki>+https:...
「A collection of Python modules and command-line utiliti...
deepL先生訳
「生物試料の電子顕微鏡観察用のPythonモジュールとコマンド...
***pyenv/anaconda [#s1f1f4c4]
[[crYOLO]]と同じように pyenv を敷いて anaconda か minifor...
&color(red){*};&size(10){既に [[crYOLO]] とかで構築済みな...
#code(nonumber){{
git clone https://github.com/yyuu/pyenv.git /apps/pyenv
export PYENV_ROOT=/apps/pyenv
export PATH=$PYENV_ROOT/bin:$PATH
pyenv install --list <-- 最新版らを確認
pyenv install anaconda3-2024.06-1
(あるいは pyenv install miniforge3-23.11.0-0 )
}}
&size(10){サイトでは miniforge を進めてます. まぁmambaが...
その後にconda環境を作れるようにするために
#code(nonumber){{
source /apps/pyenv/versions/anaconda3-2024.06-1/etc/profi...
(あるいは source /apps/pyenv/versions/miniforge3-23.11.0-...
}}
とします
***PyEM 向けの仮想実行環境を作って、PyEMをインストールし...
PyEMの仮想環境名ですが単純に「PyEM」としてます. &size(10)...
#code(nonumber){{
[root@rockylinux ~]# conda create -n PyEM python=3.9 -c c...
[root@rockylinux ~]# conda activate PyEM
(PyEM) [root@rockylinux ~]# conda install numba numpy sci...
(PyEM) [root@rockylinux ~]# cd /apps
(PyEM) [root@rockylinux apps]# git clone https://github.c...
(PyEM) [root@rockylinux apps]# cd pyem/
(PyEM) [root@rockylinux pyem]# which pip
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/pip
(PyEM) [root@rockylinux pyem]# pip install --no-dependenc...
(PyEM) [root@rockylinux pyem]# pip install cs2star (つ...
}}
一応確認 &size(10){ついでに cs2star も入れてます. 参照[...
#code(nonumber){{
(PyEM) [root@rockylinux ~]# ls /apps/pyem/pyem/cli/
angdist.py ctf2star.py __init__.py mcstar.py ...
cfsc.py disparticle.py map.py par2star.py ...
csparc2star.py emcalc.py mask.py pose.py ...
(PyEM) [root@rockylinux ~]#
(PyEM) [root@rockylinux ~]# ls /apps/pyenv/versions/anaco...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/cf...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/cs...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/ct...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/di...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/em...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/ma...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/ma...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/mc...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/pa...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/pr...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/pr...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/st...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/st...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/st...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/su...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/va...
(PyEM) [root@rockylinux ~]#
}}
「/apps/pyem/pyem/cli」にあって、「/apps/pyenv/versions/a...
なので、EnvironmentModulesは下記のようにします
***EnvironmentModules [#se252f32]
「/apps/modulefiles/PyEM」
#code(nonumber){{
#%Module1.0
set PyEM /apps/pyem/
set root /apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM
prepend-path PATH $root/bin:$PyEM/pyem/cli
}}
***実行するには [#b065a49a]
みんな大好き csparc2star.py のヘルプを出してみた.
#code(nonumber){{
[saber@rockylinux ~]$ module use /apps/modulefiles/
[saber@rockylinux ~]$ module load PyEM
[saber@rockylinux ~]$ csparc2star.py -h
usage: csparc2star.py [-h] [--movies] [--boxsize BOXSIZE]...
[--micrograph-path MICROGRAPH_PATH]...
[--invertx] [--inverty] [--flipy] [...
[--loglevel LOGLEVEL]
[input ...] output
positional arguments:
input Cryosparc metadata .csv (v0.6.5) ...
output Output .star file
optional arguments:
-h, --help show this help message and exit
--movies Write per-movie star files into o...
--boxsize BOXSIZE Cryosparc refinement box size (if...
--class CLS Keep this class in output, may be...
--minphic MINPHIC Minimum posterior probability for...
--stack-path STACK_PATH
Path to single particle stack
--micrograph-path MICROGRAPH_PATH
Replacement path for micrographs ...
--copy-micrograph-coordinates COPY_MICROGRAPH_COORDINATES
Source for micrograph paths and p...
--swapxy Swap X and Y axes when converting...
--noswapxy Do not swap X and Y axes when con...
--invertx Invert particle coordinate X axis
--inverty Invert particle coordinate Y axis
--flipy Invert refined particle Y shifts
--cached Keep paths from the Cryosparc 2+ ...
--transform TRANSFORM
Apply rotation matrix or 3x4 rota...
--relion2, -r2 Relion 2 compatible outputs
--strip-uid [STRIP_UID]
Strip all leading UIDs from file ...
--10k Only read first 10,000 particles ...
--loglevel LOGLEVEL, -l LOGLEVEL
Logging level and debug output
[saber@rockylinux ~]$
[saber@rockylinux ~]$
[saber@rockylinux ~]$ cs2star -h
Usage: cs2star [OPTIONS] JOB_DIR [DEST_DIR]
Copy and convert a cryosparc dir into a relion-ready dir.
\b Parameters ========== JOB_DIR: a cryosparc job c...
files. DEST_DIR: the destination directory. [defaul...
WARNING! This script will use --swapxy by default. This...
this is the convention change between cryosparc and rel...
mileage may vary, so you are encouraged to check you da...
Note that if -p/-m are not passed, those columns are no...
mrc extension and broken path).
Options:
-f, --overwrite overwrite the existing dest...
present.Passed once, overwr...
Twice, also files/symlinks ...
-d, --dry-run do not perform the command,...
and show what will be done.
-c, --copy / -s, --symlink copy the images or symlink ...
-m, --micrographs copy/link the full microgra...
-p, --patches copy/link the particle patc...
--sets TEXT only use these sets (only u...
Particle Sets Tool). Comma-...
--classes TEXT only use particles from the...
separated list.
--swapxy / --no-swapxy swap x and y axes [default...
--inverty / --no-inverty invert y axis [default: no...
--invertx / --no-invertx invert x axis [default: no...
--version Show the version and exit.
-h, --help Show this message and exit.
[saber@rockylinux ~]$
}}
とかで
~
ただ、、
***recenter.py [#r0c5bc60]
「recenter.py」スクリプトを実行すると
#code(nonumber){{
[saber@rockylinux ~]$ recenter.py
Traceback (most recent call last):
File "/apps/pyem//pyem/cli/recenter.py", line 24, in <m...
from star import parse_star, write_star
ImportError: cannot import name 'parse_star' from 'star' ...
[saber@rockylinux ~]$
}}
と言われる.
強引な方法だけどこのPyEM仮想実行環境に eman-dev をcondaで...
#code(nonumber){{
[root@rockylinux ~]# source /apps/pyenv/versions/anaconda...
[root@rockylinux ~]# conda activate PyEM
(PyEM) [root@rockylinux ~]# conda install eman-dev -c cry...
}}
そのうえで、ちょっと「recenter.py」を弄る
#code(diff,nonumber){{
--- /apps/pyem/pyem/cli/recenter.py.orig 2024-07-0...
+++ /apps/pyem/pyem/cli/recenter.py 2024-07-07 02:13:...
@@ -21,7 +21,7 @@
import logging
import sys
import numpy as np
-from star import parse_star, write_star
+from pyem.star import parse_star, write_star
from EMAN2 import EMData, Vec3f, Transform
}}
そうすると、
#code(nonumber){{
[saber@rockylinux ~]$ module use /apps/modulefiles/
[saber@rockylinux ~]$ module load PyEM
[saber@rockylinux ~]$
[saber@rockylinux ~]$
[saber@rockylinux ~]$ recenter.py -h
usage: recenter.py [-h] [--class-2d CLASS_2D] [--class-3d...
positional arguments:
input Input .star file
output Output .star file
optional arguments:
-h, --help show this help message and exit
--class-2d CLASS_2D 2D class images for recentering (...
--class-3d CLASS_3D 3D class images for recentering (...
--zero-origin ZERO_ORIGIN
Subtract particle origin from par...
[saber@rockylinux ~]$
}}
と動くようになる
***めも [#wa819621]
eman-dev を入れてしまうので、eman2 向けとしてアプリを用意...
終了行:
本家様 [[https://github.com/asarnow/pyem>+https://github....
pyemのwiki [[https://github.com/asarnow/pyem/wiki>+https:...
「A collection of Python modules and command-line utiliti...
deepL先生訳
「生物試料の電子顕微鏡観察用のPythonモジュールとコマンド...
***pyenv/anaconda [#s1f1f4c4]
[[crYOLO]]と同じように pyenv を敷いて anaconda か minifor...
&color(red){*};&size(10){既に [[crYOLO]] とかで構築済みな...
#code(nonumber){{
git clone https://github.com/yyuu/pyenv.git /apps/pyenv
export PYENV_ROOT=/apps/pyenv
export PATH=$PYENV_ROOT/bin:$PATH
pyenv install --list <-- 最新版らを確認
pyenv install anaconda3-2024.06-1
(あるいは pyenv install miniforge3-23.11.0-0 )
}}
&size(10){サイトでは miniforge を進めてます. まぁmambaが...
その後にconda環境を作れるようにするために
#code(nonumber){{
source /apps/pyenv/versions/anaconda3-2024.06-1/etc/profi...
(あるいは source /apps/pyenv/versions/miniforge3-23.11.0-...
}}
とします
***PyEM 向けの仮想実行環境を作って、PyEMをインストールし...
PyEMの仮想環境名ですが単純に「PyEM」としてます. &size(10)...
#code(nonumber){{
[root@rockylinux ~]# conda create -n PyEM python=3.9 -c c...
[root@rockylinux ~]# conda activate PyEM
(PyEM) [root@rockylinux ~]# conda install numba numpy sci...
(PyEM) [root@rockylinux ~]# cd /apps
(PyEM) [root@rockylinux apps]# git clone https://github.c...
(PyEM) [root@rockylinux apps]# cd pyem/
(PyEM) [root@rockylinux pyem]# which pip
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/pip
(PyEM) [root@rockylinux pyem]# pip install --no-dependenc...
(PyEM) [root@rockylinux pyem]# pip install cs2star (つ...
}}
一応確認 &size(10){ついでに cs2star も入れてます. 参照[...
#code(nonumber){{
(PyEM) [root@rockylinux ~]# ls /apps/pyem/pyem/cli/
angdist.py ctf2star.py __init__.py mcstar.py ...
cfsc.py disparticle.py map.py par2star.py ...
csparc2star.py emcalc.py mask.py pose.py ...
(PyEM) [root@rockylinux ~]#
(PyEM) [root@rockylinux ~]# ls /apps/pyenv/versions/anaco...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/cf...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/cs...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/ct...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/di...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/em...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/ma...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/ma...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/mc...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/pa...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/pr...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/pr...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/st...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/st...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/st...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/su...
/apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM/bin/va...
(PyEM) [root@rockylinux ~]#
}}
「/apps/pyem/pyem/cli」にあって、「/apps/pyenv/versions/a...
なので、EnvironmentModulesは下記のようにします
***EnvironmentModules [#se252f32]
「/apps/modulefiles/PyEM」
#code(nonumber){{
#%Module1.0
set PyEM /apps/pyem/
set root /apps/pyenv/versions/anaconda3-2024.06-1/envs/PyEM
prepend-path PATH $root/bin:$PyEM/pyem/cli
}}
***実行するには [#b065a49a]
みんな大好き csparc2star.py のヘルプを出してみた.
#code(nonumber){{
[saber@rockylinux ~]$ module use /apps/modulefiles/
[saber@rockylinux ~]$ module load PyEM
[saber@rockylinux ~]$ csparc2star.py -h
usage: csparc2star.py [-h] [--movies] [--boxsize BOXSIZE]...
[--micrograph-path MICROGRAPH_PATH]...
[--invertx] [--inverty] [--flipy] [...
[--loglevel LOGLEVEL]
[input ...] output
positional arguments:
input Cryosparc metadata .csv (v0.6.5) ...
output Output .star file
optional arguments:
-h, --help show this help message and exit
--movies Write per-movie star files into o...
--boxsize BOXSIZE Cryosparc refinement box size (if...
--class CLS Keep this class in output, may be...
--minphic MINPHIC Minimum posterior probability for...
--stack-path STACK_PATH
Path to single particle stack
--micrograph-path MICROGRAPH_PATH
Replacement path for micrographs ...
--copy-micrograph-coordinates COPY_MICROGRAPH_COORDINATES
Source for micrograph paths and p...
--swapxy Swap X and Y axes when converting...
--noswapxy Do not swap X and Y axes when con...
--invertx Invert particle coordinate X axis
--inverty Invert particle coordinate Y axis
--flipy Invert refined particle Y shifts
--cached Keep paths from the Cryosparc 2+ ...
--transform TRANSFORM
Apply rotation matrix or 3x4 rota...
--relion2, -r2 Relion 2 compatible outputs
--strip-uid [STRIP_UID]
Strip all leading UIDs from file ...
--10k Only read first 10,000 particles ...
--loglevel LOGLEVEL, -l LOGLEVEL
Logging level and debug output
[saber@rockylinux ~]$
[saber@rockylinux ~]$
[saber@rockylinux ~]$ cs2star -h
Usage: cs2star [OPTIONS] JOB_DIR [DEST_DIR]
Copy and convert a cryosparc dir into a relion-ready dir.
\b Parameters ========== JOB_DIR: a cryosparc job c...
files. DEST_DIR: the destination directory. [defaul...
WARNING! This script will use --swapxy by default. This...
this is the convention change between cryosparc and rel...
mileage may vary, so you are encouraged to check you da...
Note that if -p/-m are not passed, those columns are no...
mrc extension and broken path).
Options:
-f, --overwrite overwrite the existing dest...
present.Passed once, overwr...
Twice, also files/symlinks ...
-d, --dry-run do not perform the command,...
and show what will be done.
-c, --copy / -s, --symlink copy the images or symlink ...
-m, --micrographs copy/link the full microgra...
-p, --patches copy/link the particle patc...
--sets TEXT only use these sets (only u...
Particle Sets Tool). Comma-...
--classes TEXT only use particles from the...
separated list.
--swapxy / --no-swapxy swap x and y axes [default...
--inverty / --no-inverty invert y axis [default: no...
--invertx / --no-invertx invert x axis [default: no...
--version Show the version and exit.
-h, --help Show this message and exit.
[saber@rockylinux ~]$
}}
とかで
~
ただ、、
***recenter.py [#r0c5bc60]
「recenter.py」スクリプトを実行すると
#code(nonumber){{
[saber@rockylinux ~]$ recenter.py
Traceback (most recent call last):
File "/apps/pyem//pyem/cli/recenter.py", line 24, in <m...
from star import parse_star, write_star
ImportError: cannot import name 'parse_star' from 'star' ...
[saber@rockylinux ~]$
}}
と言われる.
強引な方法だけどこのPyEM仮想実行環境に eman-dev をcondaで...
#code(nonumber){{
[root@rockylinux ~]# source /apps/pyenv/versions/anaconda...
[root@rockylinux ~]# conda activate PyEM
(PyEM) [root@rockylinux ~]# conda install eman-dev -c cry...
}}
そのうえで、ちょっと「recenter.py」を弄る
#code(diff,nonumber){{
--- /apps/pyem/pyem/cli/recenter.py.orig 2024-07-0...
+++ /apps/pyem/pyem/cli/recenter.py 2024-07-07 02:13:...
@@ -21,7 +21,7 @@
import logging
import sys
import numpy as np
-from star import parse_star, write_star
+from pyem.star import parse_star, write_star
from EMAN2 import EMData, Vec3f, Transform
}}
そうすると、
#code(nonumber){{
[saber@rockylinux ~]$ module use /apps/modulefiles/
[saber@rockylinux ~]$ module load PyEM
[saber@rockylinux ~]$
[saber@rockylinux ~]$
[saber@rockylinux ~]$ recenter.py -h
usage: recenter.py [-h] [--class-2d CLASS_2D] [--class-3d...
positional arguments:
input Input .star file
output Output .star file
optional arguments:
-h, --help show this help message and exit
--class-2d CLASS_2D 2D class images for recentering (...
--class-3d CLASS_3D 3D class images for recentering (...
--zero-origin ZERO_ORIGIN
Subtract particle origin from par...
[saber@rockylinux ~]$
}}
と動くようになる
***めも [#wa819621]
eman-dev を入れてしまうので、eman2 向けとしてアプリを用意...
ページ名:
1