#author("2026-07-16T04:11:21+00:00","default:sysosa","sysosa")
#author("2026-07-16T06:38:48+00:00","default:sysosa","sysosa")
本家様 [[http://huanglab.phys.hust.edu.cn/EMReady/>+http://huanglab.phys.hust.edu.cn/EMReady/]]


#code(nonumber){{
EMReady is a three-dimensional nested U-net-based framework for improving the interpretability of cryo-EM maps using similarity and correlation-guided deep learning.

(DeepL様翻訳)
EMReadyは、類似性と相関に導かれたディープラーニングを用いて低温電子顕微鏡マップの解釈可能性を向上させるための、3次元ネストされたU-netベースのフレームワークです。
}}
単体アプリとして作れるし、[[Scipion]]のplug-inとしても利用できるみたい. [[https://github.com/scipion-em/scipion-em-emready>+https://github.com/scipion-em/scipion-em-emready]]

ここでは単体アプリとして作ってみる

***構築 [#c3d35078]

condaアプリなので pyenv/anaconda を敷いてその上に EMReady 実行環境を作ります.

#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 miniforge3-25.3.1-0
 
source /apps/pyenv/versions/miniforge3-25.3.1-0/etc/profile.d/conda.sh
conda update -n base -c conda-forge conda -y
 
(既にpyenv/anacondaが用意されているなら下記の実行)
source /apps/pyenv/versions/miniforge3-25.3.1-0/etc/profile.d/conda.sh
}}

その上で

#code(nonumber){{
[root@rockylinux9 ~]# cat /etc/redhat-release
Rocky Linux release 9.6 (Blue Onyx)

[root@rockylinux9 ~]# 
[root@rockylinux9 ~]# cd /apps/src
[root@rockylinux9 src]# wget http://huanglab.phys.hust.edu.cn/EMReady/EMReady_v1.3.tgz
[root@rockylinux9 src]# cd ..

[root@rockylinux9 apps]# tar xf src/EMReady_v1.3.tgz
[root@rockylinux9 apps]# cd EMReady_v1.3/

[root@rockylinux9 EMReady_v1.3]# ls -lF
total 72
-rwxr-x---. 1 573 514  4526 Aug 14 11:13 EMReady.sh*
-rwxr-x---. 1 573 514   357 Jun 17 11:34 environment.yml*
-rwxrwx---. 1 573 514  3719 Jun 17 11:28 frn.py*
-rwxrwx---. 1 573 514  6004 Aug 14 10:58 interp3d.py*
-rwxrwx---. 1 573 514  1278 Aug 14 10:59 interp.py*
-rwxr-x---. 1 573 514   288 Aug 14 11:20 LICENSE*
drwxr-x---. 2 573 514    68 Jun 17 11:28 model_state_dicts/
-rwxrwx---. 1 573 514 12289 Aug 14 11:23 pred.py*
-rwxrwx---. 1 573 514 11223 Jun 17 11:28 scunet.py*
-rwxrwx---. 1 573 514  9883 Aug 14 11:12 utils.py*
[root@rockylinux9 EMReady_v1.3]#

[root@rockylinux9 EMReady_v1.3]# conda env create -f environment.yml

[root@rockylinux9 EMReady_v1.3]# conda activate emready_env

(emready_env) [root@rockylinux9 EMReady_v1.3]#
(emready_env) [root@rockylinux9 EMReady_v1.3]# chmod 755 EMReady.sh frn.py interp3d.py interp.py pred.py scunet.py utils.py

(emready_env) [root@rockylinux9 EMReady_v1.3]# chmod 755 model_state_dicts/ /apps/EMReady_v1.3

(emready_env) [root@rockylinux9 EMReady_v1.3]# chmod 644 environment.yml LICENSE

(emready_env) [root@rockylinux9 EMReady_v1.3]# chmod 644 model_state_dicts/model_grid_size_*

(emready_env) [root@rockylinux9 EMReady_v1.3]# chown -R root:root /apps/EMReady_v1.3

(emready_env) [root@rockylinux9 EMReady_v1.3]# vi EMReady.sh
 :
    EMReady_home="/apps/EMReady_v1.3"
    activate="/apps/pyenv/versions/miniforge3-25.3.1-0/bin/activate"
    EMReady_env="emready_env"
 :
(emready_env) [root@rockylinux9 EMReady_v1.3]# conda deactivate

[root@rockylinux9 EMReady_v1.3]#
}}


***EnvironmentModules [#pfb31c1e]
「/apps/modulefiles/EMReady/1.3」
#code(nonumber){{
#%Module
set          em   /apps/EMReady_v1.3
prepend-path PATH $em
}}


***テスト [#zd4f0b81]

本家様にテストデータがあります. まずはそれを入手して
#code(nonumber){{
[saber@rockylinux9 ~]$ wget http://huanglab.phys.hust.edu.cn/EMReady/emd_22216.map.gz
[saber@rockylinux9 ~]$ ls -lh emd_22216.map.gz
-rw-r--r--. 1 saber saber 15M Aug 31  2020 emd_22216.map.gz

[saber@rockylinux9 ~]$ gzip -d emd_22216.map.gz
[saber@rockylinux9 ~]$ ls -lh
total 16M
-rw-r--r--. 1 saber saber 16M Aug 31  2020 emd_22216.map
[saber@rockylinux9 ~]$
}}

