I have always gotten this error after running MOFA:
#######################
Training finished
#######################
Saving model in /g/huber/users/mirmuell/projects/MOFAAnalysis/mofa_object/mcl_mzl_d0_model.hdf5...
Error in py_call_impl(callable, call_args$unnamed, call_args$named) :
TypeError: No conversion path for dtype: dtype('<U37')
Run reticulate::py_last_error() for details.
Calls: source ... .run_mofa_reticulate -> -> py_call_impl
In addition: Warning messages:
1: In .rename_duplicated_features(object) :
There are duplicated features names across different views. We will add the suffix _view only for those features
Example: if you have both TP53 in mRNA and mutation data it will be renamed to TP53_mRNA, TP53_mutation
2: In prepare_mofa(mofa_object, model_options = model_opts) :
Some view(s) have a lot of features, it is recommended to perform a more stringent feature selection before creating the MOFA object....
Execution halted
Initially the fix I tried is to shorten the col names in my df which just let to a "No conversion path for dtype: dtype('<U27') error". I found a fix now by switching to using object in a np array (np.array(some_list, dtype=object)). Adding this to my script fixed the issue:
reticulate::py_run_string(
"
import h5py
import numpy as np
_original_create_dataset = h5py.Group.create_dataset
def _patched_create_dataset(self, name, data=None, **kwargs):
if data is not None:
arr = np.asarray(data)
if arr.dtype.kind == 'U':
data = arr.astype(object)
# Also fix dtype kwarg if passed explicitly
if 'dtype' in kwargs and hasattr(kwargs['dtype'], 'kind') and kwargs['dtype'].kind == 'U':
kwargs['dtype'] = object
return _original_create_dataset(self, name, data=data, **kwargs)
h5py.Group.create_dataset = _patched_create_dataset
print('h5py.Group.create_dataset patched successfully')
"
)
I have always gotten this error after running MOFA:
#######################
Training finished
#######################
Saving model in /g/huber/users/mirmuell/projects/MOFAAnalysis/mofa_object/mcl_mzl_d0_model.hdf5...
Error in py_call_impl(callable, call_args$unnamed, call_args$named) :
TypeError: No conversion path for dtype: dtype('<U37')
Run
reticulate::py_last_error()for details.Calls: source ... .run_mofa_reticulate -> -> py_call_impl
In addition: Warning messages:
1: In .rename_duplicated_features(object) :
There are duplicated features names across different views. We will add the suffix _view only for those features
Example: if you have both TP53 in mRNA and mutation data it will be renamed to TP53_mRNA, TP53_mutation
2: In prepare_mofa(mofa_object, model_options = model_opts) :
Some view(s) have a lot of features, it is recommended to perform a more stringent feature selection before creating the MOFA object....
Execution halted
Initially the fix I tried is to shorten the col names in my df which just let to a "No conversion path for dtype: dtype('<U27') error". I found a fix now by switching to using object in a np array (np.array(some_list, dtype=object)). Adding this to my script fixed the issue:
reticulate::py_run_string(
"
import h5py
import numpy as np
_original_create_dataset = h5py.Group.create_dataset
def _patched_create_dataset(self, name, data=None, **kwargs):
if data is not None:
arr = np.asarray(data)
if arr.dtype.kind == 'U':
data = arr.astype(object)
# Also fix dtype kwarg if passed explicitly
if 'dtype' in kwargs and hasattr(kwargs['dtype'], 'kind') and kwargs['dtype'].kind == 'U':
kwargs['dtype'] = object
return _original_create_dataset(self, name, data=data, **kwargs)
h5py.Group.create_dataset = _patched_create_dataset
print('h5py.Group.create_dataset patched successfully')
"
)