OrthoFinder尋找同源基因并建樹

  • 提到尋找物種之間的同源基因,大家一般想到的是OrthoMCL (http://orthomcl.org/orthomcl/) ,OrthoMCL是現(xiàn)在用的最多的一款來找直系同源基因(Orthologs)以及旁系同源基因 (Paralog) 的軟件。
  • 但是OrthoMCL 的最新版本是2013年7月公布的v2.0版本,已經(jīng)很久沒更新過了。根據(jù)官網(wǎng)的教程至少得十多步才能完成整個(gè)運(yùn)行流程,包括Mysql數(shù)據(jù)庫(kù)配置、修改OrthoMCL配置文件、轉(zhuǎn)換序列格式、過濾、比對(duì)、解析結(jié)果和聚類等步驟,特別繁瑣。

于是OrthoFinder(https://github.com/davidemms/OrthoFinder)這個(gè)軟件應(yīng)運(yùn)而生,OrthoFinder是一個(gè)快速尋找同源基因,并可選擇快速建樹的軟件,基于python3編寫。該軟件安裝運(yùn)行十分簡(jiǎn)單,且自2015年發(fā)布第一個(gè)版本,到目前仍在持續(xù)更新。

一、OrthoFinder的安裝

1.通過anaconda安裝(推薦)

anaconda應(yīng)該是生信分析中必不可少的軟件,具體在此不多贅述,anaconda安裝教程移步(http://www.lxweimin.com/p/62f155eb6ac5),在anaconda中安裝OrthoFinder的命令為

conda install -y orthofinder

安裝完成后輸入orthofinder可查看其幫助文檔即為成功


OrthoFinder version 2.2.7 Copyright (C) 2014 David Emms

SIMPLE USAGE:
Run full OrthoFinder analysis on FASTA format proteomes in <dir>
  orthofinder [options] -f <dir>

Add new species in <dir1> to previous run in <dir2> and run new analysis
  orthofinder [options] -f <dir1> -b <dir2>

OPTIONS:
 -t <int>          Number of parallel sequence search threads [Default = 16]
 -a <int>          Number of parallel analysis threads [Default = 1]
 -M <txt>          Method for gene tree inference. Options 'dendroblast' & 'msa'
                   [Default = dendroblast]
 -S <txt>          Sequence search program [Default = blast]
                   Options: blast, mmseqs, blast_gz, diamond
 -A <txt>          MSA program, requires '-M msa' [Default = mafft]
                   Options: muscle, mafft
 -T <txt>          Tree inference method, requires '-M msa' [Default = fasttree]
                   Options: iqtree, raxml-ng, fasttree, raxml
 -s <file>         User-specified rooted species tree
 -I <int>          MCL inflation parameter [Default = 1.5]
 -x <file>         Info for outputting results in OrthoXML format
 -p <dir>          Write the temporary pickle files to <dir>
 -1                Only perform one-way sequence search
 -n <txt>          Name to append to the results directory
 -h                Print this help text

WORKFLOW STOPPING OPTIONS:
 -op               Stop after preparing input files for BLAST
 -og               Stop after inferring orthogroups
 -os               Stop after writing sequence files for orthogroups
                   (requires '-M msa')
 -oa               Stop after inferring alignments for orthogroups
                   (requires '-M msa')
 -ot               Stop after inferring gene trees for orthogroups

WORKFLOW RESTART COMMANDS:
 -b  <dir>         Start OrthoFinder from pre-computed BLAST results in <dir>
 -fg <dir>         Start OrthoFinder from pre-computed orthogroups in <dir>
 -ft <dir>         Start OrthoFinder from pre-computed gene trees in <dir>

LICENSE:
 Distributed under the GNU General Public License (GPLv3). See License.md

CITATION:
 When publishing work that uses OrthoFinder please cite:
 Emms D.M. & Kelly S. (2015), Genome Biology 16:157

 If you use the species tree in your work then please also cite:
 Emms D.M. & Kelly S. (2017), MBE 34(12): 3267-3278
 Emms D.M. & Kelly S. (2018), bioRxiv https://doi.org/10.1101/267914

2.通過下載安裝

1.從GitHub下載最新版本的下載OrthoFinder 下載(這里我以O(shè)rthoFinder-2.2.7.tar.gz為例)

2.在終端解壓orthofinder壓縮包:

tar xzf OrthoFinder-2.2.7.tar.gz

3.安裝OrthoFinder的依賴程序:
這里需要安裝的有:MCL, FastME and DIAMOND
具體程序下載和安裝教程可在其官網(wǎng)查看:
MCL: http://micans.org/mcl/
FastME:http://www.atgc-montpellier.fr/fastme/binaries.php
DIAMOND:https://github.com/bbuchfink/diamond/releases

4.測(cè)試OrthoFinder:
用終端打開OrthoFinder所在文件夾,運(yùn)行:

./orthofinder -f ExampleDataset -S diamond

5.加入orthofinder到環(huán)境變量(可選)

二、OrthoFinder的使用

OrthoFinder需要蛋白編碼的Fasta文件作為輸入,所以首先我們準(zhǔn)備好要比對(duì)的物種的蛋白序列,存入一個(gè)文件夾。

1.典型用法:

orthofinder -f Dataset

其中:
-f 指定蛋白序列所在的文件夾(這里我的文件夾名為Dataset)
此命令僅需指定輸入文件夾,其余為默認(rèn)參數(shù)。

2.進(jìn)階用法:

在OrthoFinder中我們可以通過不同的參數(shù)指定比對(duì)過程中使用的方法和其他參數(shù)設(shè)置,下面列出常用的幾個(gè)參數(shù):

常用參數(shù):

-t 序列搜索使用的線程數(shù) (默認(rèn)值為16)

-a 序列分析使用的線程數(shù) (默認(rèn)值為1)

-M 基因樹推斷方法(默認(rèn)為dendroblast)可選:dendroblast ,msa

-S 序列比對(duì)使用的程序 (默認(rèn)為Blast)可選:blast, mmseqs, blast_gz, diamond(推薦使用diamond,比對(duì)速度快)

-A 多序列聯(lián)配方式,該選項(xiàng)僅當(dāng) -M msa 選項(xiàng)時(shí)才有效(默認(rèn)為mafft)可選:muscle, mafft

-T 建樹方式,該選項(xiàng)僅當(dāng) -M msa 選項(xiàng)時(shí)才有效 (默認(rèn)為fasttree)可選:iqtree, raxml-ng, fasttree, raxml

-s 輸入特定的根物種樹

-I 設(shè)定MCL的膨脹系數(shù)(默認(rèn)為1.5)

有時(shí)候我們不需要運(yùn)行整個(gè)從蛋白序列到建樹的整個(gè)流程,我們能只需要運(yùn)行其中的部分并得到其結(jié)果,那么就可以選擇分步運(yùn)行

分步運(yùn)行:

停止選項(xiàng)

-op blast比對(duì)后停止運(yùn)行

-og 推斷同源組后停止運(yùn)行

-os 同源組寫入序列文件后停止運(yùn)行(需要-M msa選項(xiàng))

-oa 推斷同源組序列比對(duì)后停止運(yùn)行(需要-M msa選項(xiàng))

-ot 推斷同源組基因樹后停止運(yùn)行

開始選項(xiàng)

-b <blast結(jié)果文件夾 > 從blast結(jié)果開始運(yùn)行

-fg <同源組結(jié)果文件夾> 從同源組結(jié)果開始運(yùn)行

-ft <基因樹文件夾> 從基因樹文件開始運(yùn)行

最后說一下我一般常用的參數(shù),我做動(dòng)物研究,一般數(shù)據(jù)較多較大,比對(duì)我選擇Diamond,建樹選擇fasttree,多序列比對(duì)msa,線程數(shù)由于設(shè)備限制,設(shè)置為16

orthofinder -f Dataset -M msa -S diamond -t 16 -a 16 

可參照下圖更直觀理解:

參數(shù)圖解

3.高級(jí)用法:

通過上面的參數(shù),我們可以做一個(gè)從蛋白序列到同源基因建樹的流程,但是仍然有一些參數(shù)無法設(shè)置,比如建樹過程中的bootstrap。這時(shí)候,我們就要修改程序的config.json文件。

如果你是用anaconda安裝的orthofinder,那么config.json文件在:

anaconda2/bin/config.json

如果你通過下載壓縮包安裝,config.json文件就在orthofinder目錄里。

首先我們打開config.json文件

{
    "__comment": "Variable names that can be used:",
    "__comment": "INPUT : The full path of the input filename (fasta file of sequences for and msa method, multiple sequence alignment fasta file for tree method)",
    "__comment": "BASENAME : Just the filename without the directory path (a number of methods use this to name the output file automatically, see MergeAlign command for an example)",
    "__comment": "PATH : Path to the directory containing the input file",
    "__comment": "OUTPUT : The full path of the user specified output filename",
    "__comment": "BASEOUTNAME : Just the filename without the directory path (of the output filename)",
    "__comment": "IDENTIFIER : A name generated by OrthoFinder to uniquely identify the orthogroup (a number of methods use this to name the output file automatically, see RAxML command for an example). Not applicable for program_type search.",
    "__comment": "DATABASE : For the search program_type, for use in the search_cmd. The full path of the database to search against",
              
    "muscle":{ 
    "program_type": "msa",
    "cmd_line": "muscle -in INPUT -out OUTPUT"
    },
        
    "raxml":{ 
    "program_type": "tree",
    "cmd_line": "raxmlHPC-AVX -m PROTGAMMALG -p 12345 -s INPUT -n IDENTIFIER -w PATH > /dev/null",
    "ouput_filename": "PATH/RAxML_bestTree.IDENTIFIER"
    },
    
    "raxml-ng":{ 
    "program_type": "tree",
    "cmd_line": "raxml-ng --msa INPUT --model LG+G4 --seed 12345 --threads 1",
    "ouput_filename": "INPUT.raxml.bestTree"
    },

    "iqtree":{ 
    "program_type": "tree",
    "cmd_line": "iqtree -s INPUT -pre PATH/IDENTIFIER > /dev/null",
    "ouput_filename": "PATH/IDENTIFIER.treefile"
    },
    
    "diamond":{ 
    "program_type": "search",
    "db_cmd": "diamond makedb --in INPUT -d OUTPUT",
    "search_cmd": "diamond blastp -d DATABASE -q INPUT -o OUTPUT --more-sensitive -p 1 --quiet -e 0.001 --compress 1"
    },
        
    "blast_gz":{ 
    "program_type": "search",
    "db_cmd": "makeblastdb -dbtype prot -in INPUT -out OUTPUT",
    "search_cmd": "blastp -outfmt 6 -evalue 0.001 -query INPUT -db DATABASE | gzip > OUTPUT.gz"
    },
    
    "mmseqs":{ 
    "program_type": "search",
    "db_cmd": "mmseqs createdb INPUT OUTPUT.fa ; mmseqs createindex OUTPUT.fa /tmp",
    "search_cmd": "mmseqs search PATH/mmseqsDBBASENAME DATABASE.fa OUTPUT.db /tmp/tmpBASEOUTNAME  --threads 1 ; mmseqs convertalis PATH/mmseqsDBBASENAME DATABASE.fa OUTPUT.db OUTPUT"
    }
}

文件開頭介紹了修改方法,你可以添加任何你想在流程中使用的軟件,只要按照其格式進(jìn)行命令修改就行。這里主要說一下對(duì)其中緣由參數(shù)的修改。

如要修改比對(duì)過程中的E-value值,那么在相應(yīng)比對(duì)命令里修改數(shù)值,blast_gz 里的 -evalue ,diamond 里的 -e 。

如要在iqtree建樹過程中增加bootstrap, 則在iqtree的"cmd_line":中添加

-bb 1000 (iqtree的超快bootstrap)或 -b 1000(傳統(tǒng)bootstrap)

raxml-ng類似,你可以添加任何你想修改的參數(shù),大家可以在熟悉各軟件的的參數(shù)后,根據(jù)自己的需求更改。

三、OrthoFinder的結(jié)果解讀

程序運(yùn)行結(jié)束后,會(huì)在你指定的蛋白序列文件夾中生成一個(gè)Results_*** 文件夾,其中***是運(yùn)行日期

直系同源組相關(guān)結(jié)果文件,將不同的直系同源基因進(jìn)行分組:
  • Orthogroups.csv:用制表符分隔的文件,每一行是直系同源基因組對(duì)應(yīng)的基因。
  • Orthogroups.txt: 類似于Orthogroups.csv,只不過是OrhtoMCL的輸出格式
  • Orthogroups_UnassignedGenes.csv: 格式同Orthogroups.csv,只不過是物種特異性的基因
  • Orthogroups.GeneCount.csv:格式同Orthogroups.csv, 只不過不再是基因名信息,而是以基因數(shù)。
直系同源相關(guān)文件,分析每個(gè)直系同源基因組里的直系同源基因之間關(guān)系,結(jié)果會(huì)在Orthologues_***文件夾下,其中***是日期:
  • Gene_Trees: 每個(gè)直系同源基因基因組里的基因樹
  • Recon_Gene_Trees:使用OrthoFinder duplication-loss coalescent 模型進(jìn)行發(fā)育樹推斷
  • Potential_Rooted_Species_Trees: 可能的有根物種樹
  • SpeciesTree_rooted.txt: 從所有包含STAG支持的直系同源組推斷的STAG物種樹
  • SpeciesTree_rooted_node_labels.txt: 同上,只不過多了一個(gè)標(biāo)簽信息,用于解釋基因重復(fù)數(shù)據(jù)。
比較基因組學(xué)的相關(guān)結(jié)果文件:
  • Orthogroups_SpeciesOverlaps.csv: 不同物種間的同源基因的交集
  • SingleCopyOrthogroups.txt: 單基因拷貝組的編號(hào)
  • Statistics_Overall.csv:總體統(tǒng)計(jì)信息
  • Statistics_PerSpecies.csv:分物種統(tǒng)計(jì)信息

最后就可以利用以上結(jié)果,繼續(xù)愉快地做分析啦~~~

參考文章:

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。