library(IFAA)
library(SummarizedExperiment)
## If you already have a SummarizedExperiment format data, you can ignore
## the data processing steps below.
## load the example microbiome data. This could be relative abundance or absolute
## abundance data. If you have a csv or tsv file for the microbiome data, you
## can use read.csv() function or read.table() function in R to read the
## data file into R.
data(dataM)
dim(dataM)
dataM[1:5, 1:8]
## load the example covariates data. If you have a csv or tsv file for the
## covariates data, you can use read.csv() function or read.table() function
## in R to read the data file into R.
data(dataC)
dim(dataC)
dataC[1:5, ]
## Merge microbiome data and covariate data by id, to avoid unmatching observations.
data_merged<-merge(dataM,dataC,by="id",all=FALSE)
## Seperate microbiome data and covariate data, drop id variable from the microbiome data
dataM_sub<-data_merged[,colnames(dataM)[!colnames(dataM)%in%c("id")]]
dataC_sub<-data_merged[,colnames(dataC)]
## Create SummarizedExperiment object
test_dat<-SummarizedExperiment(assays=list(MicrobData=t(dataM_sub)), colData=dataC_sub)
## If you already have a SummarizedExperiment format data, you can
## ignore the above steps.
## Run MZILN function
results <- MZILN(experiment_dat = test_dat,
refTaxa=c("rawCount11"),
allCov=c("v1","v2","v3"),
sampleIDname=c("id"),
fdrRate=0.05)
## to extract the results for all ratios with rawCount11 as the denominator:
summary_res<-results$full_results
## to extract results for the ratio of a specific taxon (e.g., rawCount45) over rawCount11:
target_ratio=summary_res[summary_res$taxon=="rawCount45",]
## to extract all of the ratios having significant associations:
sig_ratios=subset(summary_res,sig_ind==TRUE)
Run the code above in your browser using DataLab