kodf: KO_abundance table, rowname are feature ids (e.g. K00001 if feature="ko"; PEX11A if feature="gene"; C00024 if feature="compound"), colnames are samples.
group: The comparison groups (at least two categories) in your data, one column name of metadata when metadata exist or a vector whose length equal to columns number of kodf. And you can use factor levels to change order.
metadata: sample information data.frame contains group
method: the type of test. Default is wilcox.test. Allowed values include:
t.test (parametric) and wilcox.test (non-parametric). Perform comparison between two groups of samples. If the grouping variable contains more than two levels, then a pairwise comparison is performed.
anova (parametric) and kruskal.test (non-parametric). Perform one-way ANOVA test comparing multiple groups.
'pearson', 'kendall', or 'spearman' (correlation), see cor.
pattern: a named vector matching the group, e.g. c('G1'=1,'G2'=3,'G3'=2), use the correlation analysis with specific pattern to calculate p-value.
p.adjust.method1: p.adjust.method for ko.test, see p.adjust
mode: 'mixed' or 'directed' (default, only for two groups differential analysis or multi-groups correlation analysis.), see details in pvalue2zs.
verbose: logical
feature: one of 'ko', 'gene', 'compound'
type: 'pathway' or 'module' for default KOlist for microbiome, 'CC', 'MF', 'BP', 'ALL' for default GOlist for homo sapiens. And org in listed in 'https://www.genome.jp/kegg/catalog/org_list.html' such as 'hsa' (if your kodf is come from a specific organism, you should specify type here).
p.adjust.method2: p.adjust.method for the correction of ReporterScore, see p.adjust
modulelist: NULL or customized modulelist dataframe, must contain 'id','K_num','KOs','Description' columns. Take the KOlist as example, use custom_modulelist.
threads: default 1
perm: permutation number, default: 4999.
min_exist_KO: min exist KO number in a pathway (default, 3, when a pathway contains KOs less than 3, there will be no RS)
max_exist_KO: max exist KO number in a pathway (default, 600, when a pathway contains KOs more than 600, there will be no RS)
Returns
reporter_score object: - kodf: your input KO_abundance table
ko_stat: ko statistics result contains p.value and z_score
reporter_s: the reporter score in each pathway
modulelist: default KOlist or customized modulelist dataframe
group: The comparison groups in your data
metadata: sample information dataframe contains group
for the reporter_s in result, whose columns represent: - ID: pathway id
Description: pathway description
K_num: total number of KOs/genes in the pathway
Exist_K_num: number of KOs/genes in your inputdata that exist in the pathway
Significant_K_num: number of kos/genes in your inputdata that are significant in the pathway
Z_score: Zpathway=k1∑Zkoi
BG_Mean: Background mean, μk
BG_Sd: Background standard deviation, σk
ReporterScore: ReporterScore of the pathway, ReporterScore=(Zpathway−μk)/σk
p.value: p.value of the ReporterScore
p.adjust: adjusted p.value by p.adjust.method2
Examples
message("The following example require some time to run:")data("KO_abundance_test")reporter_score_res <- reporter_score(KO_abundance,"Group", metadata, mode ="directed", perm =499)head(reporter_score_res$reporter_s)reporter_score_res2 <- reporter_score(KO_abundance,"Group2", metadata, mode ="mixed", method ="kruskal.test", p.adjust.method1 ="none", perm =499)reporter_score_res3 <- reporter_score(KO_abundance,"Group2", metadata, mode ="directed", method ="pearson", pattern = c("G1"=1,"G2"=3,"G3"=2), perm =499)
See Also
Other GRSA: combine_rs_res(), get_reporter_score(), ko.test(), pvalue2zs()