broadinstitute / infercnv

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

Issue with Empty Heatmap of Observations in Final Output (infercnv.png) #621

Open jwweii opened 10 months ago

jwweii commented 10 months ago

Hello InferCNV Team,

I've encountered a unique issue with the final output of my InferCNV analysis. The issue is specifically with the infercnv.png file, which displays an empty heatmap over the observation cells. Notably, intermediate heatmaps from steps 17, 19, and 20 appeared normal, without any apparent issues.

I've tried to set denoise = F, but the result is the same. Upon further investigation, I extracted the final infercnv_obj@expr.data and noticed an anomaly. All the average expression values of the tumor samples were exactly 1.00096904675609. This uniformity across the tumor samples seems unusual and might be contributing to the empty heatmap in the final output.

I am trying to determine if this issue stems from my sample data or if it's something that can be addressed technically. Here are the specifics of my analysis setup for your reference:

infercnv version: 1.18.0

infercnv_obj = infercnv::run(infercnv_obj,
                             analysis_mode='subclusters', 
                             cutoff=0.1,  # use 1 for smart-seq, 0.1 for 10x-genomics
                             out_dir=output_dir, # dir is auto-created for storing outputs
                             cluster_by_groups=F,   # cluster
                             leiden_resolution = 0.01,
                             cluster_references=T, 
                             plot_steps=F,
                             denoise=F,
                             HMM=T,
                             mask_nonDE_genes = T,
                             resume_mode=TRUE,
                             num_threads = 20)

The Final infercnv.png (denoise = F):

image

infercnv.20_HMM_predHMMi6.leiden.hmm_mode-subclusters.Pnorm_0.5.repr_intensities.png:

image

infercnv.19_HMM_pred.Bayes_Net.Pnorm_0.5.png:

image

infercnv.17_HMM_predHMMi6.leiden.hmm_mode-subclusters.png:

image

infercnv_obj@expr.data: image

Thanks, Evan

GeorgescuC commented 10 months ago

Hi @jwweii ,

This is indeed a weird issue. In the screenshot of your expr.data matrix there are some cells that have non-center values for the couple genes in that capture, so it's unlikely that it is an issue with the data itself, although I would inspect more specifically the non reference cells since your screenshot might contain only references. You can do that by looking at infercnv_obj@expr.data[, unlist(infercnv_obj@observation_grouped_cell_indices), drop=FALSE].

Plots from step 17, 19 and 20 are HMM figures so the values are set to one of the 6 HMM states, but since there is signal, it is very unlikely that your observation cells all have the center value across all genes/cells, so it most likely still is a plotting-only issue. 2 things you can easily test that could fix the issue (sometimes R heatmaps drawing are just wonky) are:

Besides that, one thing I notice while looking at your results is that there is still signal in your references, and for each cell type in your references, there seem to be at least 2 different expression profiles present, so I would cluster them further into subtypes/cycle or verify how they were annotated. Any signal present in the references should not be considered as true signal if the same is seen in the observations.

Regards, Christophe.

jwweii commented 10 months ago

Hi Cristophe,

Thanks for your prompt response. Finally, I resolved the issue by enabling cluster_by_groups=T. Initially, I had set this parameter to FALSE due to a similar problem mentioned in infercnv issue #233 that occurred if I set both cluster_by_groups=T and leiden_resolution. However, I discovered that I could bypass issue #233 and still enable cluster_by_groups=TRUE by removing leiden_resolution and limiting the process with up_to_step=15 in the first run. Afterwards, I resumed the program with an appropriate leiden_resolution setting. This approach successfully generated the infercnv.png with a normal heatmap for the observation part.

Thanks, Evan