broadinstitute / infercnv

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

Step 18 error #559

Open lindsdudley opened 1 year ago

lindsdudley commented 1 year ago

Hi infercnv team,

Thank you so much for developing this program! I am getting an error at step 18 with this message:

Error in (function (cl, name, valueClass) : assignment of an object of class “logical” is not valid for @‘cnv_regions’ in an object of class “MCMC_inferCNV”; is(value, "factor") is not TRUE

I have gone through all of the issues on the github and none of them helped fix this. CNVs were predicted so it is not that and there were no dot operators as the reference was NULL. I have attached my code below. I am running this sample by sample and unfortunately it is still taking several days and then stopped on step 18.

options(scipen = 100)
infercnv_obj = CreateInfercnvObject(raw_counts_matrix=paste0(in_dir,"/rawCounts.txt"),
                                    annotations_file=input_annot,
                                    gene_order_file=paste0(in_dir,"/gene_order_file.txt"),
                                    ref_group_names=NULL,
                                    chr_exclude = c("chrX","chrY", "chrMT"))

run infercnv

if(run) { dir.create(out_dir) num_threads = 16 options(bitmapType = 'cairo') infercnv_obj1 = infercnv::run(infercnv_obj, cutoff=0.1, out_dir=out_dir, cluster_by_groups=F, analysis_mode="samples", tumor_subcluster_partition_method = "leiden", plot_steps=T,plot_probabilities=T,no_prelim_plot=F, no_plot=F, denoise=T, noise_filter=0.12, HMM=T,HMM_type='i6', num_threads=16

I am running infercnv 1.16. Thank you so much in advance for your help!

GeorgescuC commented 1 year ago

Hi @lindsdudley ,

I am not sure of what is happening in this case. Could you post the full log of the run? And would you be able to privately share the object so that I can debug the issue if the log does not point to the cause of the issue?

Regards, Christophe.

lindsdudley commented 1 year ago

Hi @GeorgescuC ,

Thank you so much for your swift reply. If you reply with your email I can send you my object. Here is my full log:

R version 4.3.0 (2023-04-21) -- "Already Tomorrow" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin20 (64-bit)

INFO [2023-06-15 11:26:47] Parsing matrix: infercnv/rawCounts.txt INFO [2023-06-15 11:29:32] Parsing gene order file: infercnv/gene_order_file.txt INFO [2023-06-15 11:29:32] ::order_reduce:Start. INFO [2023-06-15 11:29:34] .order_reduce(): expr and order match. INFO [2023-06-15 11:29:37] ::process_data:order_reduce:Reduction from positional data, new dimensions (r,c) = 23467,21587 Total=170801039 Min=0 Max=3438. INFO [2023-06-15 11:29:38] num genes removed taking into account provided gene ordering list: 1027 = 4.37635829036519% removed. INFO [2023-06-15 11:29:39] -filtering out cells < 100 or > Inf, removing 0 % of cells INFO [2023-06-15 11:29:50] validating infercnv_obj INFO [2023-06-15 11:29:50] ::process_data:Start INFO [2023-06-15 11:29:50] Checking for saved results. INFO [2023-06-15 11:29:50] Trying to reload from step 17 INFO [2023-06-15 11:29:54] Using backup HMM from step 17 INFO [2023-06-15 11:29:54] Trying to reload from step 15 INFO [2023-06-15 11:30:02] Using backup from step 15 INFO [2023-06-15 11:30:02]

STEP 1: incoming data

INFO [2023-06-15 11:30:02]

STEP 02: Removing lowly expressed genes

INFO [2023-06-15 11:30:02]

STEP 03: normalization by sequencing depth

INFO [2023-06-15 11:30:02]

STEP 04: log transformation of data

INFO [2023-06-15 11:30:02]

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

INFO [2023-06-15 11:30:02]

STEP 09: apply max centered expression threshold: 3

INFO [2023-06-15 11:30:02]

STEP 10: Smoothing data per cell by chromosome

INFO [2023-06-15 11:30:02]

STEP 11: re-centering data across chromosome after smoothing

INFO [2023-06-15 11:30:02]

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

INFO [2023-06-15 11:30:02]

STEP 14: invert log2(FC) to FC

INFO [2023-06-15 11:30:02]

STEP 15: Clustering samples (not defining tumor subclusters)

INFO [2023-06-15 11:30:09]

STEP 18: Run Bayesian Network Model on HMM predicted CNVs

INFO [2023-06-15 11:30:09] Initializing new MCM InferCNV Object. INFO [2023-06-15 11:30:09] validating infercnv_obj Error in (function (cl, name, valueClass) : assignment of an object of class “logical” is not valid for @‘cnv_regions’ in an object of class “MCMC_inferCNV”; is(value, "factor") is not TRUE In addition: Warning messages: 1: In is.na(seu) : is.na() applied to non-(list or vector) of type 'S4' 2: In order(as.numeric(substr(geneDat1$chromosome_name, 4, 5))) : NAs introduced by coercion 3: In dir.create(in_dir) : 'infercnv' already exists 4: In asMethod(object) : sparse->dense coercion: allocating vector of size 3.8 GiB 5: In dir.create(out_dir) : 'infercnv_output' already exists Called from: (function (cl, name, valueClass) { ClassDef <- getClass(cl) slotClass <- ClassDef@slots[[name]] if (is.null(slotClass)) stop(gettextf("%s is not a slot in class %s", sQuote(name), dQuote(cl)), domain = NA) if (.identC(slotClass, valueClass)) return(TRUE) ok <- possibleExtends(valueClass, slotClass, ClassDef2 = getClassDef(slotClass, where = .classEnv(ClassDef))) if (isFALSE(ok)) stop(gettextf("assignment of an object of class %s is not valid for @%s in an object of class %s; is(value, \"%s\") is not TRUE", dQuote(valueClass), sQuote(name), dQuote(cl), slotClass), domain = NA) TRUE })("MCMC_inferCNV", "cnv_regions", "logical")

GeorgescuC commented 1 year ago

Hi @lindsdudley ,

Nothing is jumping out as the source of the issue in the log (although it is skipping most steps because it reloads the latest step results) so sharing the object would be great. You can find my email in the description file at line 6.

One question about the troubleshooting attempts you made. Did you create the infercnv object you are using in this run on a different version of infercnv?

Regards, Christophe.

lindsdudley commented 1 year ago

Hi @GeorgescuC ,

I used the same version of infercnv to create the object as I did to run it. I just sent you my input files and code. Thank you so much for being willing to take a look.

Best, Lindsey

Joya-zy commented 1 year ago

Hi~ Have your question been solved? I met the same problem and I couldn't find the solution...