library(parallel) cl <- makeCluster(detectCores()) clusterEvalQ(cl, library('phyloseq')) clusterExport(cl, 'physeq1')

clusterExport(cl, 'sum_thresh') sum_thresh <- function(x, thresh=0.0005) { ifelse(x <= sum(x)*thresh, 0, x) }

physeq1 <- parApply(colnames(physeq1@otu_table), function(i) { physeq1@otu_table[,i] <- sum_thresh(physeq1@otu_table[,i]) return(physeq1) }, cl=cl)

stopCluster(cl)


原文地址: https://www.cveoy.top/t/topic/oUrz 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录