Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

trans_func

Create trans_func object for functional analysis.


Description

This class is a wrapper for a series of functional analysis on species and communities, including the prokaryotes function identification based on Louca et al. (2016) <doi:10.1126/science.aaf4507> and Lim et al. (2020) <10.1038/s41597-020-0516-5>, or fungi function identification based on Nguyen et al. (2016) <10.1016/j.funeco.2015.06.006> and Polme et al. (2020) <doi:10.1007/s13225-020-00466-2>; functional redundancy calculation and metabolic pathway abundance prediction Abhauer et al. (2015) <10.1093/bioinformatics/btv287>.

Active bindings

func_group_list

store and show the function group list

Methods

Public methods


Method new()

Create the trans_func object. This function can identify the data type for Prokaryotes or Fungi automatically.

Usage
trans_func$new(dataset = NULL)
Arguments
dataset

the object of microtable Class.

Returns

for_what : "prok" or "fungi" or NA, "prok" represent prokaryotes. "fungi" represent fungi. NA stand for not identified according to the Kingdom information, at this time, if you want to use the functions to identify species traits, you need provide "prok" or "fungi" manually, e.g. dataset$for_what <- "prok".

Examples
data(dataset)
t1 <- trans_func$new(dataset = dataset)

Method cal_spe_func()

Confirm traits of each feature by matching the taxonomic assignments to the functional database.

Usage
trans_func$cal_spe_func(
  prok_database = c("FAPROTAX", "NJC19")[1],
  fungi_database = c("FUNGuild", "FungalTraits")[1]
)
Arguments
prok_database

default "FAPROTAX"; "FAPROTAX" or "NJC19"; select a prokaryotic trait database; see the details:

'FAPROTAX'

FAPROTAX v1.2.4 Reference: Louca et al. (2016). Decoupling function and taxonomy in the global ocean microbiome. Science, 353(6305), 1272. <doi:10.1126/science.aaf4507>

'NJC19'

NJC19: Lim et al. (2020). Large-scale metabolic interaction network of the mouse and human gut microbiota. Scientific Data, 7(1). <10.1038/s41597-020-0516-5>

fungi_database

default "FUNGuild"; "FUNGuild" or "FungalTraits"; select a fungal trait database; see the details:

'FUNGuild'

Nguyen et al. (2016) FUNGuild: An open annotation tool for parsing fungal community datasets by ecological guild. Fungal Ecology, 20(1), 241-248, <doi:10.1016/j.funeco.2015.06.006>

'FungalTraits'

Polme et al. FungalTraits: a user-friendly traits database of fungi and fungus-like stramenopiles. Fungal Diversity 105, 1-16 (2020). <doi:10.1007/s13225-020-00466-2>

Returns

res_spe_func stored in object.

Examples
\donttest{
t1$cal_spe_func(prok_database = "FAPROTAX")
t1$cal_spe_func(fungi_database = "FungalTraits")
}

Method cal_spe_func_perc()

Calculating the percentages of species with specific trait in communities. The percentages of the taxa with specific trait can reflect the potential of the corresponding function in the community. So this method is a simple calculation of functional redundancy without the consideration of phylogenetic distance among taxa.

Usage
trans_func$cal_spe_func_perc(abundance_weighted = FALSE)
Arguments
abundance_weighted

default FALSE; whether use abundance of taxa. If FALSE, calculate the functional population percentage. If TRUE, calculate the functional individual percentage.

Returns

res_spe_func_perc stored in the object.

Examples
\donttest{
t1$cal_spe_func_perc(abundance_weighted = TRUE)
}

Method show_prok_func()

Show the annotation information for a function of prokaryotes from FAPROTAX database.

Usage
trans_func$show_prok_func(use_func = NULL)
Arguments
use_func

default NULL; the function name.

Returns

None.

Examples
\donttest{
t1$show_prok_func(use_func = "methanotrophy")
}

Method plot_spe_func_perc()

Plot the percentages of species with specific trait in communities or network modules.

Usage
trans_func$plot_spe_func_perc(
  filter_func = NULL,
  use_group_list = TRUE,
  add_facet = TRUE,
  select_samples = NULL,
  color_gradient_low = "#00008B",
  color_gradient_high = "#9E0142"
)
Arguments
filter_func

default NULL; a vector of function names used to show in the plot.

use_group_list

default TRUE; If TRUE, use default group list; If user want to use personalized group list, please first set trans_func$func_group_list object with a list of group names and functions.

add_facet

default TRUE; whether use group names as the facets in the plot, see trans_func$func_group_list object.

select_samples

default NULL; character vector; select partial samples to show.

color_gradient_low

default "#00008B"; the color used as the low end in the color gradient.

color_gradient_high

default "#9E0142"; the color used as the high end in the color gradient.

Returns

ggplot2.

Examples
\donttest{
t1$plot_spe_func_perc(use_group_list = TRUE)
}

Method cal_tax4fun()

Predict functional potential of communities using tax4fun. please cite: Tax4Fun: Predicting functional profiles from metagenomic 16S rRNA data. Bioinformatics, 31(17), 2882-2884, <doi:10.1093/bioinformatics/btv287>. Note that this function requires a standard prefix in taxonomic table with double underlines (e.g. g__) .

Usage
trans_func$cal_tax4fun(keep_tem = FALSE, folderReferenceData = NULL)
Arguments
keep_tem

default FALSE; whether keep the intermediate file, that is, the feature table in local place.

folderReferenceData

