microbiome / mia

Microbiome analysis
https://microbiome.github.io/mia/
Artistic License 2.0
46 stars 27 forks source link

function runMDS() do not work #448

Closed jlatreil closed 10 months ago

jlatreil commented 11 months ago

Dear all,

than-you for your very nice package.

Describe the bug I ran the code below from the book "Orchestrating Microbiome Analysis with Bioconductor" in R and it does not work. Everything is ok until runMDS intruction. Any idea ? I put the version of R and of the packages that i used.

all the best

Julie

To Reproduce

library(mia) library(miaTime) library(miaViz) library(scater)

Example data

data("GlobalPatterns", package = "mia")

Data matrix (features x samples)

tse <- GlobalPatterns

some beta diversity metrics are usually applied to relative abundances

tse <- transformAssay(tse, method = "relabundance")

Add group information Feces yes/no

tse$Group <- tse$SampleType == "Feces"

Expected behavior -> but it do not work

Error in assay(x, exprs_values) : 'assay(, i="character", ...)' invalid subscript 'i' 'logcounts' not in names(assays())

Additional context

R version 4.2.2 (2022-10-31) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Red Hat Enterprise Linux 8.6 (Ootpa)

Matrix products: default BLAS/LAPACK: /usr/lib64/libopenblasp-r0.3.15.so

miaViz_1.6.0 miaTime_0.1.21
mia_1.9.16

ake123 commented 11 months ago

Hi, I tested the functions and everything is working correctly in my end. I would recommend you to Update your R version (https://www.r-project.org/).

antagomir commented 11 months ago

Also miaViz current version is 1.9.1 (devtools::install_github("microbiome/miaViz") but that shouldnt affect this.

Does the error message occur in the transformAssay function call, or where exactly?

antagomir commented 11 months ago

The exprs_values is nowadays named assay.type, you can check assayNames(tse) and you need to specify one of these assays via assay.type argument.

jlatreil commented 11 months ago

it is this part which did not work. i will test with an update version of R

Perform PCoA

tse <- runMDS(tse, FUN = vegan::vegdist, method = "bray", name = "PCoA_BC", assay.type = "relabundance")

antagomir commented 11 months ago

Yes, update and let's see. Looking fwd!

ake123 commented 10 months ago

@jlatreil did you manage to update to the latest version of R & the packages and test it?

jlatreil73 commented 10 months ago

Hello, i tried and it's working now.

thank a lot