Tax4Fun2 16s擴(kuò)增子群落功能預(yù)測 使用小結(jié)

Tax4Fun2是一個(gè)基于16S rRNA數(shù)據(jù)集預(yù)測微生物群落功能的R包,是Tax4Fun的升級(jí)版本要拂。
其發(fā)布在Github項(xiàng)目bwemheu / Tax4Fun2下,目前已更新到Tax4Fun2 v1.1.6懂诗。
下面以自帶示例簡單學(xué)習(xí)一下它的使用過程:

1.下載绿淋、安裝和配置
#shell
wget https://github.com/bwemheu/Tax4Fun2/releases/download/v1.1.6/Tax4Fun2_1.1.6.tar.gz

#R
install.packages(pkgs = "Tax4Fun2_1.1.6.tar.gz", repos = NULL, source = TRUE)
library(Tax4Fun2)

#簡單配置
buildReferenceData(path_to_working_directory = ".")#構(gòu)建參考數(shù)據(jù)庫
buildDependencies(path_to_reference_data = "./Tax4Fun2_ReferenceData_v2")#安裝依賴程序blast
getExampleData(path_to_working_directory = ".")#下載并構(gòu)建 Tax4Fun2 測試數(shù)據(jù)
2.僅使用默認(rèn)參考數(shù)據(jù)進(jìn)行功能預(yù)測
####物種注釋####
runRefBlast(path_to_otus = 'KELP_otus.fasta', 
            path_to_reference_data = './Tax4Fun2_ReferenceData_v2', 
            path_to_temp_folder = 'Kelp_Ref99NR', 
            database_mode = 'Ref99NR', 
            use_force = TRUE, 
            num_threads = 4)

####預(yù)測群落功能####
makeFunctionalPrediction(path_to_otu_table = 'KELP_otu_table.txt', 
                         path_to_reference_data = './Tax4Fun2_ReferenceData_v2',
                         path_to_temp_folder = 'Kelp_Ref99NR', 
                         database_mode = 'Ref99NR',
                         normalize_by_copy_number = TRUE, #默認(rèn),用參考數(shù)據(jù)庫中每個(gè)序列計(jì)算的16S rRNA拷貝數(shù)的平均值進(jìn)行歸一化
                         min_identity_to_reference = 0.97, 
                         normalize_pathways = FALSE)#默認(rèn)止毕,將把每個(gè)KO的相對(duì)豐度關(guān)聯(lián)到它所屬的每個(gè)路徑上
#或者
makeFunctionalPrediction(path_to_otu_table = 'KELP_otu_table.txt', 
                         path_to_reference_data = './Tax4Fun2_ReferenceData_v2', 
                         path_to_temp_folder = 'Kelp_Ref99NR', 
                         database_mode = 'Ref99NR', 
                         normalize_by_copy_number = TRUE, 
                         min_identity_to_reference = 0.97, 
                         normalize_pathways = TRUE)#非默認(rèn),將把每個(gè)KO的相對(duì)豐度平均分配到所有它所屬的路徑上漠趁。
3.使用默認(rèn)數(shù)據(jù)庫和用戶生成的數(shù)據(jù)庫進(jìn)行功能預(yù)測扁凛,需要自己從源文件構(gòu)建數(shù)據(jù)庫,一共需要三步
####提取SSU序列####
# 1.1 Extracting SSU sequences from a single genome
extractSSU(genome_file = "OneProkaryoticGenome.fasta", file_extension = "fasta", 
           path_to_reference_data = "Tax4Fun2_ReferenceData_v2")
# 1.1 Extracting SSU sequences from multiple genomes
extractSSU(genome_folder = "MoreProkaryoticGenomes", file_extension = "fasta",
           path_to_reference_data = "Tax4Fun2_ReferenceData_v2")
####為原核基因組分配功能####
# 2.1 Assigning function to a single genome
assignFunction(genome_file = "OneProkaryoticGenome.fasta", file_extension = "fasta", 
               path_to_reference_data = "Tax4Fun2_ReferenceData_v2", num_of_threads = 8, fast = TRUE)
# 2.2 Assigning function to multiple genomes
assignFunction(genome_folder = "MoreProkaryoticGenomes/", file_extension = "fasta",
               path_to_reference_data = "Tax4Fun2_ReferenceData_v2", num_of_threads = 1, fast = TRUE)
####生成參考數(shù)據(jù)(程序提供了 3 種方法)####
# 3.1 Generate user-defined reference data without uclust from a single genome
generateUserData(path_to_reference_data = './Tax4Fun2_ReferenceData_v2', path_to_user_data = '.',
                 name_of_user_data = 'User_Ref0', SSU_file_extension = '_16SrRNA.ffn', KEGG_file_extension = '_funPro.txt')
