Winnie09 / Lamian

44 stars 10 forks source link

Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed #5

Closed pgugger closed 1 year ago

pgugger commented 2 years ago

Hi, Thanks for developing this program... it's about time we have a good model that considers biological replicates! However, I am getting and this error when I try to run with my own data Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed. Any thoughts on how to resolve?

My normalized counts were generated by Seurat using their SCTransform integration pipeline. Here is a summary of my data and code:

str(mdata) List of 3 $ pca : num [1:2706, 1:100] 13.3 14.5 15 6.5 17.1 ... ..- attr(, "dimnames")=List of 2 .. ..$ : chr [1:2706] "AAACCCAAGAAGCGCT-1_1" "AAACCCACAGCTACTA-1_1" "AAACCCAGTCAGCGTC-1_1" "AAACCCATCACCTTGC-1_1" ... .. ..$ : chr [1:100] "PC_1" "PC_2" "PC_3" "PC_4" ... $ expression: num [1:14973, 1:2706] 4.55 5.01 5.07 5.04 4.81 ... ..- attr(, "dimnames")=List of 2 .. ..$ : chr [1:14973] "Xkr4" "Gm19938" "Rp1" "Sox17" ... .. ..$ : chr [1:2706] "AAACCCAAGAAGCGCT-1_1" "AAACCCACAGCTACTA-1_1" "AAACCCAGTCAGCGTC-1_1" "AAACCCATCACCTTGC-1_1" ... $ cellanno :'data.frame': 2706 obs. of 3 variables: ..$ cell : chr [1:2706] "AAACCCAAGAAGCGCT-1_1" "AAACCCACAGCTACTA-1_1" "AAACCCAGTCAGCGTC-1_1" "AAACCCATCACCTTGC-1_1" ... ..$ sample : chr [1:2706] "M4" "M5" "M6" "M4" ... ..$ celltype: chr [1:2706] "Macrophage_0" "Macrophage_0" "Immune_mixed" "Macrophage_heme" ...

result <- infer_tree_structure(pca = mdata[['pca']], expression = mdata[['expression']], cellanno = mdata[['cellanno']], origin.marker = NA, origin.celltype = NA, number.cluster = NA, plotdir = ".", xlab = "PC1", ylab = "PC2", max.clunum = 50)

Winnie09 commented 1 year ago

Hi! I appreciate your interest in this package! I'm sorry for not getting back to you sooner. The pseudotime tree inference by TSCAN requires information about starting point. In the codes you shared, origin.marker = NA, origin.celltype = NA, so the program does not know where to start the pseudotime. You can set up the marker genes of the origin cell type. For example, origin.marker or = c('CD34') if the marker gene can be CD34.