Teichlab / cellphonedb

MIT License
342 stars 105 forks source link

Invalid counts data #305

Closed mpermanyer closed 3 years ago

mpermanyer commented 3 years ago

Hi, I am trying to run cellphonedb with my data and it keeps giving the same error: Invalid counts data. I dont know where is the problem since my .txt files seem OK (piece attached below). Could you help me please? Thanks a lot! Marc cellphonedb_meta2.txt cellphonedb_counts2.txt

prete commented 3 years ago

Hi @mpermanyer could you please also provide the command you used to launch CellPhoneDB and your CellPhoneDB and pandas versions (pip show cellphonedb pandas)?

mpermanyer commented 3 years ago

Hi!, here is the "pip show cellphonedb pandas" image

and here is the command I used: image

As you will see, I don´t activate the cpdb environment, because with the "example data" only worked in the "base" environment. In cpdb environment is says command not found (image below) image

Maybe this is the problem?

Thanks a lot! Marc

prete commented 3 years ago

@mpermanyer your counts file (cellphonedb_counts2.txt) is in the wrong format. First column needs to be genes and you've got an extra column with index numbers

X   T_AAACGAAAGAAGCTGC-1    T_AAACGAATCGCCGAGT-1    T_AAACGCTCAGATCACT-1    T_AAAGAACCAGACACAG-1    T_AAAGGGCGTACGTGTT-1
1   ENSG00000137547 0.668047297748681   0   1.10192837465565    1.86962482861772    0.816060062020565
2   ENSG00000120992 0   0   0   0   0
4   ENSG00000187735 0   2.60552371026576    0   0.623208276205908   1.63212012404113
5   ENSG00000047249 0.668047297748681   0   1.10192837465565    1.24641655241182    3.26424024808226
6   ENSG00000023287 0   0   2.20385674931129    0   0.816060062020565
8   ENSG00000168300 1.33609459549736    0   2.20385674931129    0   0
10  ENSG00000179041 0.668047297748681   0   0   0   0
11  ENSG00000147576 0   0   0   0   0

You can drop that column fast with something like:

import pandas as pd
counts = pd.read_csv("cellphonedb_counts2.txt", sep="\t")
counts.to_csv("cellphonedb_counts2.txt",index=False, sep="\t") 

which will result in something like

X   T_AAACGAAAGAAGCTGC-1    T_AAACGAATCGCCGAGT-1    T_AAACGCTCAGATCACT-1    T_AAAGAACCAGACACAG-1    T_AAAGGGCGTACGTGTT-1
ENSG00000137547 0.668047297748681   0.0 1.1019283746556499  1.86962482861772    0.816060062020565
ENSG00000120992 0.0 0.0 0.0 0.0 0.0
ENSG00000187735 0.0 2.60552371026576    0.0 0.623208276205908   1.63212012404113
ENSG00000047249 0.668047297748681   0.0 1.1019283746556499  1.24641655241182    3.26424024808226
ENSG00000023287 0.0 0.0 2.20385674931129    0.0 0.816060062020565
ENSG00000168300 1.33609459549736    0.0 2.20385674931129    0.0 0.0
ENSG00000179041 0.668047297748681   0.0 0.0 0.0 0.0
ENSG00000147576 0.0 0.0 0.0 0.0 0.0
ENSG00000185697 0.0 0.0 0.0 0.0 0.0
mpermanyer commented 3 years ago

Hi! This time it worked! In Seurat I just needed to add row.names=F and it was done. write.table(subset.data, "/home/large/Marc/Tumor/Cellphonedb/cellphonedb_counts.txt", sep="\t", quote=F, row.names=F) However, the output folder is empty; there is no result in it. Does it mean that there is no significant interactions in my data? Thanks! Best Marc

prete commented 3 years ago

I don't think so. I used your sample files cellphonedb_meta2.txt and cellphonedb_counts2.txt (which I fixed using the method described in my last comment) and got some results. Are you sure your counts data has been fixed properly?

mpermanyer commented 3 years ago

Not sure... Here are the new files. cellphonedb_counts2.txt cellphonedb_meta2.txt Could you have a look on them, please? How would you solve this problem in Seurat? Unfortunately I am not that familiarized with Linux. Thanks a lot! Best, Marc

mpermanyer commented 3 years ago

Hi!, at the end it worked! I got the output folder with deconvoluted.txt, means.txt, significant_means.txt but not pvalues.txt.

Why is this? Not significant interactions?

Thanks!

Best, Marc

prete commented 3 years ago

at the end it worked! I got the output folder with deconvoluted.txt, means.txt, significant_means.txt but not pvalues.txt.

You're probably running cellphonedb method analysis instead of cellphonedb method statistical_analysis that's why you didn't get a pvalues.txt file.

mpermanyer commented 3 years ago

Hi! Now it worked! Thanks a lot for the help and for this nice tool!! Best