broadinstitute / infercnv

Inferring CNV from Single-Cell RNA-Seq
Other
557 stars 164 forks source link

Error in plot_cnv() Step - Error in seq.default(x.range[1], x.range[2], length.out = nb_breaks) : 'from' must be a finite number #562

Open vfincke opened 1 year ago

vfincke commented 1 year ago

Hello,

First of all thank you for putting together such a helpful package!

I encounter the following error in the plot_cnv() Step:

Error in seq.default(x.range[1], x.range[2], length.out = nb_breaks) : 'from' must be a finite number

Can you help me with solving this error? Thank you in advance!

Kind regards, Victoria

Please find my logs below, as well as the Session Info:

infercnv_object <- infercnv::run(infercnvobj,

  • cutoff=0.1,
  • out_dir="/Users/victoria/Desktop/SingleCellAnalysis/Multiome",
  • cluster_by_groups=TRUE,
  • denoise=TRUE,
  • HMM=FALSE,
  • num_threads=2,
  • analysis_mode="samples",
  • no_plot=FALSE) INFO [2023-06-16 10:27:04] ::process_data:Start INFO [2023-06-16 10:27:04] Checking for saved results. INFO [2023-06-16 10:27:04]
STEP 1: incoming data

INFO [2023-06-16 10:28:00]

STEP 02: Removing lowly expressed genes

INFO [2023-06-16 10:28:00] ::above_min_mean_expr_cutoff:Start INFO [2023-06-16 10:28:00] Removing 23384 genes from matrix as below mean expr threshold: 0.1 INFO [2023-06-16 10:28:01] validating infercnv_obj INFO [2023-06-16 10:28:01] There are 9096 genes and 25542 cells remaining in the expr matrix. INFO [2023-06-16 10:28:13] no genes removed due to min cells/gene filter INFO [2023-06-16 10:29:09]

STEP 03: normalization by sequencing depth

INFO [2023-06-16 10:29:09] normalizing counts matrix by depth INFO [2023-06-16 10:29:25] Computed total sum normalization factor as median libsize: 3291.500000 INFO [2023-06-16 10:30:25]

STEP 04: log transformation of data

INFO [2023-06-16 10:30:25] transforming log2xplus1() INFO [2023-06-16 10:31:34]

STEP 08: removing average of reference data (before smoothing)

INFO [2023-06-16 10:31:34] ::subtract_ref_expr_from_obs:Start inv_log=FALSE, use_bounds=TRUE INFO [2023-06-16 10:31:34] subtracting mean(normal) per gene per cell across all data INFO [2023-06-16 10:31:51] -subtracting expr per gene, use_bounds=TRUE INFO [2023-06-16 13:25:19]

STEP 09: apply max centered expression threshold: 3

INFO [2023-06-16 13:25:19] ::process_data:setting max centered expr, threshold set to: +/-: 3 INFO [2023-06-16 13:26:05]

STEP 10: Smoothing data per cell by chromosome

INFO [2023-06-16 13:26:05] smooth_by_chromosome: chr: chr1 INFO [2023-06-16 13:26:26] smooth_by_chromosome: chr: chr2 INFO [2023-06-16 13:26:45] smooth_by_chromosome: chr: chr3 INFO [2023-06-16 13:27:02] smooth_by_chromosome: chr: chr4 INFO [2023-06-16 13:27:18] smooth_by_chromosome: chr: chr5 INFO [2023-06-16 13:27:34] smooth_by_chromosome: chr: chr6 INFO [2023-06-16 13:27:53] smooth_by_chromosome: chr: chr7 INFO [2023-06-16 13:28:16] smooth_by_chromosome: chr: chr8 INFO [2023-06-16 13:28:33] smooth_by_chromosome: chr: chr9 INFO [2023-06-16 13:28:51] smooth_by_chromosome: chr: chr10 INFO [2023-06-16 13:29:09] smooth_by_chromosome: chr: chr11 INFO [2023-06-16 13:29:28] smooth_by_chromosome: chr: chr12 INFO [2023-06-16 13:29:49] smooth_by_chromosome: chr: chr13 INFO [2023-06-16 13:30:13] smooth_by_chromosome: chr: chr14 INFO [2023-06-16 13:30:33] smooth_by_chromosome: chr: chr15 INFO [2023-06-16 13:30:50] smooth_by_chromosome: chr: chr16 INFO [2023-06-16 13:31:09] smooth_by_chromosome: chr: chr17 INFO [2023-06-16 13:31:27] smooth_by_chromosome: chr: chr18 INFO [2023-06-16 13:31:44] smooth_by_chromosome: chr: chr19 INFO [2023-06-16 13:32:06] smooth_by_chromosome: chr: chr20 INFO [2023-06-16 13:32:23] smooth_by_chromosome: chr: chr21 INFO [2023-06-16 13:32:35] smooth_by_chromosome: chr: chr22 INFO [2023-06-16 13:33:35]

STEP 11: re-centering data across chromosome after smoothing

INFO [2023-06-16 13:33:35] ::center_smooth across chromosomes per cell INFO [2023-06-16 13:34:50]

