Error in `$<-.data.frame`(`*tmp*`, "feature", value = XXX) replacement has YYY rows, data has 0

0

Hello,
I have been trying to get this MOFA tutorial to work with my data set, but keep getting this error when the model is trained.

Error in `$<-.data.frame`(`*tmp*`, "feature", value = c("chr1:3514872-3515102",  : 


replacement has 131600 rows, data has 0

My code is very similar to the tutorial:

data <- fread("C:/Users/cathe/Desktop/NordenLab/Project/06172021 MEFISTO/Works/LongDataframe10Samples.txt")
data = data.frame(data)

#create MOFA Object
MOFAobject <- create_mofa(data)
MOFAobject
plot_data_overview(MOFAobject)

#Options
data_opts <- get_default_data_options(MOFAobject)
model_opts <- get_default_model_options(MOFAobject)
train_opts <- get_default_training_options(MOFAobject)

#Build Train MOFA Object
MOFAobject <- prepare_mofa(
  object = MOFAobject,
  data_options = data_opts,
  model_options = model_opts,
  training_options = train_opts
)

#Run MOFA
outfile = file.path(getwd(),"model.hdf5")
MOFAobject.trained <- run_mofa(MOFAobject, outfile)

So there is something wrong with my data.frame, which is formatted like this:

> data
    sample       feature        value view
1      MEF 0610005C13Rik 3.465742e-01  RNA
2      MEF 0610007P14Rik 4.508857e+01  RNA
3      MEF 0610009B22Rik 3.927700e+01  RNA
4      MEF 0610009L18Rik 3.487817e+00  RNA
5      MEF 0610009O20Rik 3.056666e+01  RNA
...
779921  iPSC5 chrY:90824242-90824507    31 ATAC
779922  iPSC5 chrY:90825138-90825545    38 ATAC
779923  iPSC5 chrY:90835583-90835832    19 ATAC
779924  iPSC5 chrY:90841589-90841857    31 ATAC
779925  iPSC5 chrY:90843869-90844126    16 ATAC

Any thoughts on how to resolve this error?


R

• 38 views

updated 2 hours ago by

34k

written 3 hours ago by

&utrif;

10



Source link