broadinstitute / infercnv

Inferring CNV from Single-Cell RNA-Seq
Other
566 stars 166 forks source link

Error while running plot_cnv #347

Closed Chhiring-Lama closed 2 years ago

Chhiring-Lama commented 3 years ago

Hi, this is my first time using infercnv. I am getting an invalid "times" argument error. Can you help?

INFO [2021-07-26 16:17:26] ::plot_cnv:Start INFO [2021-07-26 16:17:26] ::plot_cnv:Current data dimensions (r,c)=1456,9 Total=13739.4443574449 Min=0.206706365685685 Max=3.65900441090824. INFO [2021-07-26 16:17:26] ::plot_cnv:Depending on the size of the matrix this may take a moment. INFO [2021-07-26 16:17:26] plot_cnv(): auto thresholding at: (-0.082038 , 2.082038) INFO [2021-07-26 16:17:26] plot_cnv_observation:Start INFO [2021-07-26 16:17:26] Observation data size: Cells= 1 Genes= 1456 INFO [2021-07-26 16:17:26] plot_cnv_observation:Writing observation groupings/color. INFO [2021-07-26 16:17:26] plot_cnv_observation:Done writing observation groupings/color. Error in rep("", nrow(obs_data)) : invalid 'times' argument

GeorgescuC commented 3 years ago

Hi @Chhiring-Lama ,

It seems your data has extremely few cells, 9 in total, and 1 of them is in a single group/subcluster. There are also few genes expressed/kept after filtering (1456). This looks like there is an earlier issue with either the data provided to infercnv, or the way it is read. How many cells should you have in your dataset? What sequencing technology was used?

Regards, Christophe.

Chhiring-Lama commented 3 years ago

Hi @GeorgescuC,

Thank you for responding. I managed to get through. My rawcount had cell type groups vs genes and I changed it to each cell vs genes. Thathelped. But, now, the heatmap I generated has aggregated signals. How do I disaggregate it?

-Best, Chhiring

Screen Shot 2021-07-29 at 8 58 10 PM
GeorgescuC commented 3 years ago

Hi @Chhiring-Lama ,

From what I have seen previously, this looks like you either have fairly few genes kept after filtering, or the window size you use is much bigger than usual. Did you change the window size/method from the defaults? What filtering threshold did you use, and with what type of data?

Regards, Christophe.

Chhiring-Lama commented 3 years ago

This is the what my run() command looked like. I did not change anything else. I After running there is 11900 cells and around 900 genes left. So, I am confused as to what was causing the issue. infercnv_obj <- infercnv::run(infercnv_obj, cutoff=0.1, out_dir="output_dir", cluster_by_groups=TRUE, denoise=FALSE, HMM=TRUE) I changed the smooth_methods to coordinates, changed the window_length to 1000000, HMM to i3, it gave more disaggregated points. However, there is an error at step 18

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 checked the raw count matrix and annotation file they have the same number of cells and cell names. It runs smoothly with i6 HMM, but not with i3. What could be the problem here?

GeorgescuC commented 3 years ago

Hi @Chhiring-Lama ,

Which version of infercnv are you using? I think the error you encounter should be fixed in the current version, but it could also be that its still present in the i3 HMM mode as few people use it so a bug may remain unnoticed for longer.

For the number of genes, 900 does seem a bit low, it means an average of about 40 genes per chromosome only, which is indeed much smaller than a 100 genes window size. Your changes to use the coordinates method for smoothing may work, but you also risk not smoothing almost anything as the gene density is very low on the chromosomes. You can try running the default smoothing method but with a smaller window size, somewhere between 50 to 25 genes may work. I also guess you are running this with single nuclei data, so you can try reducing the filtering threshold based on the average gene expression quantiles in your data. The best solution is probably lowering both the filtering threshold and window size a bit each.

Regards, Christophe.