# 3.2 Generate user-defined reference data without uclust
generateUserData(path_to_reference_data = './Tax4Fun2_ReferenceData_v2', path_to_user_data = 'MoreProkaryoticGenomes', 
                 name_of_user_data = 'User_Ref1', SSU_file_extension = '_16SrRNA.ffn', KEGG_file_extension = '_funPro.txt')
# 3.3 Generate user-defined reference data with uclust
generateUserDataByClustering(path_to_reference_data = './Tax4Fun2_ReferenceData_v2', path_to_user_data = 'MoreProkaryoticGenomes',
                             name_of_user_data = 'User_Ref2', SSU_file_extension = '_16SrRNA.ffn', KEGG_file_extension = '_funPro.txt', use_force = TRUE)
#推薦選擇generateUserDataByClustering闯传,該命令包含一個(gè)uclust聚類步驟谨朝,可消除數(shù)據(jù)中的冗余
4.以非聚類方式進(jìn)行功能預(yù)測
####從上述3.2生成參考數(shù)據(jù)開始,以非聚類方式####
generateUserData(path_to_reference_data = "Tax4Fun2_ReferenceData_v2", 
                 path_to_user_data = "KELP_UserData", #指定用戶要自定義數(shù)據(jù)庫的數(shù)據(jù)源文件位置,是運(yùn)行第一步extractSSU和第二步assignFunction之后得到的字币,此處提供已經(jīng)運(yùn)行好的以節(jié)省運(yùn)行時(shí)間
                 name_of_user_data = "KELP1", #為您的數(shù)據(jù)庫提供一個(gè)名稱
                 SSU_file_extension = ".ffn", #運(yùn)行第一步extractSSU后得到
                 KEGG_file_extension = ".txt")#運(yùn)行第二步assignFunction后得到

####物種注釋####
runRefBlast(path_to_otus = "KELP_otus.fasta", 
            path_to_reference_data = "Tax4Fun2_ReferenceData_v2", 
            path_to_temp_folder = "Kelp_Ref99NR_withUser1", 
            database_mode = "Ref99NR", 
            use_force = T, 
            num_threads = 6, 
            include_user_data = T, path_to_user_data = "KELP_UserData", name_of_user_data = "KELP1")

####預(yù)測群落功能####
makeFunctionalPrediction(path_to_otu_table = "KELP_otu_table.txt", 
                         path_to_reference_data = "Tax4Fun2_ReferenceData_v2", 
                         path_to_temp_folder = "Kelp_Ref99NR_withUser1", 
                         database_mode = "Ref99NR", 
                         normalize_by_copy_number = T, 
                         min_identity_to_reference = 0.97, 
                         normalize_pathways = F, 
                         include_user_data = T, path_to_user_data = "KELP_UserData", name_of_user_data = "KELP1")
5.以Vsearch聚類方式進(jìn)行功能預(yù)測
####從上述3.3生成參考數(shù)據(jù)開始则披,以Vsearch聚類方式####
generateUserDataByClustering(path_to_reference_data = "Tax4Fun2_ReferenceData_v2", 
                             path_to_user_data = "KELP_UserData", 
                             name_of_user_data = "KELP2", 
                             SSU_file_extension = ".ffn", 
                             KEGG_file_extension = ".txt", 
                             similarity_threshold = 0.99)#使用uclust對(duì)提取的SSU序列進(jìn)行聚類

####物種注釋####
runRefBlast(path_to_otus = "KELP_otus.fasta", 
            path_to_reference_data = "Tax4Fun2_ReferenceData_v2", 
            path_to_temp_folder = "Kelp_Ref99NR_withUser2", 
            database_mode = "Ref99NR", 
            use_force = T, 
            num_threads = 6, 
            include_user_data = T, path_to_user_data = "KELP_UserData", name_of_user_data = "KELP2")

####預(yù)測群落功能####
makeFunctionalPrediction(path_to_otu_table = "KELP_otu_table.txt", 
                         path_to_reference_data = "Tax4Fun2_ReferenceData_v2", 
                         path_to_temp_folder = "Kelp_Ref99NR_withUser2", 
                         database_mode = "Ref99NR", 
                         normalize_by_copy_number = T, 
                         min_identity_to_reference = 0.97, 
                         normalize_pathways = F, 
                         include_user_data = T, path_to_user_data = "KELP_UserData", name_of_user_data = "KELP2")
6.計(jì)算(多)功能冗余指數(shù)(實(shí)驗(yàn)性功能)

計(jì)算KEGG功能的系統(tǒng)發(fā)育分布(高FRI->高冗余度,低FRI->低冗余度洗出,可能會(huì)隨著群落變化而丟失)

####物種注釋####
runRefBlast(path_to_otus = "Water_otus.fna", 
            path_to_reference_data = "Tax4Fun2_ReferenceData_v2", 
            path_to_temp_folder = "Water_Ref99NR", 
            database_mode = "Ref99NR", 
            use_force = T, 
            num_threads = 6)

####計(jì)算functional redundancy indices(FRI)####
calculateFunctionalRedundancy(path_to_otu_table = "Water_otu_table.txt", 
                              path_to_reference_data = "Tax4Fun2_ReferenceData_v2", 
                              path_to_temp_folder = "Water_Ref99NR", 
                              database_mode = "Ref99NR", 
                              min_identity_to_reference = 0.97)

#或者
calculateFunctionalRedundancy(path_to_otu_table = "Water_otu_table.txt", 
                              path_to_reference_data = "Tax4Fun2_ReferenceData_v2", 
                              path_to_temp_folder = "Water_Ref99NR", 
                              database_mode = "Ref99NR", 
                              min_identity_to_reference = 0.97, 
                              prevalence_cutoff = 1.0)#自定義prevalence_cutoff值士复,此截止值用于將功能配置文件轉(zhuǎn)換為二元向量(功能x存在或者不存在)

PS:感覺學(xué)到2就夠日常使用了

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市翩活,隨后出現(xiàn)的幾起案子阱洪,更是在濱河造成了極大的恐慌,老刑警劉巖菠镇,帶你破解...
    沈念sama閱讀 206,013評(píng)論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件冗荸,死亡現(xiàn)場離奇詭異,居然都是意外死亡利耍,警方通過查閱死者的電腦和手機(jī)蚌本,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,205評(píng)論 2 382
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來隘梨,“玉大人程癌,你說我怎么就攤上這事〕鲟冢” “怎么了席楚?”我有些...
    開封第一講書人閱讀 152,370評(píng)論 0 342
  • 文/不壞的土叔 我叫張陵,是天一觀的道長税稼。 經(jīng)常有香客問我烦秩,道長,這世上最難降的妖魔是什么郎仆? 我笑而不...
    開封第一講書人閱讀 55,168評(píng)論 1 278
  • 正文 為了忘掉前任只祠,我火速辦了婚禮,結(jié)果婚禮上扰肌,老公的妹妹穿的比我還像新娘抛寝。我一直安慰自己,他們只是感情好曙旭,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,153評(píng)論 5 371
  • 文/花漫 我一把揭開白布盗舰。 她就那樣靜靜地躺著,像睡著了一般桂躏。 火紅的嫁衣襯著肌膚如雪钻趋。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 48,954評(píng)論 1 283
  • 那天剂习,我揣著相機(jī)與錄音蛮位,去河邊找鬼较沪。 笑死,一個(gè)胖子當(dāng)著我的面吹牛失仁,可吹牛的內(nèi)容都是我干的尸曼。 我是一名探鬼主播,決...
    沈念sama閱讀 38,271評(píng)論 3 399
  • 文/蒼蘭香墨 我猛地睜開眼萄焦,長吁一口氣:“原來是場噩夢啊……” “哼控轿!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起楷扬,我...
    開封第一講書人閱讀 36,916評(píng)論 0 259
  • 序言:老撾萬榮一對(duì)情侶失蹤解幽,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后烘苹,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體躲株,經(jīng)...
    沈念sama閱讀 43,382評(píng)論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,877評(píng)論 2 323
  • 正文 我和宋清朗相戀三年镣衡,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了霜定。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 37,989評(píng)論 1 333
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡廊鸥,死狀恐怖望浩,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情惰说,我是刑警寧澤磨德,帶...
    沈念sama閱讀 33,624評(píng)論 4 322
  • 正文 年R本政府宣布,位于F島的核電站吆视,受9級(jí)特大地震影響典挑,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜啦吧,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,209評(píng)論 3 307
  • 文/蒙蒙 一您觉、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧授滓,春花似錦琳水、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,199評(píng)論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至淮摔,卻和暖如春浑玛,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背噩咪。 一陣腳步聲響...
    開封第一講書人閱讀 31,418評(píng)論 1 260
  • 我被黑心中介騙來泰國打工顾彰, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人胃碾。 一個(gè)月前我還...
    沈念sama閱讀 45,401評(píng)論 2 352
  • 正文 我出身青樓涨享,卻偏偏與公主長得像,于是被迫代替她去往敵國和親仆百。 傳聞我的和親對(duì)象是個(gè)殘疾皇子厕隧,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,700評(píng)論 2 345

推薦閱讀更多精彩內(nèi)容