muon icon indicating copy to clipboard operation
muon copied to clipboard

MOFA error when data has been created using `axis=-1`

Open dawe opened this issue 2 years ago • 4 comments

Hello, I have a MuData object created exploiting axis=-1 as two modalities share a large portion of obs_names and var_names. The shape of the modalities are

[(4664, 55615), (4664, 55879)]

and mdata object is

(4664, 61764)

I have been trying mofa with mostly default parameters (except for a higher number of factors) and I have this error

ValueError: Value passed for key 'LFs' is of incorrect shape. Values of varm must match dimensions (1,) of parent. Value had shape (111494,) while it should have had (61764,).

which, I suspect, is possibly due to the fact modalities have been passed to MOFA using two independent sets of features and not their union. The LF shape (111494) is indeed the sum of modalities' shapes.

dawe avatar Aug 23 '23 12:08 dawe

MOFA specifically and muon in general expect multimodal data. Here mudata is a more flexible container, and it is one of the design challenges how to fail gracefully...

For the MuData object in question, why would modalities share most of their var_names? If the features are different between modalities, it should have axis=0, and then it should work as expected with MOFA and muon.

gtca avatar Oct 17 '24 08:10 gtca

Modalities share var_names because they come from multimodal profiling of chromatin, so they are all in format chr:start-end and multiple omics may share position (but not value).

dawe avatar Oct 17 '24 13:10 dawe

Sounds like those are different modalities so the default axis=0 should be more appropriate to apply multimodal methods.

To note here, most multimodal methods won't account for feature relationships, i.e. that e.g. accessibility at chr1:2345-6789 is actually the same locus as e.g. methylation of chr1:3000-6000.

axis=-1 would be appropriate to store e.g. snapshots of processing stages where some AnnData objects contain feature/sample subsets of others.

gtca avatar Oct 22 '24 10:10 gtca

I see, I'll give a try. Thanks

dawe avatar Oct 22 '24 13:10 dawe