読者です 読者をやめる 読者になる 読者になる

山ブログ

山間部

どうしてもPBHoneyをmacOS Sierraで動かしたい時

ゴール: macOS SierraでPBHoneyを動かす。

Softwares

Environment

  • macOS 10.12.3 (Sierra)
  • XCode 8.2.1 & Command Line Tools for XCode
  • homebrew

Install Blasr

blasr 1.3.1をインストールする。ただし、Blasr 1.3.1はclangでビルドできない

macOSgccはclangなので、まずGCC 5を入れる。 5を入れたのは上のリンクで成功したと言っている人がいたから。

brew install gcc@5

次に、HDF5 1.8.14 をビルドして、brewのCellerに突っ込んでlinkしておく。

wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8.14/src/hdf5-1.8.14.tar.gz
tar -xvvzf hdf5-1.8.14.tar.gz
cd hdf5-1.8.14
mkdir -p /usr/local/Cellar/hdf5/1.8.14
CC=gcc-5 CXX=g++-5 ./configure --prefix /usr/local/Cellar/hdf5/1.8.14 --enable-cxx
make
make install
brew link hdf5          # hdf5をインストールして**いない**場合
brew switch hdf5 1.8.14 # hdf5をインストールして**いる**場合

Blasrをインストールする

mkdir -p /usr/local/Cellar/blasr/2.2
cd blasr-smrtanalysis-2.2/
make HDF5INCLUDEDIR=/usr/local/opt/hdf5/include \
     HDF5LIBDIR=/usr/local/opt/hdf5/lib \
     CC=gcc-5 CXX=g++-5
# Homebrewはblasrのバージョンをurlから推測するので、
# Homebrew的には2.2
make install PREFIX=/usr/local/Cellar/blasr/2.2
brew link blasr

確認

blasr -version

以下の通り表示されれば成功

blasr   1.3.1

Install Samtools

samtools (0.1.17)をインストールする。

mkdir -p /usr/local/Cellar/samtools/0.1.17/bin/
wget -Osamtools-0.1.17.tar.gz https://github.com/samtools/samtools/archive/0.1.17.tar.gz
tar -xvvzf samtools-0.1.17.tar.gz
cd samtools-0.1.17
make CC=gcc-5
cp samtools /usr/local/Cellar/samtools/0.1.17/bin/
brew link samtools

Install pysam, numpy, h5py

pip install pysam numpy h5py

Install PBSuite

HOMEBREW_CC=gcc-5 HOMEBREW_CXX=g++-5 brew install pbsuite

~/.bash_profile(もしくは使ってるシェルの設定)にPYTHONPATHを書いておく

export PYTHONPATH=/usr/local/opt/pbsuite:$PYTHONPATH

反映する

source ~/.bash_profile

Run Workflow

HoneyReadme.txtを読む。

pyenvのようなものを使っている人は2.7系にスイッチしておくこと。

pyenv shell 2.7.13

試しにワークフローを走らせる。

cd /usr/local/Cellar/pbsuite/14.7.14/docs/honeyExample
./workflow.sh

特にエラーがでなければOK. 以下の通り。

Mapping
[INFO] 2017-03-11T15:06:44 [blasr] started.
[INFO] 2017-03-11T15:07:21 [blasr] ended.
Extracting Tails
2017-03-11 15:07:21,634 [INFO] Running /usr/local/bin/Honey.py pie mapping.sam lambda_modified.fasta
2017-03-11 15:07:21,634 [INFO] Extracting tails
2017-03-11 15:07:21,904 [INFO] Parsed 413 reads
2017-03-11 15:07:21,905 [INFO] Found 250 tails
2017-03-11 15:07:21,905 [INFO] 13 reads had double tails
2017-03-11 15:07:21,905 [INFO] Mapping Tails
2017-03-11 15:07:29,754 [INFO] [0, '[INFO] 2017-03-11T15:07:21 [blasr] started.\n[INFO] 2017-03-11T15:07:29 [blasr] ended.\n', None]
2017-03-11 15:07:29,754 [INFO] Consolidating alignments
2017-03-11 15:07:29,796 [INFO] 170 tails mapped
Sam To Bam
[samopen] SAM header is present: 1 sequences.
Calling MD Tag
[fai_load] build FASTA index.
Calling Tails
2017-03-11 15:07:31,010 [INFO] Running /usr/local/bin/Honey.py tails mappingFinal.bam
2017-03-11 15:07:31,012 [INFO] Parsing Reads
2017-03-11 15:07:31,039 [INFO] Writing Results
2017-03-11 15:07:31,039 [INFO] Chrom lambda_NEB3011_lambda_NEB3011 made 113 pre-filter clusters
2017-03-11 15:07:31,041 [INFO] Chrom lambda_NEB3011_lambda_NEB3011 made 5 post-filter clusters
2017-03-11 15:07:31,041 [INFO] Finished
Calling Spots
2017-03-11 15:07:31,662 [INFO] Running /usr/local/bin/Honey.py spots mappingFinal.bam
2017-03-11 15:07:31,678 [INFO] making container for lambda_NEB3011 (lambda_NEB3011:0-48802 48802 bp)
2017-03-11 15:07:31,681 [INFO] parsing bam
2017-03-11 15:07:31,699 [INFO] 583 reads to parse
2017-03-11 15:07:31,746 [INFO] parsed 18 reads (3 % complete)
2017-03-11 15:07:31,766 [INFO] parsed 24 reads (4 % complete)
2017-03-11 15:07:31,786 [INFO] parsed 30 reads (5 % complete)
...
2017-03-11 15:07:32,970 [INFO] parsed 572 reads (98 % complete)
2017-03-11 15:07:32,976 [INFO] parsed 578 reads (99 % complete)
2017-03-11 15:07:32,982 [INFO] parsed 583 reads (100 % complete)
2017-03-11 15:07:32,982 [INFO] parsed 583 reads
2017-03-11 15:07:32,998 [INFO] calling spots
2017-03-11 15:07:33,034 [INFO] MaxCov:32 MeanCov:16 StdCov:5 MinCov:0
2017-03-11 15:07:33,034 [INFO] MIS processing
2017-03-11 15:07:33,046 [INFO] RateMean 0.042394  -- RateStd  0.010260
2017-03-11 15:07:33,049 [INFO] MaxSig: 0.040435 MeanSig: 0.000013 StdSig 0.005060 MinSig: -0.052323
2017-03-11 15:07:33,049 [INFO] 0 MIS entries
2017-03-11 15:07:33,050 [INFO] INS processing
2017-03-11 15:07:33,063 [INFO] RateMean 0.000718  -- RateStd  0.002610
2017-03-11 15:07:33,067 [INFO] MaxSig: 0.045733 MeanSig: 0.000000 StdSig 0.002097 MinSig: -0.046218
2017-03-11 15:07:33,069 [INFO] 1 INS entries
2017-03-11 15:07:33,070 [INFO] DEL processing
2017-03-11 15:07:33,081 [INFO] RateMean 0.044015  -- RateStd  0.052830
2017-03-11 15:07:33,082 [INFO] MaxSig: 0.396365 MeanSig: 0.000004 StdSig 0.024411 MinSig: -0.428616
2017-03-11 15:07:33,083 [INFO] 1 DEL entries
2017-03-11 15:07:33,083 [INFO] Filtering INS results
2017-03-11 15:07:33,121 [INFO] found 1 spots
2017-03-11 15:07:33,131 [INFO] finished 583 reads
2017-03-11 15:07:33,132 [INFO] finished 1 spots