LoginSignup
0
0

More than 1 year has passed since last update.

ローカルPC環境にMinicondaとPHi-C仮想環境を構築

Last updated at Posted at 2022-04-06

Hi-Cデータから動的ゲノム状態を理解するための「PHi-C」を実行するための計算環境構築を説明します。
すでにPython環境を利用している人はPHi-C仮想環境を構築から始めてください。
AnacondaによるPython環境の導入は規約上有償の場合もあるので、ここではMinicondaでの構築を説明します。

MinicondaでPython環境を導入

Minicondaのダウンロード

以下のMiniconda公式サイトから、使用OSに対応したインストーラーをクリックして、ローカルPCの適当なフォルダに保存する。
https://docs.conda.io/en/latest/miniconda.html

Minicondaのインストール

ダウンロードしたフォルダ上で端末を開いてインストーラーを実行する。

(Linuxの場合) bash Miniconda3-latest-Linux-x86_64.sh
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue

と表示されるのENTERキーを押しましょう。さらに規約を読み進めるためENTERキーを押し続けましょう。

Do you accept the license terms? [yes|no]

と問われるので

yes

と入力する。

Miniconda3 will now be installed into this location:
/home/USER/miniconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

とインストール先を問われるので、特に気にしなければENTERキーを押す。

Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]

と問われるので

yes

と入力することで、~/.bashrcにPATHが設定される。
改めて端末を開いて

python

と入力して

Python 3.9.7 (default, Sep 16 2021, 13:09:58) 
[GCC 7.5.0] :: Anaconda, Inc. on linux

が表示されていればインストール成功です。
一旦、端末を閉じましょう。

PHi-C仮想環境を構築

PHi-Cのアルゴリズムは主にnumpyによる行列演算で動作しています。その高速化のため、Intel® Distribution for Python*に基づいた仮想環境を構築しましょう。
MacのM1チップの場合はIntel Math Kernel Libraryが非対応とのことなので、通常の仮想環境を作成してください。
まずは端末を開き、condaの更新のため

conda update conda

を実行します。

Proceed ([y]/n)?

と問われたら

y

を入力して更新しましょう。
intelの公式チャネルに基づいてphic仮想環境を構築します:

conda create -n phic intelpython3_core python=3.9 -c intel

と入力して

Proceed ([y]/n)?

と問われたら

y

を入力する。多少時間がかかるかもしれません。

conda info -e

phicという仮想環境ができているか確認できます。
次に

conda activate phic

を入力してphic仮想環境に入る。
その後

pip install phic

と入力し、Hi-Cデータ解析のためのPHi-C2をインストールする。
以上で計算環境構築は終了です。

Straw for Pythonpip install hic-strawで追加インストールする際にgcc関連のエラーが出る場合があります。エラーの原因はcurl.hなので、Ubuntuの場合はsudo apt install libcurl4-openssl-devでライブラリを事前にインストールしておくとうまくいくはずです。

PHi-C仮想環境のメンテナンス

conda activate phic

で仮想環境に入る。
他のチャネルとの依存関係を避けるため、intelチャネルを指定してアップデートする:

(Intel CPUの場合) conda update --all -c intel
(Mac M1 CPUの場合) conda update --all

pipでインストールした二つは

pip install -U phic

でアップデートする。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0