We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
i am trying to run MOFA on my mudata object and i run to this issue
MuData object with n_obs × n_vars = 2 × 698441 var: 'mean', 'total', 'tech', 'bio', 'FDR', 'p.value', 'hvg', 'highly_variable', 'std' uns: 'psbulk_stats' 38 modalities MONO.CD14: 2 x 26641 var: 'mean', 'total', 'tech', 'bio', 'FDR', 'p.value', 'hvg', 'highly_variable', 'std' uns: 'log1p' layers: 'psbulk_props'
m=mu.tl.mofa(mdata, use_obs='union', convergence_mode='medium', n_factors=2, use_var='highly_variable' ) ######################################################### ### __ __ ____ ______ ### ### | \/ |/ __ \| ____/\ _ ### ### | \ / | | | | |__ / \ _| |_ ### ### | |\/| | | | | __/ /\ \_ _| ### ### | | | | |__| | | / ____ \|_| ### ### |_| |_|\____/|_|/_/ \_\ ### ### ### ######################################################### Loaded view='MONO.CD14' group='group1' with N=2 samples and D=14177 features... Loaded view='Plasma cells' group='group1' with N=2 samples and D=11134 features... Loaded view='MONO.CD16' group='group1' with N=2 samples and D=13649 features... Loaded view='pDC' group='group1' with N=2 samples and D=12461 features... Loaded view='B.Switched.memory' group='group1' with N=2 samples and D=14037 features... Loaded view='B.Non.Switched.memory' group='group1' with N=2 samples and D=13939 features... Loaded view='Progenitors' group='group1' with N=2 samples and D=13104 features... Loaded view='cDC' group='group1' with N=2 samples and D=13520 features... Loaded view='B.Naive' group='group1' with N=2 samples and D=13797 features... Loaded view='B.Exhausted memory' group='group1' with N=2 samples and D=13326 features... Loaded view='T.CD8.N' group='group1' with N=2 samples and D=13902 features... Loaded view='NK.brt' group='group1' with N=2 samples and D=13868 features... Loaded view='T.CD4.N' group='group1' with N=2 samples and D=13999 features... Loaded view='T.CD4.CM.Tfh' group='group1' with N=2 samples and D=13948 features... Loaded view='T.CD4.EM.TH22' group='group1' with N=2 samples and D=13673 features... Loaded view='NK.dim' group='group1' with N=2 samples and D=13956 features... Loaded view='T.CD4.EM.TH2' group='group1' with N=2 samples and D=13707 features... Loaded view='T.CD4.EM.TH17' group='group1' with N=2 samples and D=13813 features... Loaded view='T.CD4.EM.TH1/17' group='group1' with N=2 samples and D=13901 features... Loaded view='T.CD8.CM' group='group1' with N=2 samples and D=13863 features... Loaded view='T.Reg.Memory' group='group1' with N=2 samples and D=13616 features... Loaded view='T.CD8.TEM' group='group1' with N=2 samples and D=13929 features... Loaded view='CD5 B cells' group='group1' with N=2 samples and D=11382 features... Loaded view='T.CD4.E.MIR155' group='group1' with N=2 samples and D=11628 features... Loaded view='T.Reg.KLRB1' group='group1' with N=2 samples and D=12465 features... Loaded view='MAIT' group='group1' with N=2 samples and D=13859 features... Loaded view='T.CD8.CM.CCR4' group='group1' with N=2 samples and D=13741 features... Loaded view='T.gd' group='group1' with N=2 samples and D=13681 features... Loaded view='T.CD8.EMRA' group='group1' with N=2 samples and D=13724 features... Loaded view='T.Reg.N' group='group1' with N=2 samples and D=13637 features... Loaded view='MONO.Intermediate' group='group1' with N=2 samples and D=8326 features... Loaded view='T.DN' group='group1' with N=2 samples and D=9545 features... Loaded view='T.MEM.KLRC2' group='group1' with N=2 samples and D=10508 features... Loaded view='T.CD4.CTL' group='group1' with N=2 samples and D=13573 features... Loaded view='T.CD8.NKT' group='group1' with N=2 samples and D=12777 features... Loaded view='NK.M.LIKE' group='group1' with N=2 samples and D=13106 features... Loaded view='unassigned' group='group1' with N=2 samples and D=12665 features... Loaded view='ILC' group='group1' with N=2 samples and D=8174 features... Warning: 1 features(s) in view 4 have zero variance, consider removing them before training the model... 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: True Likelihoods: - View 0 (MONO.CD14): gaussian - View 1 (Plasma cells): gaussian - View 2 (MONO.CD16): gaussian - View 3 (pDC): gaussian - View 4 (B.Switched.memory): gaussian - View 5 (B.Non.Switched.memory): gaussian - View 6 (Progenitors): gaussian - View 7 (cDC): gaussian - View 8 (B.Naive): gaussian - View 9 (B.Exhausted memory): gaussian - View 10 (T.CD8.N): gaussian - View 11 (NK.brt): gaussian - View 12 (T.CD4.N): gaussian - View 13 (T.CD4.CM.Tfh): gaussian - View 14 (T.CD4.EM.TH22): gaussian - View 15 (NK.dim): gaussian - View 16 (T.CD4.EM.TH2): gaussian - View 17 (T.CD4.EM.TH17): gaussian - View 18 (T.CD4.EM.TH1/17): gaussian - View 19 (T.CD8.CM): gaussian - View 20 (T.Reg.Memory): gaussian - View 21 (T.CD8.TEM): gaussian - View 22 (CD5 B cells): gaussian - View 23 (T.CD4.E.MIR155): gaussian - View 24 (T.Reg.KLRB1): gaussian - View 25 (MAIT): gaussian - View 26 (T.CD8.CM.CCR4): gaussian - View 27 (T.gd): gaussian - View 28 (T.CD8.EMRA): gaussian - View 29 (T.Reg.N): gaussian - View 30 (MONO.Intermediate): gaussian - View 31 (T.DN): gaussian - View 32 (T.MEM.KLRC2): gaussian - View 33 (T.CD4.CTL): gaussian - View 34 (T.CD8.NKT): gaussian - View 35 (NK.M.LIKE): gaussian - View 36 (unassigned): gaussian - View 37 (ILC): gaussian Warning: some group(s) have less than 15 samples, MOFA won't be able to learn meaningful factors for these group(s)... ###################################### ## Training the model with seed 1 ## ###################################### Converged! Attempting to save the model at the current iteration... Saving model in /tmp/mofa_20240214-141144_interrupted.hdf5... --------------------------------------------------------------------------- TypeError Traceback (most recent call last) File ~/venvs/scvi/lib/python3.11/site-packages/mofapy2/run/entry_point.py:57, in keyboardinterrupt_saver.<locals>.saver(self, *args, **kwargs) 56 try: ---> 57 func(self, *args, **kwargs) 58 # Internal methods will raise TypeError when interrupted File ~/venvs/scvi/lib/python3.11/site-packages/mofapy2/run/entry_point.py:1434, in entry_point.run(self) 1433 # Train the model -> 1434 train_model(self.model) File ~/venvs/scvi/lib/python3.11/site-packages/mofapy2/build_model/train_model.py:27, in train_model(model) 25 print("\n") ---> 27 model.iterate() 29 print("\n") File ~/venvs/scvi/lib/python3.11/site-packages/mofapy2/core/BayesNet.py:387, in BayesNet.iterate(self) 381 finally: 382 # Finish by collecting the training statistics 383 self.train_stats = { 384 "time": iter_time, 385 "number_factors": number_factors, 386 "elbo": elbo["total"].values, --> 387 "elbo_terms": elbo.drop("total", 1), 388 } 389 if "Sigma" in self.nodes.keys(): TypeError: DataFrame.drop() takes from 1 to 2 positional arguments but 3 were given During handling of the above exception, another exception occurred: AttributeError Traceback (most recent call last) Cell In[56], line 1 ----> 1 m=mu.tl.mofa(mdata, 2 use_obs='union', 3 convergence_mode='medium', 4 n_factors=2, 5 6 7 use_var='highly_variable' 8 ) File ~/venvs/scvi/lib/python3.11/site-packages/muon/_core/tools.py:588, in mofa(data, groups_label, use_raw, use_layer, use_var, use_obs, likelihoods, n_factors, scale_views, scale_groups, center_groups, ard_weights, ard_factors, spikeslab_weights, spikeslab_factors, n_iterations, convergence_mode, use_float32, gpu_mode, gpu_device, svi_mode, svi_batch_size, svi_learning_rate, svi_forgetting_rate, svi_start_stochastic, smooth_covariate, smooth_warping, smooth_kwargs, save_parameters, save_data, save_metadata, seed, outfile, expectations, save_interrupted, verbose, quiet, copy) 586 ent.build() 587 logging.info(f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] Running the model...") --> 588 ent.run() 590 if ( 591 smooth_kwargs is not None 592 and "new_values" in smooth_kwargs 593 and smooth_kwargs["new_values"] 594 and smooth_covariate 595 ): 596 logging.info(f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] Interpolating factors...") File ~/venvs/scvi/lib/python3.11/site-packages/mofapy2/run/entry_point.py:70, in keyboardinterrupt_saver.<locals>.saver(self, *args, **kwargs) 65 else: 66 tmp_file = os.path.join( 67 "/tmp", 68 "mofa_{}_interrupted.hdf5".format(strftime("%Y%m%d-%H%M%S")), 69 ) ---> 70 self.save(outfile=tmp_file) 71 print( 72 "Saved partially trained model in {}. Exiting now.".format(tmp_file) 73 ) 74 else: File ~/venvs/scvi/lib/python3.11/site-packages/mofapy2/run/entry_point.py:1778, in entry_point.save(self, outfile, save_data, save_parameters, expectations) 1775 tmp.saveSmoothOptions(self.smooth_opts) 1777 # Save training statistics -> 1778 tmp.saveTrainingStats() 1780 # Save variance explained values 1781 tmp.saveVarianceExplained() File ~/venvs/scvi/lib/python3.11/site-packages/mofapy2/build_model/save_model.py:754, in saveModel.saveTrainingStats(self) 751 """Method to save the training statistics""" 753 # Get training statistics --> 754 stats = self.model.getTrainingStats() 756 # Create HDF5 group 757 stats_grp = self.hdf5.create_group("training_stats") File ~/venvs/scvi/lib/python3.11/site-packages/mofapy2/core/BayesNet.py:503, in BayesNet.getTrainingStats(self) 501 def getTrainingStats(self): 502 """Method to return training statistics""" --> 503 return self.train_stats AttributeError: 'BayesNet' object has no attribute 'train_stats'
Session information updated at 2024-02-14 14:19
The text was updated successfully, but these errors were encountered:
Hi @Marwansha, it seems like this is a bug with mofapy2 0.7.0, if you update to 0.7.1 it should be resolved. Works for me at least :)
0.7.1
Sorry, something went wrong.
I am using 0.7.1 and ran into the same problem
No branches or pull requests
i am trying to run MOFA on my mudata object and i run to this issue
herre is the session info
anndata 0.10.3
decoupler 1.5.0
liana 1.0.4
matplotlib 3.8.1
mofapy2 0.7.0
mudata 0.2.3
muon 0.1.5
numpy 1.26.1
pandas 2.1.1
plotnine 0.12.4
scanpy 1.9.6
seaborn 0.12.2
session_info 1.0.0
Click to view modules imported as dependencies
IPython 8.17.2
jupyter_client 8.6.0
jupyter_core 5.5.0
Python 3.11.4 (main, Jul 5 2023, 13:45:01) [GCC 11.2.0]
Linux-4.18.0-477.43.1.el8_8.x86_64-x86_64-with-glibc2.28
Session information updated at 2024-02-14 14:19
The text was updated successfully, but these errors were encountered: