CostaLab / CrossTalkeR

R package to do the Ligand Receptor Analysis Visualization
https://costalab.github.io/CrossTalkeR/
MIT License
41 stars 10 forks source link

Error: You should have at least two distinct break values. #34

Closed dengay closed 3 years ago

dengay commented 3 years ago

Hi. Thanks for this great tool. I am trying to get through your last code from the cellphonedb tutorial and cannot figure out my problem. I am comparing 2 cellphonedb-generated files with data successfully extracted as LR (s1a and s2a) and have successfully initiated the code using:

data <- generate_report(paths, genes=genes1, out_path='~/Desktop/', threshold = 0, out_file='All_DG.html' )

where genes1 = c("TGFB1", "TNF")

Here is what I get:

Reading Files CTR "s1a_filtered_corrected.csv" EXP "s2a_filtered_corrected.csv" Create a Differential Table Calculating CCI Ranking EXP_x_CTR

Calculating GCI Ranking EXP_x_CTR Annotating the top Cell Genes 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:1 mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:1 mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:1 mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns 'select()' returned 1:many mapping between keys and columns Defining templates Generating Report Preparing Single Phenotype Report Printing CCI CTR Printing CCI EXP Preparing Comparative Phenotype Report Printing CCI EXP_x_CTR Quitting from lines 133-145 (./Comparative_Condition_cgi.Rmd) Quitting from lines 79-90 (./Comparative_Condition_cgi.Rmd) Error: You should have at least two distinct break values. In addition: Warning messages: 1: In eattrs[[name]][index] <- value : number of items to replace is not a multiple of replacement length 2: In eattrs[[name]][index] <- value : number of items to replace is not a multiple of replacement length 3: Removed 1290 rows containing missing values (geom_label_repel). 4: Removed 1291 rows containing missing values (geom_label_repel). Error: You should have at least two distinct break values.

It looks to me like most of the code has run successfully. I have tried adding colors (2 colors or 7 colors), changing the number of genes to examine (3 genes, 2 genes, 1 gene). I would really appreciate your help with this. Thanks!

dengay commented 3 years ago

I should add that my s1 and s2 csv files are organized as follows: Ligand Receptor Ligand.Cluster Receptor.Cluster isReceptor_fst isReceptor_scn MeanLR rather than: Ligand Ligand.Cluster Receptor Receptor.Cluster... I don't know if this makes any difference. Thanks again.

dengay commented 3 years ago

Hi. I see that I have received the LR_report for what looks like all receptor:ligand pairs. I just don't see anything for the queried gene "TGFB1". I guess this is where the error is being thrown. Any help with this would be much appreciated. Thanks again for this great tool.

jsnagai commented 3 years ago

Hi @dengay . Thank you for your feedback. Can you run the generate_report setting the report variable as FALSE. In this way, we can identify if the problem is in the analysis part or if it is on report part. Also, you can try set variable genes as NA.

dengay commented 3 years ago

Hi. I updated python from 3.7.9 to 3.9.2, pandas to 1.3.2, reran the code to extract LRs and changed the csv output slightly to s1_filtered.to_csv('s1_filtered_corrected.csv', index=False) (although I have not confirmed that this is really necessary) and reran CrossTalkeR code as specified in your cellphonedb-to-CrossTalkeR vignette. Now it works perfectly. The analysis produced both comparative and single htmls as well as interactive rds files. Thanks for your help and again for this great tool!