cell2cell icon indicating copy to clipboard operation
cell2cell copied to clipboard

Importance of sorting contexts

Open deepcompbio opened this issue 3 years ago • 2 comments

Hi Erick,

In your example https://github.com/earmingol/cell2cell/blob/master/examples/tensor_cell2cell/Tensor-cell2cell-PBMC.ipynb, it is suggested to "sort contexts to have them all together by condition, but donors in the same order within each condition".

How important is this requirement for the result?

In my study case, the samples are from both patients and healthy controls. Thus, only the patient samples have the disease condition and the healthy control sample have the healthy condition.

Thanks.

deepcompbio avatar Oct 06 '22 02:10 deepcompbio

Hi!

The order of elements within each dimension does not matter. Tensor decomposition is agnostic to the order of them. Here, we sorted them just for visualization purposes and to keep the same order of patients to easily see the before/after treatment.

If you do not sort them when building the tensor, you can still do it when visualizing the loadings (reorder_elements parameter in the function c2c.plotting.tensor_factors_plot())

If your samples for the healthy and disease conditions are not related, I recommend seeing the tutorial for the ASD case (https://earmingol.github.io/cell2cell/tutorials/ASD/01-Tensor-Factorization-ASD/).

I hope this helps.

earmingol avatar Oct 06 '22 05:10 earmingol

Many thanks for the clarification. It is a good consideration for visualization.

deepcompbio avatar Oct 07 '22 02:10 deepcompbio