broadinstitute / infercnv

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

Error in Step 15 #617

Open juliach2 opened 10 months ago

juliach2 commented 10 months ago

Thank you for the nice tool. I am getting an Error in Step 15 of the analysis, which I don't fully understand. The input Data is a seurat object processed with the standard workflow with 15 clusters. Cluster 15 is the tumor cell cluster. Error in ScaleData(): ! No layer matching pattern 'data' found. Please run NormalizeData and retry

The code I run is: nfercnv_obj = CreateInfercnvObject(raw_counts_matrix=as.matrix(seurat_obj$RNA@counts[,colnames(seurat_obj)]), annotations_file=as.matrix(seurat_obj@active.ident), delim="\t", gene_order_file="hg38_gencode_v27.txt", ref_group_names=c("1", "2","3", "4", "5", "6", "7" ,"8", "9","10","11", "12", "13", "14"))

infercnv_obj = infercnv::run(infercnv_obj,cutoff=0.1,out_dir="output_dir",cluster_by_groups=FALSE,plot_steps=T,scale_data=TRUE,denoise=T,noise_filter=0.12,analysis_mode='subclusters',HMM_type='i6')

Output: .... STEP 15: computing tumor subclusters via leiden

INFO [2023-11-07 18:08:17] define_signif_tumor_subclusters(p_val=0.1 INFO [2023-11-07 18:08:19] define_signif_tumor_subclusters(), tumor: 0 Warning: Data is of class matrix. Coercing to dgCMatrix. Finding variable features for layer counts Calculating gene variances 0% 10 20 30 40 50 60 70 80 90 100% [----|----|----|----|----|----|----|----|----|----| **| Calculating feature variances of standardized and clipped values 0% 10 20 30 40 50 60 70 80 90 100% [----|----|----|----|----|----|----|----|----|----| **| Warning: No layers found matching search pattern provided Error in ScaleData(): ! No layer matching pattern 'data' found. Please run NormalizeData and retry Run rlang::last_trace() to see where the error occurred. Backtrace: ▆

  1. └─infercnv::run(...)
  2. └─infercnv:::define_signif_tumor_subclusters(...)
  3. └─infercnv:::.single_tumor_leiden_subclustering(...)
  4. └─infercnv:::.leiden_seurat_preprocess_routine(...)
  5. ├─Seurat::ScaleData(seurat_obs, features = all.genes)
  6. └─Seurat:::ScaleData.Seurat(seurat_obs, features = all.genes)
  7. ├─Seurat::ScaleData(...)
  8. └─Seurat:::ScaleData.StdAssay(...) Run rlang::last_trace(drop = FALSE) to see 1 hidden frame.

Is there a way to solve this error?

Thank you!

zhangyz1997 commented 10 months ago

It seems that it's not compatible with the latest Seurat V5 #606 . Using the following command to convert the seurat object format to v3 before running seems to work temporarily: options("Seurat.object.assay.version" = "v3")

GeorgescuC commented 10 months ago

Hi,

I have pushed a commit that should fix this issue. It will be included in a new version soon, but in the meantime, updating infercnv using the Github source should work.

Regards, Christophe.

JiahaoWongg commented 10 months ago

@GeorgescuC You really solved my problem timely. By the way, after running again, it can continue to run from step 15. This programming method that incorporates caching mechanism is worth learning from!

JiahaoWongg commented 10 months ago

@GeorgescuC You really solved my problem timely. By the way, after running again, it can continue to run from step 15. This programming method that incorporates caching mechanism is worth learning from!

devtools::install_github("broadinstitute/infercnv")
pumcdr commented 5 months ago

When I update infercnv using the Github, a error of "Invalid DESCRIPTION file" was shown, how to solve?@GeorgescuC , thanks. The code I run is: devtools::install_local('infercnv-master.zip')

Output: These packages have more recent versions available. It is recommended to update all of them. Which would you like to update?

1: All
2: CRAN packages only
3: None
4: withr (2.5.2 -> 3.0.0 ) [CRAN] 5: tidyselect (1.2.0 -> 1.2.1 ) [CRAN] 6: rlang (1.1.2 -> 1.1.3 ) [CRAN] 7: glue (1.6.2 -> 1.7.0 ) [CRAN] 8: cli (3.6.1 -> 3.6.2 ) [CRAN] 9: zlibbioc (1.42.0 -> 1.44.0 ) [CRAN] 10: matrixStats (1.2.0 -> 1.3.0 ) [CRAN] 11: XVector (0.36.0 -> 0.38.0 ) [CRAN] 12: RCurl (1.98-1.8 -> 1.98-1.14 ) [CRAN] 13: DelayedArray (0.22.0 -> 0.24.0 ) [CRAN] 14: IRanges (2.30.0 -> 2.32.0 ) [CRAN] 15: S4Vectors (0.34.0 -> 0.36.2 ) [CRAN] 16: Biobase (2.56.0 -> 2.58.0 ) [CRAN] 17: GenomicRa... (1.48.0 -> 1.50.2 ) [CRAN] 18: Rcpp (1.0.9 -> 1.0.12 ) [CRAN] 19: RcppEigen (0.3.3.9.4 -> 0.3.4.0.0 ) [CRAN] 20: BH (1.81.0-1 -> 1.84.0-0 ) [CRAN] 21: RcppAnnoy (0.0.21 -> 0.0.22 ) [CRAN] 22: FNN (1.1.3.2 -> 1.1.4 ) [CRAN] 23: deldir (2.0-2 -> 2.0-4 ) [CRAN] 24: spatstat.... (3.0-3 -> 3.0-4 ) [CRAN] 25: spatstat.... (3.2-2 -> 3.2-3 ) [CRAN] 26: spatstat.... (3.2-7 -> 3.2-9 ) [CRAN] 27: fs (1.5.2 -> 1.6.3 ) [CRAN] 28: digest (0.6.30 -> 0.6.35 ) [CRAN] 29: sass (0.4.8 -> 0.4.9 ) [CRAN] 30: cachem (1.0.6 -> 1.0.8 ) [CRAN] 31: bslib (0.6.1 -> 0.7.0 ) [CRAN] 32: commonmark (1.9.0 -> 1.9.1 ) [CRAN] 33: promises (1.2.0.1 -> 1.3.0 ) [CRAN] 34: later (1.3.0 -> 1.3.2 ) [CRAN] 35: htmltools (0.5.7 -> 0.5.8.1 ) [CRAN] 36: httpuv (1.6.7 -> 1.6.15 ) [CRAN] 37: stringi (1.7.8 -> 1.8.3 ) [CRAN] 38: munsell (0.5.0 -> 0.5.1 ) [CRAN] 39: gtable (0.3.4 -> 0.3.5 ) [CRAN] 40: parallelly (1.36.0 -> 1.37.1 ) [CRAN] 41: listenv (0.9.0 -> 0.9.1 ) [CRAN] 42: globals (0.16.2 -> 0.16.3 ) [CRAN] 43: RcppArmad... (0.12.6.6.1 -> 0.12.8.2.1) [CRAN] 44: ggplot2 (3.4.4 -> 3.5.0 ) [CRAN] 45: future (1.33.0 -> 1.33.2 ) [CRAN] 46: future.apply (1.11.0 -> 1.11.2 ) [CRAN] 47: gplots (3.1.3 -> 3.1.3.1 ) [CRAN] 48: tinytex (0.49 -> 0.50 ) [CRAN] 49: xfun (0.41 -> 0.43 ) [CRAN] 50: openssl (2.1.1 -> 2.1.2 ) [CRAN] 51: curl (5.2.0 -> 5.2.1 ) [CRAN] 52: rmarkdown (2.25 -> 2.26 ) [CRAN] 53: knitr (1.45 -> 1.46 ) [CRAN] 54: data.table (1.14.10 -> 1.15.4 ) [CRAN] 55: tidyr (1.3.0 -> 1.3.1 ) [CRAN] 56: shiny (1.8.0 -> 1.8.1.1 ) [CRAN] 57: igraph (1.6.0 -> 2.0.3 ) [CRAN] 58: reticulate (1.34.0 -> 1.36.1 ) [CRAN] 59: sp (2.1-2 -> 2.1-3 ) [CRAN] 60: mvtnorm (1.1-3 -> 1.2-4 ) [CRAN] 61: uwot (0.1.16 -> 0.2.2 ) [CRAN] 62: spatstat.... (3.2-5 -> 3.2-7 ) [CRAN] 63: RcppHNSW (0.5.0 -> 0.6.0 ) [CRAN] 64: plotly (4.10.3 -> 4.10.4 ) [CRAN] 65: patchwork (1.1.3 -> 1.2.0 ) [CRAN] 66: ggridges (0.5.5 -> 0.5.6 ) [CRAN] 67: ggrepel (0.9.4 -> 0.9.5 ) [CRAN] 68: cowplot (1.1.2 -> 1.1.3 ) [CRAN] 69: coda (0.19-4 -> 0.19-4.1 ) [CRAN] 70: locfit (1.5-9.6 -> 1.5-9.9 ) [CRAN] 71: limma (3.52.2 -> 3.54.2 ) [CRAN] 72: ape (5.6-2 -> 5.8 ) [CRAN] 73: argparse (2.2.2 -> 2.2.3 ) [CRAN] 74: Seurat (5.0.1 -> 5.0.3 ) [CRAN] 75: edgeR (3.38.4 -> 3.40.2 ) [CRAN] 76: fastcluster (1.2.3 -> 1.2.6 ) [CRAN]

Enter one or more numbers, or an empty line to skip updates:

Unknown encoding

See section 'The DESCRIPTION file' in the 'Writing R Extensions' manual. ERROR: installing package DESCRIPTION failed for package 'infercnv'

stevenmlewis7 commented 4 months ago

Thank you all for your help with this - I'm receiving the same error despite attempting the version change code above and reinstalling inferCNV. Any tips? Thanks!

elisafazz commented 4 months ago

I am also having this same error despite the version change code above and reinstalling inferCNV.

SITRR commented 4 months ago

Still encountering the same error as @stevenmlewis7 and @elisafazz. Any help would be appreciated!

naikai commented 3 months ago

Update to ver 1.20.0 on Bioconductor solves the same issue for me. HTH.

XLulu0519 commented 4 days ago

Change the version above and reinstalling inferCNV. Then, reopen the R session is viable.