Closed Ci-TJ closed 2 years ago
Thx for using our tool! Yes, its because the version of ENIGMA, in ENIGMA v1.1, we add new slot "result_CSE_normalized" which regress out the effects of cell type proportions to our inferred CSE, this question is because during our model updating, it would latently increase the correlation between each gene and cell type fractions, so if you look at the tSNE plot produced from unnormalized CSE, it would have a "stick" shape, so we need to regard each cell type fraction as some sort of normalize factors. You could install our latest version of ENIGMA in the home page 'ENIGMA_v1.1.tar.gz' through following command
install.packages("ENIGMA_v1.1.tar.gz",repos=NULL, type="source",INSTALL_opts=c("--no-multiarch"))
P.S. The faster and more robust version of ENIGMA is coming soon! hope you could keep attention to our algorithm and give any response or suggestions, which absolutely valuable for us!
If you use the right version of ENIGMA, the result would like this I have reproduce this result on a fresh new environment.
Thanks for your timely reply. I reproduced the code successfully based on your tips. But I encountered some problems with other examples.
ENIGMA_toy2: Error in svd(exp.scale) : infinite or missing values in 'x'
> egm = ENIGMA_L2_max_norm(egm, epsilon=0.001, alpha=0.8,
+ beta=10000,tao_k=0.01,max.iter=1000,verbose=TRUE)
Thu Dec 23 19:32:10 2021 Optimizing cell type specific expression profile...
Ratio ranges from: 4339857.139837 - 4393217.794531
Ratio ranges from: 87613.581326 - 134382.646024
Ratio ranges from: 3160.343952 - 4920.321935
Ratio ranges from: 131.245230 - 212.021252
Ratio ranges from: 7.718480 - 19.369518
Ratio ranges from: 0.376672 - 3.670378
Ratio ranges from: 0.021630 - 0.871688
Ratio ranges from: 0.001492 - 0.216986
Ratio ranges from: 0.000119 - 0.054825
Ratio ranges from: 0.000010 - 0.013953
Ratio ranges from: 0.000001 - 0.003567
Ratio ranges from: 0.000000 - 0.000914
Total loss: 192259347.222029
part1:6121083.91027797 part2:213368509.306481 part3:1544.34558665663
Perform Normalization...Error in svd(exp.scale) : infinite or missing values in 'x'
>
Couldn't find the dataset, deconv.rds.
deconv <- readRDS("/mnt/data1/weixu/HiDe/deconv.rds")
Error: 'run.Ted' is not an exported object from 'namespace:TED'
> tcga.ted <- TED::run.Ted(ref.dat= H1,
+ X=t(G)*100,
+ cell.type.labels= rownames(H1),
+ tum.key="cellType1",
+ input.type="GEP",
+ n.cores=5,
+ pdf.name="Senescence")
Error: 'run.Ted' is not an exported object from 'namespace:TED'
sessionInfo() R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936
[2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages: [1] parallel stats4 stats graphics grDevices utils datasets [8] methods base
other attached packages:
[1] TED_1.1.1 TCA_1.2.1
[3] cowplot_1.1.1 splatter_1.16.1
[5] pheatmap_1.0.12 ENIGMA_0.1.1
[7] scater_1.20.1 ggplot2_3.3.5
[9] scuttle_1.2.1 SingleCellExperiment_1.14.1
[11] SummarizedExperiment_1.22.0 Biobase_2.52.0
[13] GenomicRanges_1.44.0 GenomeInfoDb_1.28.4
[15] IRanges_2.26.0 S4Vectors_0.30.2
[17] BiocGenerics_0.38.0 MatrixGenerics_1.4.3
[19] matrixStats_0.61.0 magrittr_2.0.1
loaded via a namespace (and not attached):
[1] backports_1.4.1 spam_2.7-0
[3] plyr_1.8.6 sp_1.4-6
[5] splines_4.1.0 BiocParallel_1.26.2
[7] sva_3.40.0 digest_0.6.29
[9] foreach_1.5.1 matrixcalc_1.0-5
[11] viridis_0.6.2 gdata_2.18.0
[13] fansi_0.5.0 checkmate_2.0.0
[15] memoise_2.0.1 RandomFieldsUtils_0.5.6
[17] ScaledMatrix_1.0.0 config_0.3.1
[19] limma_3.48.3 Biostrings_2.60.2
[21] annotate_1.70.0 gmodels_2.18.1
[23] colorspace_2.0-2 blob_1.2.2
[25] dplyr_1.0.7 RcppArmadillo_0.10.7.5.0
[27] tcltk_4.1.0 crayon_1.4.2
[29] RCurl_1.98-1.5 genefilter_1.74.1
[31] survival_3.2-13 zoo_1.8-9
[33] iterators_1.0.13 glue_1.6.0
[35] gtable_0.3.0 nnls_1.4
[37] zlibbioc_1.38.0 XVector_0.32.0
[39] DelayedArray_0.18.0 BiocSingular_1.8.1
[41] maps_3.4.0 scales_1.1.1
[43] futile.options_1.0.1 DBI_1.1.2
[45] edgeR_3.34.1 Rcpp_1.0.7
[47] RandomFields_3.3.13 viridisLite_0.4.0
[49] xtable_1.8-4 bit_4.0.4
[51] rsvd_1.0.5 dotCall64_1.0-1
[53] animation_2.7 httr_1.4.2
[55] RColorBrewer_1.1-2 ellipsis_0.3.2
[57] pkgconfig_2.0.3 XML_3.99-0.8
[59] farver_2.1.0 locfit_1.5-9.4
[61] utf8_1.2.2 tidyselect_1.1.1
[63] labeling_0.4.2 rlang_0.4.12
[65] reshape2_1.4.4 AnnotationDbi_1.54.1
[67] munsell_0.5.0 tools_4.1.0
[69] cachem_1.0.6 generics_0.1.1
[71] RSQLite_2.2.9 splancs_2.01-42
[73] geoR_1.8-1 stringr_1.4.0
[75] fastmap_1.1.0 yaml_2.2.1
[77] bit64_4.0.5 purrr_0.3.4
[79] KEGGREST_1.32.0 pbapply_1.5-0
[81] nlme_3.1-153 sparseMatrixStats_1.4.2
[83] formatR_1.11 pracma_2.3.6
[85] compiler_4.1.0 rstudioapi_0.13
[87] beeswarm_0.4.0 png_0.1-7
[89] tibble_3.1.6 stringi_1.7.6
[91] futile.logger_1.4.3 fields_13.3
[93] lattice_0.20-45 Matrix_1.4-0
[95] nloptr_1.2.2.3 vctrs_0.3.8
[97] pillar_1.6.4 lifecycle_1.0.1
[99] BiocNeighbors_1.10.0 data.table_1.14.2
[101] bitops_1.0-7 irlba_2.3.5
[103] R6_2.5.1 gridExtra_2.3
[105] vipor_0.4.5 codetools_0.2-18
[107] lambda.r_1.2.4 MASS_7.3-54
[109] gtools_3.9.2 withr_2.4.3
[111] GenomeInfoDbData_1.2.6 mgcv_1.8-38
[113] grid_4.1.0 beachmat_2.8.1
[115] tidyr_1.1.4 DelayedMatrixStats_1.14.3
[117] Rtsne_0.15 ggbeeswarm_0.6.0
By the way, I didn't found R package, scatter. Do you mistyped 'scater' as 'scatter'
Best,
Ci
let me go straight to your question,
@WWXkenmo Hi! For now, it just has the problem with norm.to.one . I couldn't find this function.
exp <- t(norm.to.one(tcga.ted$res$first.gibbs.res$Znkg[,1,]))
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'x' in selecting a method for function 't': could not find function "norm.to.one"
Sorry for my late response, norm.to.one is simply the normalize function in TED packages, seem that they have did a lot of changes to their code. Their normalized profile is the "tcga.ted$res$first.gibbs.res$Znkg.norm" I remember, you could directly used their normalized CSE and do the clustering test.
Sorry for late reply. I changed the codes based on the suggestion from TED developers. Outputs are as below:
exp <- t(tcga.ted$res$first.gibbs.res$Znkg[,1,])
ted <- SingleCellExperiment(assays=list(logcounts = exp))
ted$Group <- label.c4
ted <- ted
ted <- runPCA(ted)
p <- plotPCA(ted, colour_by = "Group")
#ted <- runUMAP(ted,dimred="PCA",n_dimred=5)
#p_ted_umap <- plotUMAP(ted, colour_by = "Group",point_size=3)
ted <- runTSNE(ted,dimred="PCA",n_dimred=5)
p_ted_tsne1 <- plotTSNE(ted, colour_by = "Group",point_size=3)
exp <- t(tcga.ted$res$first.gibbs.res$Znkg[,2,])
ted <- SingleCellExperiment(assays=list(logcounts = exp))
ted$Group <- label.c2
ted <- ted
ted <- runPCA(ted)
p <- plotPCA(ted, colour_by = "Group")
#ted <- runUMAP(ted,dimred="PCA",n_dimred=5)
#p_ted_umap <- plotUMAP(ted, colour_by = "Group",point_size=3)
ted <- runTSNE(ted,dimred="PCA",n_dimred=5)
p_ted_tsne2 <- plotTSNE(ted, colour_by = "Group",point_size=3)
exp <- t(tcga.ted$res$first.gibbs.res$Znkg[,3,])
ted <- SingleCellExperiment(assays=list(logcounts = exp))
ted$Group <- label.c3
ted <- ted
ted <- runPCA(ted)
p <- plotPCA(ted, colour_by = "Group")
#ted <- runUMAP(ted,dimred="PCA",n_dimred=5)
#p_ted_umap <- plotUMAP(ted, colour_by = "Group",point_size=3)
ted <- runTSNE(ted,dimred="PCA",n_dimred=5)
p_ted_tsne3 <- plotTSNE(ted, colour_by = "Group",point_size=3)
I found that my output is basically the same as your result. I will continue to test other examples and wait for a more powerful version of ENIGMA. Best, Qin
Hi! Thank you for developing ENIGMA. I tried to reproduce the code of example, but failed. I replaced "result_CSE_normalized" with "result_CSE", but I didn't get the good results as your description. Is the problem with the version of ENIGMA?