I previously used aldex.corr() with 1.14.0 (R3.6.2) to generate correlation values for 16S data v metabolomic data using the following code. See https://www.biorxiv.org/content/10.1101/866459v2 for the outputs.
sample.data <- t(otu_table(ps3)) #count data needed not relative abundances
wanted <- sample.data[,grep('FMT aged|FMT adult', mapping$Group)]
wanted <- wanted[-which(rowSums(wanted) == 0),] #remove zero sum rows (71 taxa, 11 samples)
The work was done on my work computer, which I don't have access to for obvious reasons. I've tried running new analyses with v1.18.10 and v1.20.0 but the correlations I'm getting out look odd. The r values are outside -1 and 1 for pearson, even stranger for spearman. I can't work out why. I've rerun the analyses shown above and the results look nothing those I got previously. Only thing that's changed from what I can tell is you only get r, p and BH column outputs now rather than - colnames(out[[1]])
I previously used aldex.corr() with 1.14.0 (R3.6.2) to generate correlation values for 16S data v metabolomic data using the following code. See https://www.biorxiv.org/content/10.1101/866459v2 for the outputs.
sample.data <- t(otu_table(ps3)) #count data needed not relative abundances wanted <- sample.data[,grep('FMT aged|FMT adult', mapping$Group)] wanted <- wanted[-which(rowSums(wanted) == 0),] #remove zero sum rows (71 taxa, 11 samples)
conds <- as.character(mapping$Group[grep('FMT aged|FMT adult', mapping$Group)])
metab <- read.table('Autumn_metabolomics.txt', sep='\t', header=T, row.names=1) #71 metabolites, 11 samples metab <- metab[-which(rowSums(metab) == 0), ]
x <- aldex.clr(wanted, conds, mc.samples=1000, denom="iqlr", verbose=TRUE) #Monte Carlo simulation
out <- list() for (i in 1:nrow(metab)) { print(i) y <- aldex.corr(x, as.numeric(metab[i,])) out[[i]] <- y }
pearson.cor <- lapply(out, '[[', 1) pear.cor <- Reduce(rbind, pearson.cor) colnames(pear.cor) <- rownames(wanted) rownames(pear.cor) <- rownames(metab)
pearson.BH <- lapply(out, '[[', 3) pear.BH <- Reduce(rbind, pearson.BH) pear.BH[pear.BH >= 0.1] <- NA pear.BH[pear.BH < 0.1] <- '+'
The work was done on my work computer, which I don't have access to for obvious reasons. I've tried running new analyses with v1.18.10 and v1.20.0 but the correlations I'm getting out look odd. The r values are outside -1 and 1 for pearson, even stranger for spearman. I can't work out why. I've rerun the analyses shown above and the results look nothing those I got previously. Only thing that's changed from what I can tell is you only get r, p and BH column outputs now rather than - colnames(out[[1]])
[1] "pearson.ecor" "pearson.ep" "pearson.eBH" "spearman.erho" "spearman.ep" "spearman.eBH"
Thanks Lesley