Title: | Feature-Wise Normalization for Microbiome Sequencing Data |
---|---|
Description: | A novel feature-wise normalization method based on a zero-inflated negative binomial model. This method assumes that the effects of sequencing depth vary for each taxon on their mean and also incorporates a rational link of zero probability and taxon dispersion as a function of sequencing depth. Ziyue Wang, Dillon Lloyd, Shanshan Zhao, Alison Motsinger-Reif (2023) <doi:10.1101/2023.10.31.563648>. |
Authors: | Ziyue Wang [aut], Dillon Lloyd [aut, cre, cph], Shanshan Zhao [aut, ctb], Alison Motsinger-Reif [aut, ctb] |
Maintainer: | Dillon Lloyd <[email protected]> |
License: | GPL-3 |
Version: | 2.3 |
Built: | 2024-11-07 03:57:46 UTC |
Source: | https://github.com/wangziyue57/taxanorm |
S4 class to store TaxaNorm Parameters
TaxaNorm_Model_Parameters(coefficients, mu, theta, pi) ## S4 method for signature 'TaxaNorm_Model_Parameters' coefficients(x) ## S4 replacement method for signature 'TaxaNorm_Model_Parameters' coefficients(x) <- value ## S4 method for signature 'TaxaNorm_Model_Parameters' mu(x) ## S4 replacement method for signature 'TaxaNorm_Model_Parameters' mu(x) <- value ## S4 method for signature 'TaxaNorm_Model_Parameters' theta(x) ## S4 replacement method for signature 'TaxaNorm_Model_Parameters' theta(x) <- value ## S4 method for signature 'TaxaNorm_Model_Parameters' pi(x) ## S4 replacement method for signature 'TaxaNorm_Model_Parameters' pi(x) <- value
TaxaNorm_Model_Parameters(coefficients, mu, theta, pi) ## S4 method for signature 'TaxaNorm_Model_Parameters' coefficients(x) ## S4 replacement method for signature 'TaxaNorm_Model_Parameters' coefficients(x) <- value ## S4 method for signature 'TaxaNorm_Model_Parameters' mu(x) ## S4 replacement method for signature 'TaxaNorm_Model_Parameters' mu(x) <- value ## S4 method for signature 'TaxaNorm_Model_Parameters' theta(x) ## S4 replacement method for signature 'TaxaNorm_Model_Parameters' theta(x) <- value ## S4 method for signature 'TaxaNorm_Model_Parameters' pi(x) ## S4 replacement method for signature 'TaxaNorm_Model_Parameters' pi(x) <- value
coefficients |
Passed to |
mu |
Passed to |
theta |
Passed to |
pi |
Passed to |
x |
TaxaNorm_Model_Parameters object |
value |
Replacement value |
Parameters for TaxaNorm Method
coefficients(TaxaNorm_Model_Parameters)
: Return coefficients
slot
mu(TaxaNorm_Model_Parameters)
: Return mu
slot
theta(TaxaNorm_Model_Parameters)
: Return theta
slot
pi(TaxaNorm_Model_Parameters)
: Return pi
slot
coefficients
matrix
coefficients
mu
matrix
mu
theta
matrix
theta
pi
matrix
pi
coefficients <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) mu <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) theta <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) pi <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) TaxaNorm_Model_Parameters(coefficients = coefficients,mu = mu,theta = theta,pi = pi)
coefficients <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) mu <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) theta <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) pi <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) TaxaNorm_Model_Parameters(coefficients = coefficients,mu = mu,theta = theta,pi = pi)
Function to QC TaxNorm algorithm
TaxaNorm_Model_QC(TaxaNormResults)
TaxaNorm_Model_QC(TaxaNormResults)
TaxaNormResults |
Input data; Results from TaxaNorm normalization |
a list containing qc taxnorm object
data("TaxaNorm_Example_Output", package = "TaxaNorm") TaxaNorm_Model_QC(TaxaNormResults = TaxaNorm_Example_Output)
data("TaxaNorm_Example_Output", package = "TaxaNorm") TaxaNorm_Model_QC(TaxaNormResults = TaxaNorm_Example_Output)
Function for TaxNorm NMDS
TaxaNorm_NMDS(TaxaNormResults, group_column)
TaxaNorm_NMDS(TaxaNormResults, group_column)
TaxaNormResults |
(Required) Input data; should be either a phyloseq object or a count matrix |
group_column |
column to cluster on |
NMDS Plot
data("TaxaNorm_Example_Output", package = "TaxaNorm") TaxaNorm_NMDS(TaxaNorm_Example_Output, group_column = "body_site")
data("TaxaNorm_Example_Output", package = "TaxaNorm") TaxaNorm_NMDS(TaxaNorm_Example_Output, group_column = "body_site")
Function to run TaxaNorm algorithm
TaxaNorm_Normalization( data, depth = NULL, group = NULL, meta.data = NULL, filter.cell.num = 10, filter.taxa.count = 0, random = FALSE, ncores = NULL )
TaxaNorm_Normalization( data, depth = NULL, group = NULL, meta.data = NULL, filter.cell.num = 10, filter.taxa.count = 0, random = FALSE, ncores = NULL )
data |
(Required) Input data; should be either a phyloseq object or a count matrix |
depth |
sequencing depth if pre-calculated. It should be a vector with the same length and order as the column of the count data |
group |
condition variables if samples are from multiple groups; should be correpsond to the column of the count data. default is NULL, where no grouping is considered |
meta.data |
meta data for Taxa |
filter.cell.num |
taxa with "filter.cell.num" in more than the value provided will be filtered |
filter.taxa.count |
"filter.taxa.count" samples will be removed before testing. default is keep taxa appear in at least 10 samples within each group |
random |
calculate randomized normal quantile residual |
ncores |
whether multiple cores is used for parallel computing; default is max(1, detectCores() - 1) |
a TaxaNorm Object containing the normalized count values and accessory information
data("TaxaNorm_Example_Input", package = "TaxaNorm") Normalized_Data <- TaxaNorm_Normalization(data= TaxaNorm_Example_Input, depth = NULL, group = sample_data(TaxaNorm_Example_Input)$body_site, meta.data = NULL, filter.cell.num = 10, filter.taxa.count = 0, random = FALSE, ncores = 1)
data("TaxaNorm_Example_Input", package = "TaxaNorm") Normalized_Data <- TaxaNorm_Normalization(data= TaxaNorm_Example_Input, depth = NULL, group = sample_data(TaxaNorm_Example_Input)$body_site, meta.data = NULL, filter.cell.num = 10, filter.taxa.count = 0, random = FALSE, ncores = 1)
Function for TaxNorm input data
TaxaNorm_QC_Input(data)
TaxaNorm_QC_Input(data)
data |
(Required) Input data; should be either a phyloseq object or a count matrix |
QC PLots
data("TaxaNorm_Example_Input", package = "TaxaNorm") qc_data <- TaxaNorm_QC_Input(TaxaNorm_Example_Input)
data("TaxaNorm_Example_Input", package = "TaxaNorm") qc_data <- TaxaNorm_QC_Input(TaxaNorm_Example_Input)
S4 class to store TaxaNorm Results
TaxaNorm_Results( input_data, rawdata, normdata, ecdf, model_pars, converge, llk, final_df ) ## S4 method for signature 'TaxaNorm_Results' input_data(x) ## S4 replacement method for signature 'TaxaNorm_Results' input_data(x) <- value ## S4 method for signature 'TaxaNorm_Results' rawdata(x) ## S4 replacement method for signature 'TaxaNorm_Results' rawdata(x) <- value ## S4 method for signature 'TaxaNorm_Results' normdata(x) ## S4 replacement method for signature 'TaxaNorm_Results' normdata(x) <- value ## S4 method for signature 'TaxaNorm_Results' ecdf(x) ## S4 replacement method for signature 'TaxaNorm_Results' ecdf(x) <- value ## S4 method for signature 'TaxaNorm_Results' model_pars(x) ## S4 replacement method for signature 'TaxaNorm_Results' model_pars(x) <- value ## S4 method for signature 'TaxaNorm_Results' converge(x) ## S4 replacement method for signature 'TaxaNorm_Results' converge(x) <- value ## S4 method for signature 'TaxaNorm_Results' llk(x) ## S4 replacement method for signature 'TaxaNorm_Results' llk(x) <- value ## S4 method for signature 'TaxaNorm_Results' final_df(x) ## S4 replacement method for signature 'TaxaNorm_Results' final_df(x) <- value
TaxaNorm_Results( input_data, rawdata, normdata, ecdf, model_pars, converge, llk, final_df ) ## S4 method for signature 'TaxaNorm_Results' input_data(x) ## S4 replacement method for signature 'TaxaNorm_Results' input_data(x) <- value ## S4 method for signature 'TaxaNorm_Results' rawdata(x) ## S4 replacement method for signature 'TaxaNorm_Results' rawdata(x) <- value ## S4 method for signature 'TaxaNorm_Results' normdata(x) ## S4 replacement method for signature 'TaxaNorm_Results' normdata(x) <- value ## S4 method for signature 'TaxaNorm_Results' ecdf(x) ## S4 replacement method for signature 'TaxaNorm_Results' ecdf(x) <- value ## S4 method for signature 'TaxaNorm_Results' model_pars(x) ## S4 replacement method for signature 'TaxaNorm_Results' model_pars(x) <- value ## S4 method for signature 'TaxaNorm_Results' converge(x) ## S4 replacement method for signature 'TaxaNorm_Results' converge(x) <- value ## S4 method for signature 'TaxaNorm_Results' llk(x) ## S4 replacement method for signature 'TaxaNorm_Results' llk(x) <- value ## S4 method for signature 'TaxaNorm_Results' final_df(x) ## S4 replacement method for signature 'TaxaNorm_Results' final_df(x) <- value
input_data |
passed to |
rawdata |
Passed to |
normdata |
Passed to |
ecdf |
Passed to |
model_pars |
Passed to |
converge |
Passed to |
llk |
Passed to |
final_df |
Passed to |
x |
TaxaNorm_Results object |
value |
Replacement value |
All results from the TaxaNorm method and what was used to get those results
input_data(TaxaNorm_Results)
: Return input_data
slot
rawdata(TaxaNorm_Results)
: Return rawdata
slot
normdata(TaxaNorm_Results)
: Return normdata
slot
ecdf(TaxaNorm_Results)
: Return ecdf
slot
model_pars(TaxaNorm_Results)
: Return model_pars
slot
converge(TaxaNorm_Results)
: Return converge
slot
llk(TaxaNorm_Results)
: Return llk
slot
final_df(TaxaNorm_Results)
: Return final_df
slot
input_data
ANY
phyloseq input data
rawdata
data.frame
Data frame of counts to use
normdata
data.frame
Normalized Data
ecdf
data.frame
ecdf
model_pars
TaxaNorm_Model_Parameters list of model parameters
converge
vector(<logical>)
converge
llk
ANY
llk
final_df
ANY
final_df
coefficients <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) mu <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) theta <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) pi <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) model_pars <- TaxaNorm_Model_Parameters(coefficients = coefficients,mu = mu,theta = theta,pi = pi) data("TaxaNorm_Example_Input", package = "TaxaNorm") rawdata <- data.frame(Taxa1 = c(1,2,3),Taxa2 = c(3,4,5),Taxa3 = c(6,7,8)) normdata <- data.frame(Taxa1 = c(-1.4,-1.09,-0.73), Taxa2 = c( -0.36,0,0.36), Taxa3 = c(0.73,1.09,1.46)) ecdf <- data.frame(0.05,0.23,0.89) converge <- c(TRUE,TRUE,FALSE) llk <- c(1,1.5,0.5) final_df <- data.frame(Taxa1 = c(1,2,3),Taxa2 = c(3,4,5),Taxa3 = c(6,7,8)) TaxaNorm_Results(input_data = TaxaNorm_Example_Input, rawdata = rawdata, normdata = normdata, ecdf = ecdf, model_pars = model_pars, converge = converge, llk = llk, final_df = final_df)
coefficients <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) mu <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) theta <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) pi <- matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE) model_pars <- TaxaNorm_Model_Parameters(coefficients = coefficients,mu = mu,theta = theta,pi = pi) data("TaxaNorm_Example_Input", package = "TaxaNorm") rawdata <- data.frame(Taxa1 = c(1,2,3),Taxa2 = c(3,4,5),Taxa3 = c(6,7,8)) normdata <- data.frame(Taxa1 = c(-1.4,-1.09,-0.73), Taxa2 = c( -0.36,0,0.36), Taxa3 = c(0.73,1.09,1.46)) ecdf <- data.frame(0.05,0.23,0.89) converge <- c(TRUE,TRUE,FALSE) llk <- c(1,1.5,0.5) final_df <- data.frame(Taxa1 = c(1,2,3),Taxa2 = c(3,4,5),Taxa3 = c(6,7,8)) TaxaNorm_Results(input_data = TaxaNorm_Example_Input, rawdata = rawdata, normdata = normdata, ecdf = ecdf, model_pars = model_pars, converge = converge, llk = llk, final_df = final_df)
Function to run TaxNorm algorithm
TaxaNorm_Run_Diagnose(Normalized_Results, prev = TRUE, equiv = TRUE, group)
TaxaNorm_Run_Diagnose(Normalized_Results, prev = TRUE, equiv = TRUE, group)
Normalized_Results |
(Required) Input results from from run_norm() |
prev |
run prev test |
equiv |
run equiv test |
group |
group used for taxanorm normalization |
a list containing the normalized count values
data("TaxaNorm_Example_Input", package = "TaxaNorm") data("TaxaNorm_Example_Output", package = "TaxaNorm") Diagnose_Data <- TaxaNorm_Run_Diagnose(Normalized_Results = TaxaNorm_Example_Output, prev = TRUE, equiv = TRUE, group = sample_data(TaxaNorm_Example_Input)$body_site)
data("TaxaNorm_Example_Input", package = "TaxaNorm") data("TaxaNorm_Example_Output", package = "TaxaNorm") Diagnose_Data <- TaxaNorm_Run_Diagnose(Normalized_Results = TaxaNorm_Example_Output, prev = TRUE, equiv = TRUE, group = sample_data(TaxaNorm_Example_Input)$body_site)
Objects included in the TaxaNorm package, loaded with utils::data
data(TaxaNorm_Example_Input, package = "TaxaNorm") data(TaxaNorm_Example_Output, package = "TaxaNorm")
data(TaxaNorm_Example_Input, package = "TaxaNorm") data(TaxaNorm_Example_Output, package = "TaxaNorm")
Example data #'
Example output
data(TaxaNorm_Example_Input, package = "TaxaNorm") data(TaxaNorm_Example_Output, package = "TaxaNorm")
data(TaxaNorm_Example_Input, package = "TaxaNorm") data(TaxaNorm_Example_Output, package = "TaxaNorm")
TaxaNorm package generics; see class man pages for associated methods
input_data(x, ...) input_data(x, ...) <- value rawdata(x, ...) rawdata(x, ...) <- value normdata(x, ...) normdata(x, ...) <- value ecdf(x, ...) ecdf(x, ...) <- value model_pars(x, ...) model_pars(x, ...) <- value converge(x, ...) converge(x, ...) <- value llk(x, ...) llk(x, ...) <- value final_df(x, ...) final_df(x, ...) <- value coefficients(x, ...) coefficients(x, ...) <- value mu(x, ...) mu(x, ...) <- value theta(x, ...) theta(x, ...) <- value pi(x, ...) pi(x, ...) <- value
input_data(x, ...) input_data(x, ...) <- value rawdata(x, ...) rawdata(x, ...) <- value normdata(x, ...) normdata(x, ...) <- value ecdf(x, ...) ecdf(x, ...) <- value model_pars(x, ...) model_pars(x, ...) <- value converge(x, ...) converge(x, ...) <- value llk(x, ...) llk(x, ...) <- value final_df(x, ...) final_df(x, ...) <- value coefficients(x, ...) coefficients(x, ...) <- value mu(x, ...) mu(x, ...) <- value theta(x, ...) theta(x, ...) <- value pi(x, ...) pi(x, ...) <- value
x |
TaxaNorm S4 object |
... |
Included for extendability; not currently used |
value |
Replacement value |
TaxaNorm generic functions return the specified slot of the TaxaNorm object given to the function