ventolab / CellphoneDB

CellPhoneDB can be used to search for a particular ligand/receptor, or interrogate your own HUMAN single-cell transcriptomics data.
https://www.cellphonedb.org/
MIT License
320 stars 51 forks source link

ParseCountsException: Invalid Counts data #160

Open scuhkf opened 9 months ago

scuhkf commented 9 months ago

Hello CellphoneDB team, First, I want to express my gratitude for your excellent work in providing powerful tools for researchers. I am analyzing my single-cell sequencing data using CellPhoneDB. I performed homology conversion by converting all gene symbols of the mouse to uppercase. I do not use numeric cell type names and dashes (“-”) in cell names in my input data. However, an error still occurred. I hope to receive your assistance. The following is a screenshot of part of the code. Thank you!

1

2

3

x

5

6

datasome commented 9 months ago

Hi scuhkf,

Thank you for using CellphoneDB. Before I get to the error, I'm not at all sure about the method you used for homology mapping - my advice would be to use e.g. Ensembl as a source of that mapping - see: https://www.ensembl.org/biomart/martview/6a6c77ab85b155224519be8e94759766 (based on advice in https://www.biostars.org/p/149115/)

As for the ParseCountsException, to get the counts matrix you need to do adata.to_df().T - I think you're currently missing the '.T'. Hope that helps.

Best,

Robert.

scuhkf commented 9 months ago

Hi scuhkf,

Thank you for using CellphoneDB. Before I get to the error, I'm not at all sure about the method you used for homology mapping - my advice would be to use e.g. Ensembl as a source of that mapping - see: https://www.ensembl.org/biomart/martview/6a6c77ab85b155224519be8e94759766 (based on advice in https://www.biostars.org/p/149115/)

As for the ParseCountsException, to get the counts matrix you need to do adata.to_df().T - I think you're currently missing the '.T'. Hope that helps.

Best,

Robert.

Thank you for your response. When I transposed the expression matrix, the same error still occurred. Later, I attempted to save the expression matrix as an h5ad file for input data, but the same error message still appeared. I'm not sure if I used an inappropriate method for homologous gene conversion, which may have caused the error. The following is a screenshot of part of the code. 1

2

3

4

I used h5ad format as input data, but the same error message still appeared. 5

6

scuhkf commented 9 months ago

Hi scuhkf,

Thank you for using CellphoneDB. Before I get to the error, I'm not at all sure about the method you used for homology mapping - my advice would be to use e.g. Ensembl as a source of that mapping - see: https://www.ensembl.org/biomart/martview/6a6c77ab85b155224519be8e94759766 (based on advice in https://www.biostars.org/p/149115/)

As for the ParseCountsException, to get the counts matrix you need to do adata.to_df().T - I think you're currently missing the '.T'. Hope that helps.

Best,

Robert.

I have resolved the issue by adding the parameter "index=False".

7

Additionally, I have another question. How do I use an AnnData object in memory as the input data for counts? "adata_CellphoneDB" is the variable name for the AnnData object read into memory. Whenever I specify counts_file_path = adata_CellphoneDB, I always encounter the following error. 8

9

datasome commented 9 months ago

Hi scuhkf,

I'm glad to hear you were able to resolve the original issue.

On your second question, it is now possible to pass an in-memory AnnData object as the value for counts_file_path call argument for each of CellphoneDB analysis method. Please do: pip install --force-reinstall "git+https://github.com/ventolab/CellphoneDB.git" and then try cpdb_analysis_method.call() again, this time passing the in-memory AnnData object, and let me know of any issues.

Best,

Robert.

scuhkf commented 9 months ago

Hi scuhkf,

I'm glad to hear you were able to resolve the original issue.

On your second question, it is now possible to pass an in-memory AnnData object as the value for counts_file_path call argument for each of CellphoneDB analysis method. Please do: pip install --force-reinstall "git+https://github.com/ventolab/CellphoneDB.git" and then try cpdb_analysis_method.call() again, this time passing the in-memory AnnData object, and let me know of any issues.

Best,

Robert.

Thank you for your help!

scuhkf commented 9 months ago

Hi scuhkf, I'm glad to hear you were able to resolve the original issue. On your second question, it is now possible to pass an in-memory AnnData object as the value for counts_file_path call argument for each of CellphoneDB analysis method. Please do: pip install --force-reinstall "git+https://github.com/ventolab/CellphoneDB.git" and then try cpdb_analysis_method.call() again, this time passing the in-memory AnnData object, and let me know of any issues. Best, Robert.

Thank you for your help!

Thank you very much for your patience in answering, but I have encountered another issue while using it and have to bother you again. When I use the search_utils.search_analysis_results function to filter my results, it always returns an empty dataframe. However, I can see the some matching results in significant_means.

a

This is a screenshot of significant_means, and some matching results can be seen.

b

datasome commented 9 months ago

Hi scuhkf,

What happens when you do: search_utils.search_analysis_results((query_cell_types_1=['Podo'] and query_cell_types_1=['Fib'], ..) ?

Best,

Robert.