linux中mpich的运行线程,贝叶斯法构建进化树:MrBayes
1. 簡介
使用貝葉斯法構建進化樹的軟件有很多。在這里簡要介紹MrBayes的安裝和使用。以下介紹是對幾種貝葉斯法構建進化樹軟件的簡介:
MrBayes is a program for Bayesian inference and model choice across a wide range of phylogenetic and evolutionary models. MrBayes uses Markov chain Monte Carlo (MCMC) methods to estimate the posterior distribution of model parameters.
BAMBE A nice program by Bret Larget and Donald Simon for the Bayesian inference of phylogeny.
Mac5 A program by Paul-Michael Agapow that deals with gaps as a fifth state.
Beast BEAST, written by Alexei Drummond and Andrew Rambaut, is a cross-platform program for Bayesian MCMC analysis of molecular sequences. It is particularly good for molecular clock analyses.
PHASE Paul Higgs is the author of Phase, designed specifically for use with RNA sequences that have a conserved secondary structure, e.g. rRNA and tRNA.
2. MrBayes的安裝
通過MrByes官網:http://mrbayes.sourceforge.net/來下載MrBayes軟件并安裝。軟件包中有其PDF格式的Manual。在windows系統下的MrBayes不能支持多線程運行,在Linux下則能很好地進行并行運算。
MrBayes的安裝過程需要注意:其src文件夾的源碼文件中有個名為CompileInstructions.txt的文件,介紹了如何進行軟件的安裝。
$ sudo yum install openmpi* mpi*
$ wget http://sourceforge.net/projects/mrbayes/files/latest/download?source=files
$ tar zxf mrbayes-3.*.*.tar.gz
$ cd mrbayes_3.*.*/src
$ autoconf
$ ./configure --with-beagle=no --enable-mpi=yes
$ make -j 8
$ sudo cp mb /usr/local/bin (optional)
以下是使用MrBayes的指令,單線程或多線程運行MrBayes.
$ ./mb
$ cat > ~/.mpd.conf
MPD_SECRETWORD=mr45-j9z
$ chmod 600 ~/.mpd.conf
$ mpd &
$ mpirun -np 8 ./mb
MrBayes v3.2.1 x64
(Bayesian Analysis of Phylogeny)
(Parallel version)
(24 processors available)
Distributed under the GNU General Public License
Type "help" or "help " for information
on the commands that are available.
Type "about" for authorship and general
information about the program.
MrBayes >
附加使用心得
1. 使用多線程版本得到的樹狀圖和單線程版本的樹狀圖完全不一樣,差別太大。多線程版本的樹狀圖完全是所有的分支都集合到一個點上,而單線程的就正常了。這可能是由于不會使用多線程運行MrBayes的原因 或 軟件在多線程下的運算方法不好(可能性很小)
2. 在使用MrBayes 3.2.1版本中,發現默認下得出的tree文件中在treeview軟件中顯現不出后驗概率,而3.1.2版本有。
3. 但是在64位的Linux系統中使用3.1.2版本總是會Crash (core dumped)。幸好在此網頁中找到了解決方法:Bioinformatics applications at University of Canterbury HPC。
需要對Mrbayes安裝包中多個文件進行修改,方法就是打個補丁:mb_64bit_safe.patch,再以64位的參數來make。步驟如下:
$ wget http://sourceforge.net/projects/mrbayes/files/mrbayes/3.1.2/mrbayes-3.1.2.tar.gz
$ tar zxf mrbayes-3.1.2.tar.gz
$ cd mrbayes-3.1.2
$ wget https://technical.bestgrid.org/images/7/73/Mb_64bit-safe.patch.txt
$ patch -R -p 1 < Mb_64bit-safe.patch.txt
$ OBJECT_MODE=64 make _64BIT=yes
至此,則運行MrBayes正常了。
3. MrBayes的簡單教程
3.1 使用MrBayes來做一個典型的 Bayesian phylogenetic analysis,包括4個步驟:
a. Read the Nexus data file
b. Set the evolutionary model
c. Run the analysis
d. Summarize the samples
3.2 MrBayes分步演示
1. 導入nex文件.本案例使用多線程運行的演示,使用24個CPU運行程序。
$ mpd &
$ mpirun -np 24 mb
MrBayes > execute example.nex
2. 設置進化模型參數.本例中設定數據為DNA數據.
MrBayes > lset nst=6 rates=invgamma
3.1 主程序運行。
以下命令中nchains的值要 >= 設置使用CPU數。在單線程運行的時候可以不需要設置,而在多線程運行的時候不設置則會報錯;ngen則是運行的長度,默認1,000,000次;samplefreq則是取樣頻率,每隔多少次運行次數取一次樣;printfreq是打印頻率,即每運行多少次將打印一行結果到屏幕上,默認為500;diagnfreq則代表每運行多少次分析一次結果,得出 Average standard deviation of split frequencies,默認是5,000.
運行時,會在輸出到屏幕的最后一列看到預測的程序剩余運行時間。
MrBayes > mcmc nchains=24 ngen=2000000 samplefreq=1000 printfreq=500 diagnfreq=5000
3.2 如果在設定的代數運行完畢后,給出的 Average standard deviation of split frequencies的值小于0.01,則根據提示輸入‘no'來停止運行,反之則輸入'yes'繼續運行直到滿足其值小于0.01為止。
If you are intersted mainly in the well-supported parts of the tree, a standard deviation below 0.05 may be adequate.
4.1 使用sump來對參數值進行歸納。設置的burnin值為 (ngen / samplefreq) * 0.25 。程序給出一個概括的表,要確保PSRF一列中的值接近 1.0,否則需要運行該多的代數。
MrBayes > sump burnin=500
4.2 使用sumt來構樹。burnin值和前一個相同
MrBayes > sumt burnin=500
4. 詳細的MrBayes使用教程
4.1 將數據導入到MrBayes
MrBayes導入的數據為Nexus文件,該文件可以有4中數據類型:aligned nucleotide or amino acid sequences, morphological ("standard") data, restriction site (binary) data。Nexus文件中可以混合有這4種數據。
Nexus數據文件通常由其它程序產生,比如 Mesquite。文件以 nex 為后綴。
使用 execute fielename 或 exe filename將文件中的數據導入到MrBayes中。
4.2 指定模型
總結
以上是生活随笔為你收集整理的linux中mpich的运行线程,贝叶斯法构建进化树:MrBayes的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux如何调试elf程序,Linux
- 下一篇: 嵌入式开发linux工具,嵌入式Linu