broadinstitute / infercnv

Inferring CNV from Single-Cell RNA-Seq
Other
555 stars 163 forks source link

Differentiate tumor versus normal cells using overall CNA level #492

Open StefTesta opened 1 year ago

StefTesta commented 1 year ago

Hi,

Thank you for this great tool! I'm relatively new to the field of bioinformatics and have a question that is probably quite easy to answer but could not find any solution to my problem on the issues already reported here.

I have several tumor samples and I'm running inferCNV separately on each sample to differentiate tumor vs normal using the CNA level of each cells. I'm using endothelial cells, macrophages and CAF as references. I defined these groups based on default clustering and annotation methods in seurat.

Now I am trying to obtain something similar to what has been done in this paper:

Screen Shot 2022-12-21 at 1 29 03 PM

Methods:

Screen Shot 2022-12-21 at 1 33 26 PM

Basically, I would like to calculate the overall CNA level for each cell across all the genomic windows, run an analysis similar to what done in the paper above, and then I would like to add this information to my original seurat object to obtain a t-SNE/UMAP plot like the one posted here.

I'm finding hard to find and extract the needed data from the inferCNV output. Also I'm running the analysis with HMM=T. So should I use "infercnv_obj@expr.data" or "17_HMM_predHMMi6.hmm_mode-samples.infercnv_obj" as the source of the CNA values for each cell?

Thank you, Stefano

GeorgescuC commented 1 year ago

Hi @StefTesta ,

The infercnv_obj that is returned at the end of run() only contains the residual expressions. If you wish to use residual expressions, then infercnv_obj@expr.data is the matrix to use, and you can load it back with infercnv_obj = readRDS("run.final.infercnv_obj").

If you want to use the HMM predictions instead, you can either use the helper method described later in this answer, or calculate scores yourself, in which case you will need to load the results from the objects save as backups after each step:

Other useful fields for selecting rows/columns are: infercnv_obj@gene_order : position of each gene kept in the analysis (chromosome, start position, end position) infercnv_obj@reference_grouped_cell_indices : the indices for the cells defined as references as a list for each annotation infercnv_obj@observation_grouped_cell_indices : the indices for the cells defined as observations as a list for each annotation infercnv_obj@tumor_subclusters :

Helper HMM method: For plotting HMM results on your Seurat t-SNE/UMAP, you can find examples in the documentation, and use that as a starting point if you want to plot the same type of visualizations with scores you calculated yourself. You should only need to add your scores as features in seurat_obj@meta.data to be able to use FeaturePlot and DimPlot.

Regards, Christophe.