hemberg-lab / SC3

A tool for the unsupervised clustering of cells from single cell RNA-Seq experiments
http://bioconductor.org/packages/SC3
GNU General Public License v3.0
119 stars 55 forks source link

sc3_plot_de_genes does not work #39

Closed yicheinchang closed 7 years ago

yicheinchang commented 7 years ago

Hi, I would like to run sc3_plot_de_genes but it threw an error

> sc3_result<- sc3(sce, ks = 5:25, biology = TRUE, K_estimator = TRUE)
> sc3_plot_de_genes(sc3_result, k = 7)
Error in seq.int(rx[1L], rx[2L], length.out = nb) :
  'to' must be a finite number
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] SC3_1.4.2

loaded via a namespace (and not attached):
 [1] bitops_1.0-6         matrixStats_0.52.2   bit64_0.9-7
 [4] doParallel_1.0.10    RColorBrewer_1.1-2   tools_3.4.0
 [7] doRNG_1.6.6          R6_2.2.2             KernSmooth_2.23-15
[10] vipor_0.4.5          DBI_0.7              lazyeval_0.2.0
[13] BiocGenerics_0.22.0  colorspace_1.3-2     gridExtra_2.2.1
[16] bit_1.1-12           compiler_3.4.0       Biobase_2.36.2
[19] pkgmaker_0.22        caTools_1.17.1       scales_0.4.1
[22] DEoptimR_1.0-8       mvtnorm_1.0-6        robustbase_0.92-7
[25] stringr_1.2.0        digest_0.6.12        rrcov_1.4-3
[28] scater_1.4.0         pkgconfig_2.0.1      htmltools_0.3.6
[31] WriteXLS_4.0.0       limma_3.32.2         rlang_0.1.1
[34] RSQLite_2.0          shiny_1.0.3          bindr_0.1
[37] gtools_3.5.0         dplyr_0.7.1          RCurl_1.95-4.8
[40] magrittr_1.5         Matrix_1.2-10        Rcpp_0.12.11
[43] ggbeeswarm_0.5.3     munsell_0.4.3        S4Vectors_0.14.3
[46] viridis_0.4.0        stringi_1.1.5        edgeR_3.18.1
[49] zlibbioc_1.22.0      rhdf5_2.20.0         gplots_3.0.1
[52] plyr_1.8.4           grid_3.4.0           blob_1.1.0
[55] parallel_3.4.0       gdata_2.18.0         shinydashboard_0.6.1
[58] lattice_0.20-35      locfit_1.5-9.1       rjson_0.2.15
[61] rngtools_1.2.4       reshape2_1.4.2       codetools_0.2-15
[64] biomaRt_2.32.1       stats4_3.4.0         XML_3.98-1.9
[67] glue_1.1.1           data.table_1.10.4    httpuv_1.3.3
[70] foreach_1.4.3        gtable_0.2.0         assertthat_0.2.0
[73] ggplot2_2.2.1        mime_0.5             xtable_1.8-2
[76] e1071_1.6-8          class_7.3-14         pcaPP_1.9-72
[79] viridisLite_0.2.0    tibble_1.3.3         pheatmap_1.0.8
[82] iterators_1.0.8      AnnotationDbi_1.38.1 registry_0.3
[85] beeswarm_0.2.3       memoise_1.1.0        IRanges_2.10.2
[88] tximport_1.4.0       bindrcpp_0.2         cluster_2.0.6
[91] ROCR_1.0-7

Other plot functions (sc3_plot_markers, sc3_plot_expression etc.) seem to work. Could you please give me some advice?

Thanks in advance,

wikiselev commented 7 years ago

Hi, you should provide the same sce scater object to sc3_plot_de_genes as in the first line of your code. Instead you have sc3_result which is something different. Does this solve your problem?

yicheinchang commented 7 years ago

Ouch!! My Bad!! The code snippet I provided here is incorrect. In my actual run, I named the sc3 output sc3_result and pass it to sc3_plot_de_genes.

wikiselev commented 7 years ago

Then I need to look at your sc3_result. Could you share it with me?

ai4pharma commented 7 years ago

Same problem here. After check the function. It seems something related genes with p-value equal to zero. In following code, there will be "Inf" in row_ann object, which may introduce trouble for pheatmap function. Then I add de_genes[de_genes<(1e-17)] <- (1e-17) before the following code, it works for me. row_ann <- data.frame(log10_padj = -log10(de_genes)) rownames(row_ann) <- names(de_genes) do.call(pheatmap::pheatmap, c(list(dataset[names(de_genes), , drop = FALSE], show_colnames = FALSE, cluster_rows = FALSE, cluster_cols = hc, cutree_cols = k, annotation_row = row_ann, cellheight = 10), list(annotation_col = ann)[add_ann_col]))

}

wikiselev commented 7 years ago

Great, many thanks for finding this out, guys. Could you please share a sample data with me so that I can reproduce? Can you send it to vk6@sanger.ac.uk?

wikiselev commented 7 years ago

Thanks a lot @huang-ying! I managed to reproduce the bug and fix it using your suggestion de_genes[de_genes < 1e-17] <- 1e-17 it is available on Github now, so you can reinstall SC3 from there. Thanks a lot for finding this out and for your help! I will close it now but fell free to reopen if something else comes up. Cheers, Vlad