livnatje / DIALOGUE

DIALOGUE is a dimensionality reduction method that uses cross-cell-type associations to identify multicellular programs (MCPs) and map the cell transcriptome as a function of its environment.
Other
106 stars 16 forks source link

can't replicate MCP results fig4 paper #7

Closed bio-la closed 2 years ago

bio-la commented 2 years ago

Hi, thanks for the cool package! i'm trying to replicate the MCP in fig4 of the paper with data from UC patients.

Following the short description in the methods, I have created a seurat object, normalized, selected top 2000 features and scaled then run PCA. Then created a list of cell.type objects for the 5 cell types of the figure, specifying as "X" the first 30 PCs, and as cellQ value the nFeature_RNA of each cell.

However, when I run DIALOGUE.run I get

Error in while (lb < ceil(length(cell.types)/2)) { : 
  missing value where TRUE/FALSE needed

which is here . the emp.p matrix that is printed in one of the previous steps doesn't have any p<0.01, so I think that's what's causing the problem. (lb is not a value)

Can you please provide minimal code so I can replicate the MCP or guidance on what should be done differently in this case?

thank you!

livnatje commented 2 years ago

Thank you and sorry for the super late response! We will provide additional code and data to reproduce the results. More updates soon.

bio-la commented 2 years ago

hey @livnatje , thanks for getting back to me. after a bit of digging in the source code, I found out that DIALOGUE is not expecting underscores "_" in the celltype names cause it uses that char to split strings of pairs of celltypes.

once I corrected the celltype names the function ran until what I believe is the end, but didn't identify MCPs and produced these errors:

[1] "#************DIALOGUE Step II (multilevel modeling): TA1 vs. TA2 ************#"
[1] "No MCPs identified for these cell types."
[1] "#************DIALOGUE Step II (multilevel modeling): TA1 vs. CD8cells ************#"
[1] "No MCPs identified for these cell types."
[1] "#************DIALOGUE Step II (multilevel modeling): TA1 vs. CD4cells ************#"
[1] "No MCPs identified for these cell types."
[1] "#************DIALOGUE Step II (multilevel modeling): TA1 vs. Macrophages ************#"
[1] "No MCPs identified for these cell types."
[1] "#************DIALOGUE Step II (multilevel modeling): TA2 vs. CD8cells ************#"
[1] "No MCPs identified for these cell types."
[1] "#************DIALOGUE Step II (multilevel modeling): TA2 vs. CD4cells ************#"
[1] "No MCPs identified for these cell types."
[1] "#************DIALOGUE Step II (multilevel modeling): TA2 vs. Macrophages ************#"
[1] "No MCPs identified for these cell types."
[1] "#************DIALOGUE Step II (multilevel modeling): CD8cells vs. CD4cells ************#"
[1] "No MCPs identified for these cell types."
[1] "#************DIALOGUE Step II (multilevel modeling): CD8cells vs. Macrophages ************#"
[1] "No MCPs identified for these cell types."
[1] "#************DIALOGUE Step II (multilevel modeling): CD4cells vs. Macrophages ************#"
[1] "No MCPs identified for these cell types."
[1] "#************Finalizing the scores************#"
[1] "DIALOGUE2_smilie.rds"
[1] "No MCPs identified."
Error in r1@X[, rownames(WS)] %*% WS : 
  requires numeric/complex matrix/vector arguments
In addition: Warning messages:
1: In dir.create(results.dir) :
  'DIALOGUE.rep.smilie' already exists
2: In cor(t(r@tpm), r@scores) : the standard deviation is zero
3: In cor(t(r@tpm), r@scores) : the standard deviation is zero
4: In cor(t(r@tpm), r@scores) : the standard deviation is zero
5: In cor(t(r@tpm), r@scores) : the standard deviation is zero
6: In cor(t(r@tpm), r@scores) : the standard deviation is zero
7: In dir.create(paste0(results.dir, "/DIALOGUE2_", main)) :

 Error in r1@X[, rownames(WS)] %*% WS : 
requires numeric/complex matrix/vector arguments

it would be really helpful to know how you run DIALOGUE on this data! thanks again, f

livnatje commented 2 years ago

Thanks for spotting that. The cell type naming issue was fixed, along with additional changes and text error messages to help in the case that the input does not match the expected format. Perhaps you'd like to use the latest code and documentations and re-try this?

From the error it seems that the issue is with the X matrix (the original feature space). Are you providing the first PCs here? It should be cells x PCs in that case, and have the cell ids as the row names.

Thanks, Livnat

bio-la commented 2 years ago

Hi Livnat, In my celltype object, X is the matrix of the first 30 PCs (rownames are cellids and columns PC_1 to PC_30), and it is definitely a “matrix”. From within DLG.find.scoring

WS<-R$cca$ws[[r1@name]]
r1@extra.scores$cca0<-r1@X[,rownames(WS)]%*%WS

I replicate the R object that’s produced in DIALOGUE1 step by creating an alternative stop in your DIALOGUE1 function

R2<-DIALOGUE1.alt(cel_list, main="TESTRUN”)

And with the following

R2<-DIALOGUE1.alt(cel_list, main="TESTRUN")
cel_list[["TA1"]]@X[, rownames(R2$cca$ws[["TA1"]])] %*% R2$cca$ws[["TA1"]] 

doesn’t give me any error. So I’m not sure why I would see the error message while running the full DIALOGUE command

thank you for your help!

livnatje commented 2 years ago

Would you mind sending me the rA object you provide as input? That is, the list of cell.type objects.

Thanks!

livnatje commented 2 years ago

I assume the issue was resolved. So closing this. Thanks!