bioFAM / MOFA

Multi-Omics Factor Analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem to use mofaOBJECT

geraldocantelli opened this issue · comments

Good afternoon,
I am trying to use MOFA with my own data but when I create a MOFA object and try to set the environment to run MOFA I get the following error;

$scaleViews
[1] FALSE

$removeIncompleteSamples
[1] FALSE

Error in data[!is.na(data)]%%1 :
argument non-numéric to binary operator
Calls: getDefaultModelOptions -> .inferLikelihoods
interrupts

My code is:
library(MultiAssayExperiment)
library(MOFA)
library(MOFAdata)
library(reticulate)

Using a specific python binary

use_python("/usr/local/bin/python")

transcriptome <- read.table ("/home/geraldo/eclipse-workspace/wsapp/WebContent/apprMOFA/transcriptome.csv", sep = "\t", header = FALSE)

dfT <- data.frame(transcriptome)

metabolome <- read.table ("/home/geraldo/eclipse-workspace/wsapp/WebContent/apprMOFA/metabolome.csv", sep = "\t", header = FALSE)

dfM <- data.frame(metabolome)

allLists <- list ("transcriptoma" = dfT,"metaboloma" = dfM)

#data("CLL_data")

MOFAobject <- createMOFAobject(allLists)

DataOptions <- getDefaultDataOptions()

DataOptions

ModelOptions <- getDefaultModelOptions(MOFAobject)

TrainOptions <- getDefaultTrainOptions()

TrainOptions

MOFAobject <- prepareMOFA(
MOFAobject,
DataOptions = DataOptions,
ModelOptions = ModelOptions,
TrainOptions = TrainOptions
)

outfile = file.path(getwd(),"model.hdf5")

MOFAobject.trained <- runMOFA(MOFAobject, outfile)

Could someone say how to set inferLikelihoods correctly or what can I do in order to code run, please?

The file data: metabolome.csv
metaboloma spontL1 sp80
metaboloma A 10.0 1.0
metaboloma B 5.0 5.0
metaboloma C 1.0 10.0
metaboloma A 10.0 1.0
metaboloma B 5.0 5.0
metaboloma C 1.0 10.0
metaboloma A 10.0 1.0
metaboloma B 5.0 5.0
metaboloma C 1.0 10.0
metaboloma A 10.0 1.0
metaboloma B 5.0 5.0
metaboloma C 1.0 10.0

And transcriptome.csv is the same with the word "transcriptoma".

Best regards,
Geraldo

Hi Geraldo,
is the data normalised in any way? the input data should be continuous, not discrete.

P.S. Please switch to MOFA2 (https://biofam.github.io/MOFA2/), which is also available via bioconductor (http://bioconductor.org/packages/release/bioc/html/MOFA2.html). MOFA v1 is depreciated

Thank you very much for the answer.
So I was testing with wrong values, I am going to use continuous data now and I will update to MOFA2.
Best regards,
Geraldo