broadinstitute / infercnv

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

add_to_seurat empty output #374

Open igordot opened 2 years ago

igordot commented 2 years ago

I ran infercnv::add_to_seurat on multiple objects. Based on all the plots, there are clear CNVs. I did not provide a Seurat object, so map_metadata_from_infercnv.txt was generated. The table has the expected number of rows and the correct row names, so it seems to be reading the data. However, all of the values in map_metadata_from_infercnv.txt are 0s. What does this mean?

GeorgescuC commented 2 years ago

Hi @igordot ,

Which version of infercnv are you using? Have you checked that the CNVs are still predicted after filtering by the Bayesian Network? If those results are present, they are used over the "raw" HMM output, so if the Bayesian filtering threshold is too stringent, you may not have any CNVs left. On which figure do you see the CNV signal?

Regards, Christophe.

igordot commented 2 years ago

I am using the latest Bioconductor version 1.8.1 (although it looks like it recently got upgraded to 1.10.1).

Where do I check that "the CNVs are still predicted after filtering by the Bayesian Network"?

I see the CNV signal in all the plots, specifically steps 17 and 20, as well as the final. I am including them here. infercnv 17_HMM_predHMMi3 leiden hmm_mode-subclusters infercnv 20_HMM_predHMMi3 leiden hmm_mode-subclusters Pnorm_0 5 repr_intensities infercnv

GeorgescuC commented 2 years ago

Hi @igordot ,

Sorry for missing your later post. Step 18 is running the Bayesian Network, and step 19 is applying the filter based on the BayesMaxPNormal threshold. So if those 2 steps have run, then results from steps 19 and 20 will be filtered results. Step 20 alone will still be run when only the HMM is run and no filtering is applied.

Regards, Christophe.

igordot commented 2 years ago

Thank you for clarifying. I am not sure if this answers my initial question. All of the values in map_metadata_from_infercnv.txt are 0s. That still does not make sense to me since it does not seem to agree with the plots.

GeorgescuC commented 2 years ago

Hi @igordot ,

Could you privately share the outputs of your run so I can inspect them and try to debug?

Regards, Christophe.

antara-biswas commented 2 years ago

Hi, I am running into same issue-infercnv ran great, got good cnv heatmap but all values in map_metadata_from_infercnv.txt are 0s. Can you please help troubleshoot this. Thanks

igordot commented 2 years ago

Here is the output, including the final inferCNV object: https://www.dropbox.com/s/wj83nj2yqi3c4a8/infercnv.zip?dl=0 This may not be the output from the same exact run, but it's the same sample and I can't see the differences by eye.

Thank you for taking a look.

GeorgescuC commented 2 years ago

Hi @igordot , @antara-biswas

Thank you for sharing your files. I got around to debugging your issue, and it is actually something that has already been fixed for new runs in 01f60de49021e235ca6de59fa1818453804f3b6e , but it appears you run was done before that. A workaround so you don't have to rerun this dataset is to rename the run.final.infercnv_obj to run.final.infercnv_obj.original, then run this small piece of R code from the output folder:

library(infercnv)

infercnv_obj = readRDS("run.final.infercnv_obj.original")

for (i in names(infercnv_obj@tumor_subclusters$subclusters)) {
    for (j in names(infercnv_obj@tumor_subclusters$subclusters[[i]])) {
        names(infercnv_obj@tumor_subclusters$subclusters[[i]][[j]]) = colnames(infercnv_obj@expr.data[, infercnv_obj@tumor_subclusters$subclusters[[i]][[j]], drop=FALSE])
    }
}

saveRDS(infercnv_obj, "run.final.infercnv_obj")

add_to_seurat(infercnv_output_path = "./")

Regards, Christophe.

antara-biswas commented 2 years ago

Thank you so much for the code, it worked!