ggloor / ALDEx_bioc

ALDEx_bioc is the working directory for updating bioconductor
26 stars 13 forks source link

Error in var(x) : is.atomic(y) is not TRUE #76

Open Liviacmg opened 1 week ago

Liviacmg commented 1 week ago

I am trying to run this tutorial https://ycl6.github.io/16S-Demo/4_picrust2_tutorial.html and the following error occurs:

set.seed(123) system.time({ aldex2_EC = aldex(p2EC, metadata$fecal_sample_type, mc.samples = 500, test = "t", effect = TRUE, denom = "iqlr", verbose = TRUE) }) aldex.clr: generating Monte-Carlo instances and clr values conditions vector supplied operating in serial mode removed rows with sums equal to zero computing iqlr centering

Error in var(x) : is.atomic(y) is not TRUE 13.stop(simpleError(msg, call = if (p <- sys.parent(1L)) sys.call(p))) 12.stopifnot(is.atomic(y)) 11.var(x) 10.var(x) 9.FUN(newX[, i], ...) 8.apply(reads.clr[these.rows, ], 2, function(x) { var(x) }) 7.iqlr.features(reads, conds) 6.aldex.set.mode(reads, conds, denom) 5.aldex.clr.function(as.data.frame(reads), conds, mc.samples, denom, verbose, useMC, summarizedExperiment = FALSE, gamma) 4.aldex.clr(reads = reads, conds = conditions, mc.samples = mc.samples, denom = denom, verbose = verbose, useMC = FALSE, gamma = gamma) 3.aldex.clr(reads = reads, conds = conditions, mc.samples = mc.samples, denom = denom, verbose = verbose, useMC = FALSE, gamma = gamma) 2.aldex(p2EC, metadata$fecal_sample_type, mc.samples = 500, test = "t", effect = TRUE, denom = "iqlr", verbose = TRUE) 1.system.time({ aldex2_EC = aldex(p2EC, metadata$fecal_sample_type, mc.samples = 500, test = "t", effect = TRUE, denom = "iqlr", verbose = TRUE) })

Timing stopped at: 1.217 0.014 1.224

ggloor commented 1 week ago

Hmmm, this is usually a mismatch in input files.

can you provide a little bit more information on the format of the input files, and perhaps the first couple of lines?

Liviacmg commented 1 week ago

Hmmm, this is usually a mismatch in input files.

can you provide a little bit more information on the format of the input files, and perhaps the first couple of lines?

The input files are the picrust2 output files:

picrust2 = "/pathway/"

Import PICRUSt2 results

p2_EC = paste0(picrust2, "/EC_metagenome_out/pred_metagenome_unstrat.tsv.gz") p2_KO = paste0(picrust2, "/KO_metagenome_out/pred_metagenome_unstrat.tsv.gz") p2_PW = paste0(picrust2, "/pathways_out/path_abun_unstrat.tsv.gz")

Load picrust2 output files

p2EC = as.data.frame(fread(p2_EC)) rownames(p2EC) = p2EC$"function" p2EC = as.matrix(p2EC[,-1]) p2EC = round(p2EC)

p2KO = as.data.frame(fread(p2_KO)) rownames(p2KO) = p2KO$"function" p2KO = as.matrix(p2KO[,-1]) p2KO = round(p2KO)

p2PW = as.data.frame(fread(p2_PW)) rownames(p2PW) = p2PW$"pathway" p2PW = as.matrix(p2PW[,-1]) p2PW = round(p2PW)

Reading metadata file

metadata <- read_q2metadata("/pathway/sample-metadata-picrust.txt") metadata <- metadata[order(metadata$SampleID),] metadata$maternal_obesity,<- as.character(metadata$maternal_obesity,)

EC

set.seed(123) system.time({ aldex2_EC = aldex(p2EC, metadata$maternal_obesity, mc.samples = 500, test = "t", effect = TRUE, denom = "iqlr", verbose = TRUE) })

First lines of the files:

p2EC:

SRR1556302 SRR1556810 SRR1556811 SRR1556812 SRR1556813 SRR1556814 EC:1.1.1.1 1045 6592 2477 2972 2065 2894 EC:1.1.1.100 1809 6671 5951 6826 4398 6364

metadata

SampleID maternal_obesity

q2:types categorical

SRR1556302 Obese SRR1556810 Obese SRR1556811 Non-Obese SRR1556812 Non-Obese

Both input files have matching rows and columns:

ncol(p2EC) [1] 79 nrow(metadata) [1] 79