broadinstitute / infercnv

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

denoised and HMM-subcluster-mode have the difference number of clusters in plots, But ... #365

Closed Chuang1118 closed 2 years ago

Chuang1118 commented 3 years ago

Dear Author,

First, thank you for this great tool.

packageVersion("infercnv")

[1] ‘1.9.1’

Just see the plots I have 8 clusters in denoised and 7 clusters in HMM-subcluster-mode, but if I research in object (20_HMM_pred.repr_intensitiesHMMi6.rand_trees.hmm_mode-subclusters.Pnorm_0.4.infercnv_obj), I have 8 clusters.

sapply(Final_infercnv_hmm_object_list[[1]]@tumor_subclusters$subclusters$all_observations, length)

all_observations.1.1.1.1 all_observations.1.1.1.2 all_observations.1.1.2.1 all_observations.1.1.2.2 all_observations.1.2.1.1 all_observations.1.2.1.2 all_observations.1.2.2.1 all_observations.1.2.2.2 419 233 1141 443 229 86 95 15

Please advise. Thanks! Chuang

infercnv infercnv 20_HMM_predHMMi6 rand_trees hmm_mode-subclusters Pnorm_0 4 repr_intensities

GeorgescuC commented 3 years ago

Hi @Chuang1118 ,

If you look closely at the bottom of the HMM plot, you can actually see the 8th cluster in yellow (probably the one with 15 cells). Another give away is that there is that additional black bar that splits groups at the bottom that you don't see in the denoised output. The reason why its hard to see is that there are no predicted CNVs in it, so the white blends in with the surroundings.

Regards, Christophe.

Chuang1118 commented 3 years ago

Hello Author, Thanks your reply. Firstly, I don't agree with you. Obviously, "8th cluster in yellow isn't with 15 cells. I can find 15 cells in first line both in denoised and HMM. I want to synchronize denoised and HMM clustering, then use HMM dendrogram output. Now, I observed denoised and HMM have both 8 clustering in object(final or hmm)@tumor_subclusters$subclusters$all_observations, but 2 output doesn't have the cells with same order. graphically, HMM dendrogram can't find 8 clustering. For the moment, I change the annotation clustering, does it make sense to you ? see below. Maybe I will regroup more clustering together. i.e. all white background into 1 cluster, of course, I will check by cutree function.

image

to

image

GeorgescuC commented 3 years ago

Hi @Chuang1118 ,

The heatmaps are plotted from bottom to top, which is why the top of the matrix is displayed at the bottom. This is due to how the image method in R operates: Notice that image interprets the z matrix as a table of f(x[i], y[j]) values, so that the x axis corresponds to row number and the y axis to column number, with column 1 at the bottom, i.e.a 90 degree counter-clockwise rotation of the conventional printed layout of a matrix. For the operations done on the clustering I am not sure I understand how you changed the clustering. One thing you can try to see if you can find all groups on the figure is to use the "dynamic_resize" option to make the observation plots taller and less condensed. You can also try to see if using the Leiden subclustering yields better results for you on a separate run (it is much faster than the random trees method, especially if you update to version 1.11.1 that also uses parallelDist to speed things up).

Regards, Christophe.