default NULL; the folder, see http://tax4fun.gobics.de/ and Tax4Fun function in Tax4Fun package.

Returns

tax4fun_KO and tax4fun_path in object.


Method cal_tax4fun2()

Predict functional potential of communities with Tax4Fun2 method. The function was adapted from the raw Tax4Fun2 package to make it compatible with the microtable object. Pleas cite: Tax4Fun2: prediction of habitat-specific functional profiles and functional redundancy based on 16S rRNA gene sequences. Environmental Microbiome 15, 11 (2020). <doi:10.1186/s40793-020-00358-7>

Usage
trans_func$cal_tax4fun2(
  blast_tool_path = NULL,
  path_to_reference_data = "Tax4Fun2_ReferenceData_v2",
  path_to_temp_folder = NULL,
  database_mode = "Ref99NR",
  normalize_by_copy_number = T,
  min_identity_to_reference = 97,
  use_uproc = T,
  num_threads = 1,
  normalize_pathways = F
)
Arguments
blast_tool_path

default NULL; the folder path, e.g., ncbi-blast-2.5.0+/bin ; blast tools folder downloaded from "ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+" ; e.g., ncbi-blast-2.5.0+-x64-win64.tar.gz for windows system; if blast_tool_path is NULL, search the tools in the environmental path variable.

path_to_reference_data

default "Tax4Fun2_ReferenceData_v2"; the path that points to files used in the prediction; The directory must contain the Ref99NR or Ref100NR folder; download Ref99NR.zip from https://cloudstor.aarnet.edu.au/plus/s/DkoZIyZpMNbrzSw/download or Ref100NR.zip from https://cloudstor.aarnet.edu.au/plus/s/jIByczak9ZAFUB4/download.

path_to_temp_folder

default NULL; The temporary folder to store the logfile, intermediate file and result files; if NULL, use the default temporary in the computer system.

database_mode

default 'Ref99NR'; "Ref99NR" or "Ref100NR"; Ref99NR: 99% clustering reference database; Ref100NR: no clustering.

normalize_by_copy_number

default TRUE; whether normalize the result by the 16S rRNA copy number in the genomes.

min_identity_to_reference

default 97; the idenity threshold used for finding the nearest species.

use_uproc

default TRUE; whether use UProC to functionally anotate the genomes in the reference data.

num_threads

default 1; the threads used in the blastn.

normalize_pathways

default FALSE; Different to Tax4Fun, when converting from KEGG functions to KEGG pathways, Tax4Fun2 does not equally split KO gene abundances between pathways a functions is affiliated to. The full predicted abundance is affiliated to each pathway. Use TRUE to split the abundances (default is FALSE).

Returns

res_tax4fun2_KO and res_tax4fun2_pathway in object.

Examples
\dontrun{
t1$cal_tax4fun2(blast_tool_path = "ncbi-blast-2.5.0+/bin", 
    path_to_reference_data = "Tax4Fun2_ReferenceData_v2")
}

Method cal_tax4fun2_FRI()

Calculate (multi-) functional redundancy index (FRI) of prokaryotic community with Tax4Fun2 method. This function is used to calculating aFRI and rFRI use the intermediate files generated by the function cal_tax4fun2(). please also cite: Tax4Fun2: prediction of habitat-specific functional profiles and functional redundancy based on 16S rRNA gene sequences. Environmental Microbiome 15, 11 (2020). <doi:10.1186/s40793-020-00358-7>

Usage
trans_func$cal_tax4fun2_FRI()
Returns

res_tax4fun2_aFRI and res_tax4fun2_rFRI in object.

Examples
\dontrun{
t1$cal_tax4fun2_FRI()
}

Method print()

Print the trans_func object.

Usage
trans_func$print()

Method clone()

The objects of this class are cloneable with this method.

Usage
trans_func$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

## ------------------------------------------------
## Method `trans_func$new`
## ------------------------------------------------

data(dataset)
t1 <- trans_func$new(dataset = dataset)

## ------------------------------------------------
## Method `trans_func$cal_spe_func`
## ------------------------------------------------


t1$cal_spe_func(prok_database = "FAPROTAX")
t1$cal_spe_func(fungi_database = "FungalTraits")


## ------------------------------------------------
## Method `trans_func$cal_spe_func_perc`
## ------------------------------------------------


t1$cal_spe_func_perc(abundance_weighted = TRUE)


## ------------------------------------------------
## Method `trans_func$show_prok_func`
## ------------------------------------------------


t1$show_prok_func(use_func = "methanotrophy")


## ------------------------------------------------
## Method `trans_func$plot_spe_func_perc`
## ------------------------------------------------


t1$plot_spe_func_perc(use_group_list = TRUE)


## ------------------------------------------------
## Method `trans_func$cal_tax4fun2`
## ------------------------------------------------

## Not run: 
t1$cal_tax4fun2(blast_tool_path = "ncbi-blast-2.5.0+/bin", 
    path_to_reference_data = "Tax4Fun2_ReferenceData_v2")

## End(Not run)

## ------------------------------------------------
## Method `trans_func$cal_tax4fun2_FRI`
## ------------------------------------------------

## Not run: 
t1$cal_tax4fun2_FRI()

## End(Not run)

microeco

Microbial Community Ecology Data Analysis

v0.10.0
GPL-3
Authors
Chi Liu [aut, cre], Felipe R. P. Mansoldo [ctb], Umer Zeeshan Ijaz [ctb], Chenhao Li [ctb], Yang Cao [ctb], Minjie Yao [ctb], Xiangzhen Li [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.