Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
saum-kmr opened this issue Feb 21, 2024 · 5 comments

Comments

@saum-kmr
Copy link

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:

  • Automatic Relevance Determination prior on the factors: True
  • Automatic Relevance Determination prior on the weights: True
  • Spike-and-slab prior on the factors: False
  • Spike-and-slab prior on the weights: False
    Likelihoods:
  • View 0 (pseudobulk_RNA): gaussian

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
Copy link
Collaborator

bv2 commented Feb 26, 2024

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
Copy link
Author

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
Copy link
Collaborator

bv2 commented Feb 27, 2024

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
Copy link
Author

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

Best,
Saumya

@pierick-mouginot
Copy link

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

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants