本家様 https://pypi.org/project/starfile/

単純に「pip install starfile」で構築は完了するのですが、OSがCentOS7とかだとpython2.7でダメみたい。
融通よくするためにも pyenv/anaconda 環境の中で python3 が使える starfile 実行環境を用意するのが宜しいかと。

っで、まずは pyenv/anaconda環境. ここではcrYOLOのように環境を作っていて

git clone https://github.com/yyuu/pyenv.git /apps/pyenv
export PYENV_ROOT=/apps/pyenv
export PATH=$PYENV_ROOT/bin:$PATH
pyenv install --list              <--これでanaconda,minicondaのバージョンが一覧されます.
pyenv install anaconda3-2024.02-1
 
pyenv global anaconda3-2024.02-1
 
source /apps/pyenv/versions/anaconda3-2024.02-1/etc/profile.d/conda.sh

もし既に環境が作られているのなら

source /apps/pyenv/versions/anaconda3-2024.02-1/etc/profile.d/conda.sh

としておきます。

っでstarfile仮想実行環境を作ります.

conda create -n starfile pip
 
conda activate starfile 
pip install starfile

これで完了です。

EnvironmentModules

「/apps/modulefiles/starfile」

#%Module1.0
set          root       /apps/pyenv/versions/anaconda3-2024.02-1/envs/starfile
prepend-path PATH       $root/bin

とします

つかう

「module load」でstarfileを読み込めば使えるかと。

pyenv/anacondaを使わないなら.

[root@centos7 ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
 
[root@centos7 ~]# yum install python3
 
[root@centos7 ~]# pip3 install pandas
[root@centos7 ~]# pip3 install starfile

使ってみる

[illya@centos7 ~]$ ls -l
total 4
-rw-rw-r--. 1 illya illya 786 Jun 11 19:13 particles.star
 
[illya@centos7 ~]$ cat particles.star
data_particles
 
loop_
_rlnCoordinateX #1
_rlnCoordinateY #2
_rlnCoordinateZ #3
_rlnAngleRot #4
_rlnAngleTilt #5
_rlnAnglePsi #6
_rlnMicrographName #7
91.798700       83.622600       203.341030      -51.740000      173.930000      32.971000       01_10.00Apx.mrc
97.635800       80.437000       203.136160      141.500000      171.760000      -134.680000     01_10.00Apx.mrc
92.415200       88.842700       210.663900      -78.750000      173.930000      87.263200       01_10.00Apx.mrc
94.607830       93.135410       205.425960      -85.215000      167.170000      85.632200       01_10.00Apx.mrc
86.187800       80.125400       204.558750      14.910000       163.260000      -16.030000      01_10.00Apx.mrc
91.824240       76.738300       203.794280      39.740000       168.410000      -57.250000      01_10.00Apx.mrc
98.253300       73.530100       203.856030      73.950000       166.380000      -84.640000      01_10.00Apx.mrc
101.303500      80.290800       194.790400      -178.878000     166.090000      73.181000       01_10.00Apx.mrc
 
[illya@centos7 ~]$
 
[illya@centos7 ~]$ python3
Python 3.6.8 (default, Nov 14 2023, 16:29:52)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import starfile
>>>
>>> df = starfile.read('particles.star')
>>>
>>> df['rlnCoordinateX'] += 10
>>> df.head()
   rlnCoordinateX  rlnCoordinateY  rlnCoordinateZ  rlnAngleRot  rlnAngleTilt  rlnAnglePsi rlnMicrographName
0       101.79870        83.62260       203.34103      -51.740        173.93      32.9710   01_10.00Apx.mrc
1       107.63580        80.43700       203.13616      141.500        171.76    -134.6800   01_10.00Apx.mrc
2       102.41520        88.84270       210.66390      -78.750        173.93      87.2632   01_10.00Apx.mrc
3       104.60783        93.13541       205.42596      -85.215        167.17      85.6322   01_10.00Apx.mrc
4        96.18780        80.12540       204.55875       14.910        163.26     -16.0300   01_10.00Apx.mrc
>>>

と実行できます

最新の60件
2025-04-27 2025-04-26 2025-04-25 2025-04-24 2025-04-17 2025-04-15 2025-04-13 2025-04-02 2025-04-01 2025-03-31 2025-03-29 2025-03-28 2025-03-27 2025-03-26 2025-03-23 2025-03-22 2025-03-20 2025-03-17 2025-03-16 2025-03-15 2025-03-06 2025-03-03 2025-03-01 2025-02-18 2025-02-17 2025-02-14 2025-02-12 2025-02-03 2025-02-02 2025-01-27 2025-01-26 2025-01-25 2025-01-24 2025-01-23

edit


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2024-06-11 (火) 19:14:51