Closed ludicaa closed 3 weeks ago
Sorry I cannot reproduce your error just with the h5ad file. Could you export you tensor and upload that file instead? Here there is an example of how doing so: https://colab.research.google.com/drive/1T6MUoxafTHYhjvenDbEtQoveIlHT2U6_#scrollTo=JD8Si50x1jq-
Also, could you check your tensor size and the length of the names you passed for each element in your tensor?
You can do this with these commands:
# Tensor shape
tensor.shape
# Length of Labels for contexts
len(tensor.order_names[0])
# Length of Labels for ligand-receptor pairs
len(tensor.order_names[1])
# Length of Labels for sender cells
len(tensor.order_names[2])
¢ Length of Labels for receiver cells
len(tensor.order_names[3])
I think your issue could be related with passing less or more labels than the actual elements in one of the tensor dimension. From the size, it could be the ligand-receptor pairs. It seems like you only provided labels for 1000 LR pairs, while your tensor has 1999 elements in total.
Hi Erik!
A the following link you can find the tensor and tensor metadata https://www.dropbox.com/scl/fo/qq37tda3yekx0nl073xsb/ACgPNftevARe-Vo1mdt2I1Q?rlkey=ans4a1sdnxbb3d9b77vv1kdv4&dl=0
# Tensor shape
tensor.shape
(13, 1000, 28, 28)
I have to tell you that for a reason I did not figure out, at the first attempt the Labels for ligand-receptor pairs where all capital letters (like for human) while in the ppi_names I had them in the correct format for mouse (i.e., Kdm5d^Whatever). To correct it, since it would not work at the end I just replaced
len(tensor.order_names[1]) = ppi_names #which length is 1999!!!
Thus I think that to correct the metadata creation error, I have generated this new one! Is there a way to make the tensor create the Labels for ligand-receptor pairs in the correct format??
Thank you very much for the help
Ludovica
I see! You are using the tensor-cell2cell analysis without LIANA, right? If so, in the step of creating the interaction tensor you need to add upper_letter_comparison=False
to keep the names in the original format, otherwise they will be transformed to capital letters.
For example:
tensor = c2c.tensor.InteractionTensor(rnaseq_matrices=rnaseq_matrices,
ppi_data=lr_pairs,
context_names=list(context_dict.keys()),
how='outer',
outer_fraction=0.5, # Considers elements in at least 50% of samples
complex_sep='&',
interaction_columns=int_columns,
communication_score='expression_gmean',
upper_letter_comparison=False
)
Then there is no need to do tensor.order_names[1] = ppi_names
Yes I am using the tensor cell2cell without LIANA and yes the upper_letter_comparison=False
solved the issue! Thank you for the help :)
Ludovica
Hi,
I am trying to run cell2cell tensor using GPU on my single cell data from mouse (Iigand-receptor pairs were downloaded from https://raw.githubusercontent.com/LewisLabUCSD/Ligand-Receptor-Pairs/master/Mouse/Mouse-2020-Jin-LR-pairs.csv). While I did not get errors when running your examples, I got troubles at the tensor cell2cell pipeline step below:`
At the end I only get the elbow plot with the rank. Indeed, the pipeline starts the tensor factorization but it stops with the following error:
If you'd like to check the object I am using here is the Dropbox link: https://www.dropbox.com/scl/fo/qq37tda3yekx0nl073xsb/ACgPNftevARe-Vo1mdt2I1Q?rlkey=0ii3b2z6awx70r4jnpgloubgd&dl=0
Thank you