STEP 12: removing average of reference data (after smoothing)

INFO [2023-06-16 13:34:50] ::subtract_ref_expr_from_obs:Start inv_log=FALSE, use_bounds=TRUE INFO [2023-06-16 13:34:50] subtracting mean(normal) per gene per cell across all data INFO [2023-06-16 13:35:03] -subtracting expr per gene, use_bounds=TRUE INFO [2023-06-16 13:36:03]

STEP 14: invert log2(FC) to FC

INFO [2023-06-16 13:36:03] invert_log2(), computing 2^x INFO [2023-06-16 13:36:49]

STEP 15: Clustering samples (not defining tumor subclusters)

INFO [2023-06-16 13:36:49] define_signif_tumor_subclusters(p_val=0.1 INFO [2023-06-16 13:36:50] define_signif_tumor_subclusters(), tumor: 1 INFO [2023-06-16 13:36:50] cut tree into: 1 groups INFO [2023-06-16 13:36:50] -processing 1,1_s1 INFO [2023-06-16 13:36:50] define_signif_tumor_subclusters(), tumor: 0 INFO [2023-06-16 13:36:51] cut tree into: 1 groups INFO [2023-06-16 13:36:51] -processing 0,0_s1 INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: 2 INFO [2023-06-16 13:36:51] cut tree into: 1 groups INFO [2023-06-16 13:36:51] -processing 2,2_s1 INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: 5 INFO [2023-06-16 13:36:51] cut tree into: 1 groups INFO [2023-06-16 13:36:51] -processing 5,5_s1 INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: 4 INFO [2023-06-16 13:36:51] cut tree into: 1 groups INFO [2023-06-16 13:36:51] -processing 4,4_s1 INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: 10 INFO [2023-06-16 13:36:51] cut tree into: 1 groups INFO [2023-06-16 13:36:51] -processing 10,10_s1 INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: INFO [2023-06-16 13:36:51] define_signif_tumor_subclusters(), tumor: INFO [2023-06-16 13:38:15] ::plot_cnv:Start INFO [2023-06-16 13:38:15] ::plot_cnv:Current data dimensions (r,c)=9096,25542 Total=232330032 Min=1 Max=1. INFO [2023-06-16 13:38:18] ::plot_cnv:Depending on the size of the matrix this may take a moment. INFO [2023-06-16 13:38:19] plot_cnv(): auto thresholding at: (NA , NA) Error in seq.default(x.range[1], x.range[2], length.out = nb_breaks) : 'from' must be a finite number

infercnvobj An object of class "infercnv" Slot "expr.data": 32480 x 25542 sparse Matrix of class "dgCMatrix"

sessionInfo() R version 4.3.0 (2023-04-21) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Monterey 12.2.1

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Berlin tzcode source: internal

attached base packages: [1] stats4 stats graphics grDevices utils datasets methods base

other attached packages: [1] infercnv_1.17.0 clusterProfiler_4.9.0 biomaRt_2.57.1 ReactomePA_1.45.0 org.Hs.eg.db_3.17.0 AnnotationDbi_1.63.1 IRanges_2.35.1
[8] S4Vectors_0.39.1 enrichR_3.2 pheatmap_1.0.12 Rtsne_0.16 lubridate_1.9.2 forcats_1.0.0 stringr_1.5.0
[15] dplyr_1.1.2 purrr_1.0.1 readr_2.1.4 tidyr_1.3.0 tibble_3.2.1 ggplot2_3.4.2 tidyverse_2.0.0
[22] readxl_1.4.2 SeuratObject_4.1.3 sp_1.6-1 Biobase_2.61.0 BiocGenerics_0.47.0

loaded via a namespace (and not attached): [1] coin_1.4-2 progress_1.2.2 goftest_1.2-3 wordcloud2_0.2.1 Biostrings_2.69.1
[6] TH.data_1.1-2 vctrs_0.6.2 spatstat.random_3.1-5 digest_0.6.31 png_0.1-8
[11] registry_0.5-1 ggrepel_0.9.3 deldir_1.0-9 parallelly_1.36.0 MASS_7.3-60
[16] reshape2_1.4.4 httpuv_1.6.11 foreach_1.5.2 qvalue_2.33.0 withr_2.5.0
[21] ggfun_0.0.9 ggpubr_0.6.0 ellipsis_0.3.2 survival_3.5-5 memoise_2.0.1
[26] gson_0.1.0 gtools_3.9.4 tidytree_0.4.2 zoo_1.8-12 pbapply_1.7-0
[31] argparse_2.2.2 prettyunits_1.1.1 KEGGREST_1.41.0 promises_1.2.0.1 httr_1.4.6
[36] downloader_0.4 rstatix_0.7.2 globals_0.16.2 fitdistrplus_1.1-11 rstudioapi_0.14
[41] miniUI_0.1.1.1 generics_0.1.3 DOSE_3.27.1 reactome.db_1.84.0 curl_5.0.1
[46] zlibbioc_1.47.0 ggraph_2.1.0 polyclip_1.10-4 GenomeInfoDbData_1.2.10 SparseArray_1.1.9
[51] xtable_1.8-4 doParallel_1.0.17 S4Arrays_1.1.4 BiocFileCache_2.9.0 hms_1.1.3
[56] GenomicRanges_1.53.1 irlba_2.3.5.1 colorspace_2.1-0 filelock_1.0.2 NLP_0.2-1
[61] ROCR_1.0-11 reticulate_1.30 spatstat.data_3.0-1 magrittr_2.0.3 lmtest_0.9-40
[66] later_1.3.1 viridis_0.6.3 modeltools_0.2-23 ggtree_3.9.0 lattice_0.21-8
[71] spatstat.geom_3.2-1 NMF_0.26 future.apply_1.11.0 scattermore_1.2 XML_3.99-0.14
[76] shadowtext_0.1.2 cowplot_1.1.1 matrixStats_1.0.0 RcppAnnoy_0.0.20 pillar_1.9.0
[81] nlme_3.1-162 iterators_1.0.14 gridBase_0.4-7 caTools_1.18.2 compiler_4.3.0
[86] stringi_1.7.12 tensor_1.5 SummarizedExperiment_1.31.1 plyr_1.8.8 crayon_1.5.2
[91] abind_1.4-5 gridGraphics_0.5-1 locfit_1.5-9.8 rjags_4-14 graphlayouts_1.0.0
[96] bit_4.0.5 sandwich_3.0-2 libcoin_1.0-9 fastmatch_1.1-3 fastcluster_1.2.3
[101] codetools_0.2-19 multcomp_1.4-23 slam_0.1-50 plotly_4.10.2 tm_0.7-11
[106] mime_0.12 splines_4.3.0 Rcpp_1.0.10 dbplyr_2.3.2 HDO.db_0.99.1
[111] cellranger_1.1.0 blob_1.2.4 utf8_1.2.3 WriteXLS_6.4.0 listenv_0.9.0
[116] ggsignif_0.6.4 ggplotify_0.1.0 Matrix_1.5-4.1 tzdb_0.4.0 phyclust_0.1-33
[121] tweenr_2.0.2 pkgconfig_2.0.3 tools_4.3.0 cachem_1.0.8 RSQLite_2.3.1
[126] viridisLite_0.4.2 DBI_1.1.3 graphite_1.47.0 fastmap_1.1.1 scales_1.2.1
[131] grid_4.3.0 ica_1.0-3 Seurat_4.3.0 broom_1.0.5 patchwork_1.1.2
[136] coda_0.19-4 BiocManager_1.30.21 graph_1.79.0 carData_3.0-5 RANN_2.6.1
[141] farver_2.1.1 tidygraph_1.2.3 scatterpie_0.2.1 MatrixGenerics_1.13.0 cli_3.6.1
[146] leiden_0.4.3 lifecycle_1.0.3 uwot_0.1.14 mvtnorm_1.2-2 lambda.r_1.2.4
[151] backports_1.4.1 BiocParallel_1.35.2 timechange_0.2.0 gtable_0.3.3 rjson_0.2.21
[156] ggridges_0.5.4 progressr_0.13.0 parallel_4.3.0 ape_5.7-1 limma_3.57.2
[161] jsonlite_1.8.5 edgeR_3.43.3 bitops_1.0-7 bit64_4.0.5 yulab.utils_0.0.6
[166] spatstat.utils_3.0-3 RcppParallel_5.1.7 futile.options_1.0.1 GOSemSim_2.27.0 lazyeval_0.2.2
[171] shiny_1.7.4 htmltools_0.5.5 enrichplot_1.21.0 GO.db_3.17.0 sctransform_0.3.5
[176] rappdirs_0.3.3 formatR_1.14 glue_1.6.2 XVector_0.41.1 RCurl_1.98-1.12
[181] treeio_1.25.0 futile.logger_1.4.3 gridExtra_2.3 igraph_1.4.3 R6_2.5.1
[186] SingleCellExperiment_1.23.0 gplots_3.1.3 labeling_0.4.2 cluster_2.1.4 rngtools_1.5.2
[191] aplot_0.1.10 GenomeInfoDb_1.37.1 DelayedArray_0.27.4 tidyselect_1.2.0 ggforce_0.4.1
[196] xml2_1.3.4 car_3.1-2 future_1.32.0 munsell_0.5.0 KernSmooth_2.23-21
[201] data.table_1.14.8 htmlwidgets_1.6.2 fgsea_1.27.0 RColorBrewer_1.1-3 rlang_1.1.1
[206] spatstat.sparse_3.0-1 spatstat.explore_3.2-1 remotes_2.4.2 parallelDist_0.2.6 fansi_1.0.4

luor33 commented 1 year ago

The cluster name should not be number. "0" should be "Cluster0". infercnv_obj=CreateInfercnvObject(raw_counts_matrix = counts, annotations_file = anno, delim="\t", gene_order_file = hsp_info, ref_group_names=c("Cluster1"),# it should not be "0",so you have to rename your cluster name manually chr_exclude = c("chrX", "chrY", "chrM")# )