*演習3:Unixライク環境での系統解析:Bayes法と最尤法による系統推定 [#p038c5c7]
**ソフトウェアの準備:Windows用の解析ソフトウェア [#rbc9a738]
以下のソフトウェアは、Windowsのグラフィカルインターフェースで使用でき、Cygwinと組み合わせて使うと便利なものばかりです。この演習で使うので、ダウンロードしてインストールしておきましょう。
//-MESQUITE http://mesquiteproject.org/mesquite/mesquite.html
//--JRE5 Mesquiteに必要な、Java 環境 http://java.sun.com/javase/downloads/index_jdk5.jsp~
//Java Runtime Environment (JRE) 5.0 (2009年1月時点ではUpdate 17)をダウンロードしてインストール。
-Bioedit http://www.mbio.ncsu.edu/BioEdit/bioedit.html

**モデルの選択とベイズ法による解析: Choose model by Mrmodeltest, and perform Bayesian analysis [#sb222f02]
>[[Cygwinを用いたUnixライク環境の体験>http://bean.bio.chiba-u.jp/lab/index.php?%E6%8E%88%E6%A5%AD%2FH19%2F%E7%B3%BB%E7%B5%B1%E8%A7%A3%E6%9E%90%E8%AB%96%2Fcygwin#xb512a1a]]の説明に従って、MrModeltestとMrBayesを、Cygwinの/usr/local/binディレクトリに入れておく。~
Before starting, store executable files of MrModeltest and MrBayes in /usr/local/bin of Cygwin directory.  See the explanations in the page linked above.

***それぞれの領域に対して、モデルの選択を行う: Choose model for each genetic region [#cbc60de2]
-先にセーブしておいた、遺伝子領域ごとのNEXSUSファイルをPAUP*で開く。(例えば、rbcl.nexをPAUP*でedit modeで開く)~
Open each of NEXSUS file by PAUP* (open rbcl.nex by PAUP* in edit mode)
-Mrmodeltestのマニュアルか、ホームページにある[[Mrmodelblock>http://www.abc.se/~nylander/mrmodeltest2/MrModelblock]]をコピーして、上のファイル(rbcl.nex)の最後("end;"の後)にペーストする。~
Copy MrModelblock from the web page of MrModeltest, or the pdf manual of MrModeltest, and past it into the last (after "end;") of the nexus fiile.  Save.
-PAUP*でexecuteすると、mrmodel.scoresというファイルが同じディレクトリ(c:¥cygwin/home/user1を想定している)に保存される。~
Execute the file in PAUP*.  A file named "mrmodel.scores" will be appear in the same directory with the data file ("rbcl.nex" in this example.  The directory would be your user directory  c:¥cygwin/home/)
-Cygwinを起動して、以下のコマンドを入力~
Launch Cygwin and input the next command.
 mrmodeltest2 < mrmodel.scores > rbcl.out
-rbcl.outというファイルが同じディレクトリに作られる。このファイルを見れば、その遺伝子領域に適したモデルが分かる。Cygwinで~
A file named "rbcl.out" will be appeared in the same directory.  You can see the appropriate model for the sequence data.  Just input an UNIX command "less" as following to see the contents of the file.  Type "q" to quite.
 less rbcl.out
と入力すると、中身が簡単に閲覧できる。終了するときは q とタイプ。
-同様に、他の2つのNEXUSファイルについても操作を行っておく(rps16.out, its.outというファイルを作っておく)。3つのファイルは次のステップで使用する。~
Do the same for other two nexus files of rps16 and ITS.

***MrBayes用にNEXSUS形式ファイルを編集し、パーティション別のモデルを選択: Setting up partitions [#h7670f41]
-上で作成した3領域の連結ファイル (3genes.nex)をPAUP*でedit modeで開く~
Open the connected sequence (3genes.nex) by PAUP* in edit mode.
-[[MrBayesのチュートリアル>http://mrbayes.scs.fsu.edu/wiki/index.php/Tutorial#Quick_Start_Version]]やマニュアルを参考にしながら、ファイルを編集。~
Edit the file follwoing the instruction of the tutorials of MrBayes (linked above).
--begin blockの最初の部分は次のようにする。interleaveのオプションは(=yes, =no)のいずれかで設定されていることを確認。[]で囲まれた余分なコメントは削除しておいて良い。
~NOTICE: interleave option should be determined by (=yes or =no).
 begin data;
  dimensions ntax=10 nchar=2014;
  format datatype=dna interleave=yes missing=-;
   matrix

-ファイルの一番最後の "end;"の後に、次のブロックを追加する。下の説明の#以下は、解析ファイルでは消しておく~
Add the following information at the end of the file.  You must delete comments after "#" in the following example.
 begin mrbayes;
 log start filename = 3genes.log replace;
 charset rbcL = 1-636;                    #それぞれの配列データをサイトポジションで指定
 charset rps16 = 637-1378;         #these numbers are the site position. You can know them in each of nexus file.
 charset ITS = 1379-2014;           #the names of partitions should be the same as used in the next line
 partition favored = 3: rbcL, rps16, ITS;     #3つのパーティションに分けるということ; divided into trhee partitions
 set partition = favored;
 lset applyto=(1,3) nst=6 rates=gamma;     #rbcLとITSのモデル設定
 lset applyto=(2) nst=6 rates=equal;            #(2) means the second partion.  rps16 in this example
 prset applyto=(1,3) statefreqpr=fixed(equal);   # you will get all the lset and prset from the ..out file of Mrmodeltest 
 prset applyto=(2) statefreqpr=dirichlet(1,1,1,1);  
 mcmc ngen=10000 printfreq=1000 samplefreq=100
 nchains=4 savebrlens=yes filename=MyFile;
--このうち、3行目以降が3つの遺伝子領域に対して、それぞれに異なるモデルを使う設定~
Setting for the three partitions are after the third line.  
--先ほどMrmodeltestで解析したときにできた出力ファイル: rbcl.outとかrps16.outを開くと、下の方に MrBayes settingという項目があり、そこに~
Open the output file of Mrmodeltest (rbcl.out for example), and you will find MrBayes setting and see:
 Prset statefreeqpr=fixed(equal);
 Lset nst=6 rates=gamma;
等と書かれている。そのモデルをそれぞれ applyto=(2)などとして書き込めば良い。~
Copy the lines and add "applyto=(2)" as the setting is for the second partition.
-Cygwinでこのファイルの入ったディレクトリに移動して、mrbayesと入力すれば、MrBayesが立ち上がる。 ~
Launch cygwin and move to the data directory.  type mrbayes to start MrBayes.
 execute 3genes.nex
と入力すると解析が始まる。~
Analysis will be started with the command above.  Be careful for the path to the data file.
-とりあえず、系統樹を表示させるには、次のコマンドを入力~
With the next command, you can see an instant  phylogenetic tree.
 sumt burnin=10
-ベイズ法の詳しい解析と上のコマンドの解説は宮先生の授業で。~
More detail explanation on Bayesian analysis and each of setting will be done in the class of Dr. Miya.