broadinstitute / infercnv

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

Error in "STEP 15: computing tumor subclusters via leiden" - using master branch #475

Open jpark27 opened 2 years ago

jpark27 commented 2 years ago

Dear infercnv team,

Hi, all! Thank you so much for great tool :-) I happen to come across unreported error as follows when I run merged scRNA-seq data driven Seurat object.

Can anyone or @GeorgescuC help out what would be possible solution for this? I attached my session info & been updated infercnv from master branch (v1.13.1; 2022-Oct-17)

# Create infercnv object infercnv_obj <- CreateInfercnvObject(raw_counts_matrix = counts_matrix, annotations_file = annot, gene_order_file = gene_order, ref_group_names = 'immune') # Run inferCNV

infercnv_obj <- infercnv::run(infercnv_obj, cutoff = 0.1, out_dir = paste0('/lustre/scratch117/cellgen/team283/jp27/DA_MEL/2_tools/Melanoma_Brain_Metastasis/temp/','inferCNV_subcluster_', cohort), cluster_by_groups = F, denoise = T, HMM = T, analysis_mode = 'subclusters', output_format = 'pdf', num_threads = 20)

image infercnv_sessioninfo.txt

GeorgescuC commented 1 year ago

Hi @jpark27 ,

I am not sure what is happening there beside that it appears some method is not returning a result and it messes up the rest of the process. Would you be able to privately share the backup object from step 14 so that I can try to debug the issue?

If not, a fallback to use the older method of running the Leiden clustering would be to set leiden_method="simple" so that no PCA is ran, which should work better.

Regards, Christophe.

mayan2009 commented 1 year ago

Hi I also met the same error. Did you have any experience on how to fix it?

GeorgescuC commented 1 year ago

Hi @mayan2009 ,

Which version of infercnv are you running?

Can you run options(error = function() traceback(2)) before trying to run infercnv again?

Regards, Christophe.

mayan2009 commented 1 year ago

Hi Christophe

Thank you for your help! It worked then with options(error = function() traceback(2)) !

Many thanks

Regards

Yan

GeorgescuC commented 1 year ago

Hi @mayan2009 ,

That is surprising! The command I shared is only used to display information about where specifically the error happens when one does, it should not affect anything else! If you tried updating infercnv in between and restarted R, that might be what solved the issue.

Regards, Christophe.

mayan2009 commented 1 year ago

Hi Christophe

Thank you for your help. It is also strange for me. I analyzed with infercnv for the same data and it worked well at first until I changed some information about groupinfo, then I met this error. But this Monday with the same code and the same data, it worked again. Also even more strange, I didn't work directly in R, every time I submitted Rscript to a HPC. So I think the problem also cannot be something conflict in R.

Regards

Yan

GeorgescuC commented 1 year ago

Hi @mayan2009 ,

Is the HPC you submit the script to a specific machine, or is it a grid? If it is a grid, there might be some differences between some of the machines, either the dotkits loaded or package versions, or they could be using different paths for where to load libraries from.

Regards, Christophe.

mayan2009 commented 1 year ago

Hi @GeorgescuC

It is a grid. But every time I activate my own conda environment and load package from my own library. I am not sure if I was also working with other jobs in the same environment in R while submitting this job. will this cause any conflict?

Regards

Yan

GeorgescuC commented 1 year ago

Hi @mayan2009 ,

As long as your different jobs are not installing/updating any packages I don't think there should be any issues with running multiple jobs in parallel. If the error occurs again, i would be interested to take a look at what the object looks like if you are able to privately share it for debugging.

Regards, Christophe.

GeorgescuC commented 1 year ago

Hi @mayan2009 ,

Thanks to someone else that had the same issue sharing their data in #514 , I was able to figure out where the issue came from and fix it. I also made a new stable and devel version of infercnv that should be available in BioConductor in the next few days once the builds update.

Since the issue related to singleton subclusters, I would also suggest checking the size of your subclusters. If you install the devel version (or master branch on github) there is a new method plot_subclusters() that you can use to visualize subclusters, allowing you to adjust settings if needed.

Regards, Christophe.

mayan2009 commented 1 year ago

Hi @GeorgescuC

Thank you for your help, I have the error record, maybe I can share it!

Regards

Yan