wet-to-dry’s blog

京大大学院生の備忘録ブログ

NGS解析ツールのインストールと管理

初めに

僕は普段RNA-seqとChIP-seqの解析を主に行っています*1

これらの解析に用いるツールをインストールしたので、どのように管理しているかも含めて公開しようかと思います。

bioconda vs homebrew

パッケージ管理ツールとしてよくbiocondaとhomebrew(linuxではlinuxbrew)が使われます。

以前のDRY解析教本(第1版)では、主にhomebrewでツールをインストールしていたと思うのですが、第2版ではbiocondaも併用して使っています。

使い方はほとんど同じなのですが、biocondaの方がツールの種類が圧倒的に多い(且つhomebrewにあるものは基本ある)ので、僕はほとんどhomebrewを使わずにbiocondaでインストールしています。

biocondaのインストール

こちらのサイトを参考にして、

$ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ bash Miniconda3-latest-Linux-x86_64.sh

でMiniconda3をインストール。PATHだけ、自分が管理しやすい場所(~/local/Miniconda3)に指定しました。

$ rm Miniconda3-latest-Linux-x86_64.sh #いらないのでshファイルは削除
$ source ~/.bashrc #.bashrcの再読み込み
$ conda -h

でヘルプメニューが帰ってくればOK。次にBiocondaなどのchannelを追加します。

$ conda config --add channels defaults
$ conda config --add channels conda-forge
$ conda config --add channels r
$ conda config --add channels bioconda

これは順番が大事らしく、最後に追加されたチャンネルからパッケージの検索をかけるのでよく使うチャンネルを最優先(最後)にした方がいい?と思われる(参考)。

順番を間違えてしまっても、もう一回--add channelsすれば最優先になるっぽいので焦らない。

後は

$ conda install -c bioconda samtools

という感じでツールを入れていく。

ツールの管理法

他の人がどう管理しているのか気になりますが、

  • パソコンに詳しくない後輩がいじる

  • そもそも僕も余り詳しくない

  • でも、PCの設定は把握しておきたい

という理由で、UbuntuPCをホームディレクトリ内にsettingというファイルを作成し、PCの設定をいじったら追記していくという管理法をしています。

具体的には、

$ conda install -c bioconda samtools

でsamtoolsをインストールした場合、

2020/10/12 samtools
$ conda install -c bioconda samtools

と追記するという感じです。

他のルールとしては、

  • 設定をいじった時は日付といじった時のコードを、ツールのインストール記載箇所の下に追記する

  • ファイルを書き換えた場合は

>>ファイル名
追記した内容(ドル記号は無し)

を守るようにしています。

意外とわかりやすいですよ。

Githubに入れておくので共有します。

biocondaに入れているツール一覧

2021/1/22現在

2020/10/12 Miniconda3
$ mkdir miniconda
$ cd miniconda
$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ bash Miniconda3-latest-Linux-x86_64.sh
> PATH -> /home/*****/local/Miniconda3
reboot terminal
$ conda config --add channels defaults
$ conda config --add channels conda-forge
$ conda config --add channels r
$ conda config --add channels bioconda

2020/10/12 sratoolkit
$ conda install -c bioconda sra-tools


2020/10/12 Trim galore!
$ conda install -c bioconda trim-galore


2020/10/12 kallisto
$ conda install -c bioconda kallisto


2020/10/12 samtools
$ conda install -c bioconda samtools


2020/10/12 lftp
$ brew install lftp


2020/10/12 star
$ conda install -c bioconda star


2020/10/12 rsem
$ conda install -c bioconda rsem


2020/10/12 fastp
$ conda install -c bioconda fastp


2020/10/12 bowtie2
$ conda install -c bioconda bowtie2


2020/10/12 macs2
$ conda install -c bioconda macs2


2020/10/12 homer
$ conda install -c bioconda homer


2020/10/12 deeptools
$ conda install -c bioconda deeptools


2020/10/12 bedtools
$ conda install -c bioconda bedtools


2020/10/12 isoseq3
$ conda install -c bioconda isoseq3


2020/10/12 hisat2
$ conda install -c bioconda hisat2


2020/10/12 subread(featureCounts)
$ conda install -c bioconda subread


2020/10/12 stringTie
$ conda install -c bioconda stringtie

bioconda以外のsetting内の内容

これも2021/01/22現在

#過去記事参照→https://wet-to-dry.hatenablog.com/entry/ssh_to_lab2
2020/10/09 ssh
user@user$ ssh-keygen -t rsa
user@user$ scp C:\\Users\\user\\.ssh\\id_rsa.pub *****@*****:~/
>> C:\\Users\\user\\.ssh\\config
Host *****
HostName **.***.***.***
User *****
Port 22
IdentityFile C:\\Users\\user\\.ssh\\id_rsa
user@user$ ssh *****
*****@*****$ sudo apt-get install openssh-server
*****@*****$ mkdir .ssh
*****@*****$ chmod 700 .ssh
*****@*****$ mv ~/id_rsa.pub ~/.ssh/authorized_keys
*****@*****$ chmod 600 .ssh/authorized_keys
or
*****@*****$ cat id_rsa.pub >> .ssh/authorized_keys


#過去記事参照→https://wet-to-dry.hatenablog.com/entry/linux-log:embed:cite
2020/10/06 start
>>~/.bashrc
# start alias
alias start="bash /home/*****/local/setting/alias/start.sh"
$ mkdir -p ~/local/setting/alias
$ mkdir ~/local/log
>> ~/local/setting/alias/start.sh
#!/bin/sh
# for make log file
today=$(date "+%Y%m%d-%H%M")
folder=$(basename `pwd`)
echo "Hello! Welcome to ***** PC (¥v¥)/"
echo "what is your name?"
read name
logfilename=${today}-${name}-${folder}
script /home/*****/local/log/${logfilename}.txt


2020/10/09 linuxbrew
$ sudo apt-get install build-essential curl file git
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
$ test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
$ test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
$ echo "eval $($(brew --prefix)/bin/brew shellenv)" >>~/.profile
$ brew install sl


2020/10/12 trash-cli
$ brew install trash-cli
>> ~/.bashrc
# trash-cli
alias rm="trash-put"

まとめ

最近解析できてないです。

緊急事態宣言でロックダウンしたら、自宅でこれやりたいなあ。

参考文献

imamachi-n.hatenablog.com

pharm-programmer.net

*1:うちはあまりお金がないのでもっぱら先行研究のデータですが