bioFAM / MOFA2

Multi-Omics Factor Analysis
https://biofam.github.io/MOFA2/
GNU Lesser General Public License v3.0
300 stars 52 forks source link

Mefisto error - ValueError: operands could not be broadcast together with shapes (10,1) (23,1) #147

Open saum-kmr opened 7 months ago

saum-kmr commented 7 months ago

Hello,

I am trying to use Mefisto on my dataset of RNA-seq (pseudobulk/donor of scRNA-seq only 1 cell subset ). I am giving time points as the covariate to evaluate the temporal dynamics of my samples. I also have 3 groups and I want to find common and differences in the temporal dynamics for these groups. But using the run_mofa() on my dataset, I get the following msgs and the error:

use_float32 set to True: replacing float64 arrays by float32 arrays to speed up computations...

Successfully loaded view='pseudobulk_RNA' group='ICU_NR' with N=10 samples and D=23923 features... Successfully loaded view='pseudobulk_RNA' group='nonICU_NR' with N=23 samples and D=23923 features... Successfully loaded view='pseudobulk_RNA' group='R' with N=10 samples and D=23923 features...

Loaded 1 covariate(s) for each sample...

Model options:

Smooth covariate framework is activated. This is not compatible with ARD prior on factors. Setting ard_factors to False...

Error: ValueError: operands could not be broadcast together with shapes (10,1) (23,1) In addition: Warning message: In run_mofa(mefisto) : No output filename provided. Using /vol/tmp/RtmpcHXgYH/mofa_20240221-141933.hdf5 to store the trained model.

Can you please suggest what is going wrong here? What am I missing here?

Thanks, Saumya

bv2 commented 7 months ago

Dear Saumya,

I have not encountered this error before. Could you also share the print-out of the untrained MOFA model and the covariates slot of it (MOFAobject_untrained@covariates)? Did you modify any of the training, model options or use the default?

Thanks, Britta

saum-kmr commented 7 months ago

Dear Britta,

Please see below the printout:

mefisto Untrained MEFISTO model with the following characteristics: Number of views: 1 Views names: pseudobulk_RNA Number of features (per view): 23923 Number of groups: 3 Groups names: ICU_NR nonICU_NR R Number of samples (per group): 10 23 10 Number of covariates per sample: 1

mefisto_opts $scale_cov [1] FALSE

$start_opt [1] 20

$n_grid [1] 20

$opt_freq [1] 10

$model_groups [1] TRUE

$sparseGP [1] FALSE

$frac_inducing [1] 0.75

$warping [1] FALSE

$warping_freq [1] 20

$warping_ref [1] "ICU_NR"

$warping_open_begin [1] TRUE

$warping_open_end [1] TRUE

$warping_groups NULL

$new_values NULL

Regarding covariates, here it is:

mefisto@covariates $ICU_NR D1_T1 D1_T4 D2_T3 D2_T5 D3_T1 D3_T3 D4_T1 D5_T1 D6_T2 D7_T4 time 12 207 107 295 31 101 7 7 53 211

$nonICU_NR D8_T2 D8_T3 D8_T4 D9_T2 D9_T3 D10_T3 D10_T4 D11_T4 D12_T1 D13_T1 D13_T3 D13_T4 D14_T1 time 64 149 191 71 170 146 209 215 9 16 157 213 6 D15_T2 D15_T3 D15_T4 D15_T5 D16_T3 D16_T4 D17_T3 D17_T4 D18_T1 D18_T3 time 78 127 226 303 138 201 132 207 2 107

$R D9_T4 D13_T5 D14_T3 D19_T3 D5_T4 D20_T3 D21_T4 D6_T3 D6_T5 D18_T2 time 232 292 132 124 207 132 251 143 311 58

bv2 commented 7 months ago

Looks good from the distance - can you trace back which step in the model the error comes from? You can also share the untrained model (e.g. with only one or a few features) with me via our Slack channel or mail and I am happy to take a look.

saum-kmr commented 7 months ago

Hi Britta, Thanks for the offer, I sent you a slack message with the traceback and attached the untrainedmodel.

Best, Saumya

pierick-mouginot commented 5 months ago

Hello, I am having the same issue. Have you found something to solve the problem?

Thanks