broadinstitute / infercnv

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

How to access CNV matrix used for heatmap? #535

Open Yijia-Jiang opened 1 year ago

Yijia-Jiang commented 1 year ago

Hi,

I want to generate a new heatmap using the CNV values from inferCNV output, but change the clustering of observation cells. Where is the final CNV matrix stored in the infercnv object? I am trying to locate observations.txt file but there is no such file in the latest infercnv version (1.17). Can you help with this issue?

GeorgescuC commented 1 year ago

Hi @aj088 ,

The infercnv_obj@expr.data slot contains the matrix you are looking for directly in R. However depending on if you are looking for the residual expression or the HMM predictions, you will need to use a different version of the infercnv_obj. If looking for the residual expression: the object returned at the end of run() or that you can reload with readRDS("run.final.infercnv_obj") will contain the matrix. If you are looking for the HMM results, you will need to reload the backup from step 17 or 19 with readRDS(), depending on if looking for the base HMM predictions or the Bayesian filtered version, then the matrix will be in the same slot.

If you want to use the observations.txt file, you will need to rerun infercnv's plotting with the option write_expr_matrix=TRUE. You can use either of the backup objects listed above as input.

Regards, Christophe.

wjyzidane commented 8 months ago

@Yijia-Jiang , did you find out which matrix is for the heatmap?