計算してみます.
#code(nonumber){{
[saber@rockylinux9 ~]$ module use /apps/modulefiles/
[saber@rockylinux9 ~]$ module load EMReady/1.3

[saber@rockylinux9 ~]$ EMReady.sh

EMReady by Huang Lab @ HUST (http://huanglab.phys.hust.edu.cn/EMReady)

USAGE: EMReady.sh in_map.mrc out_map.mrc [options]

Descriptions:
    in_map.mrc    : Input EM density map in MRC2014 format
    out_map.mrc   : Filename of the output processed density map

    -g            : ID(s) of GPU devices to be used, e.g., 0 for GPU #0, and 2,3,6 for GPUs #2, #3, and #6
                  default: 0

    -s            : The stride of the sliding window to cut the input map into overlapping boxes. The value should be an integer within the range of [6, 48]. A smaller stride means a larger number of overlapping boxes
                  default: 12

    -b            : Number of input boxes in one batch. Users can adjust 'batch_size' according to the available VRAM of their GPU devices. Empirically, a GPU with 40 GB VRAM can afford a 'batch_size' of about 200
                  default: 10

    -m            : Input mask map in MRC2014 format

    -c            : The contour threshold to binarize the mask map
                  default: 0.0

    -p            : Input structure in PDB or mmCIF format to be used as the mask

    -r            : Zone radius of the mask around the input structure in Angstrom
                  default: 4.0

    -mo           : Filename of the output binary mask map

    --use_cpu     : Run EMReady on CPU instead of GPU

    --inverse     : Inverse the mask

[saber@rockylinux9 ~]$
[saber@rockylinux9 ~]$ EMReady.sh emd_22216.map emd_22216_EMReady.map
}}

GPUも使ってくれます.



***メモ [#p4e6e780]

EMReady_v1.2.1の時は f90 なプログラムがありましたが、以降はソースから消えてますね.


***EMReady v2 [#w7d83171]
本家様 [[https://github.com/huang-laboratory/EMReady>+https://github.com/huang-laboratory/EMReady]]

condaアプリなので pyenv/anaconda を敷いてその上に EMReady 実行環境を作ります.

#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 miniforge3-26.3.2-3
 
source /apps/pyenv/versions/miniforge3-26.3.2-3/etc/profile.d/conda.sh
conda update -n base -c conda-forge conda -y
 
(既にpyenv/anacondaが用意されているなら下記の実行)
source /apps/pyenv/versions/miniforge3-26.3.2-3/etc/profile.d/conda.sh
}}

その上で
#code(nonumber){{
[root@rockylinux9 ~]# conda create -n emready python==3.10 -y

[root@rockylinux9 ~]# conda activate emready

(emready) [root@rockylinux9 ~]# 

(emready) [root@rockylinux9 ~]# cd /apps/src/

(emready) [root@rockylinux9 src]# git clone https://github.com/huang-laboratory/EMReady.git

(emready) [root@rockylinux9 src]# cd EMReady/

(emready) [root@rockylinux9 EMReady]# 
(emready) [root@rockylinux9 EMReady]# pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cu128

*オリジナルの「pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 --index-url https://download.pytorch.org/whl/cu118」はcuda-11.8なので blackwell向けとして修正してみた

(emready) [root@rockylinux9 EMReady]# pip install -r requirements.txt
}}

「requirements_mamba.txt」を修正
&size(10){https://github.com/huang-laboratory/EMReady/issues/8 を参考に};
#code(diff,nonumber){{
--- requirements_mamba.txt.orig 2026-07-16 08:54:15.389191092 +0900
+++ requirements_mamba.txt      2026-07-16 09:55:02.598340100 +0900
@@ -1,2 +1,2 @@
-causal-conv1d==1.4.0
-mamba-ssm==2.2.0
+causal-conv1d==1.6.1
+mamba-ssm==2.3.1
}}

その上で
#code(nonumber){{
(emready) [root@rockylinux9 EMReady]# module load cuda/12.8

(emready) [root@rockylinux9 EMReady]# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2025 NVIDIA Corporation
Built on Fri_Feb_21_20:23:50_PST_2025
Cuda compilation tools, release 12.8, V12.8.93
Build cuda_12.8.r12.8/compiler.35583870_0

(emready) [root@rockylinux9 EMReady]#

(emready) [root@rockylinux9 EMReady]# pip install --no-build-isolation -r requirements_mamba.txt

(emready) [root@rockylinux9 EMReady]# pip install -e . --no-deps

(emready) [root@rockylinux9 EMReady]# conda deactivate
[root@rockylinux9 EMReady]#
}}

environment-modulesは「/apps/modulefiles/EMReady」
#code(nonumber){{
#%Module1.0
set          root /apps/pyenv/versions/miniforge3-26.3.2-3/envs/emready
prepend-path PATH $root/bin
prepend-path LD_LIBRARY_PATH $root/lib
}}
1

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS