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就夠日常使用了