broadinstitute / infercnv

Inferring CNV from Single-Cell RNA-Seq
Other
557 stars 164 forks source link

step 20 Error in file(file, ifelse(append, "a", "w")) : cannot open the connection #431

Closed andynkili closed 2 years ago

andynkili commented 2 years ago

Dear team,

I am running inferCNV 1.13.0 and that error occur at step 20. I use the command:

infercnv_obj<-suppressWarnings(infercnv::run(infercnv_obj,
                                              cutoff=0.1,  # use 1 for smart-seq, 0.1 for 10x-genomics
                                              out_dir="oligo_anissa_noMHC_unkownMyelo_CLST_refMyeloBut33_wi201_scaled",
                                              num_threads = 6,window_length = 201, #increase the windows to call large CNV events (reducing the noise)
                                              HMM_type = 'i6',BayesMaxPNormal = 0.5,
                                              plot_steps = F, plot_probabilities = F, save_rds = F, save_final_rds = T,no_prelim_plot = T,
                                              cluster_by_groups=T,   # cluster
                                              denoise=T,
                                              analysis_mode = "subclusters",scale_data = T,
                                              HMM=T))

This is the error:

STEP 20: Converting HMM-based CNV states to repr expr vals

INFO [2022-06-22 23:55:03] ::plot_cnv:Start
INFO [2022-06-22 23:55:03] ::plot_cnv:Current data dimensions (r,c)=2575,22442 Total=58065911.5 Min=0 Max=3.
INFO [2022-06-22 23:55:04] ::plot_cnv:Depending on the size of the matrix this may take a moment.
INFO [2022-06-22 23:56:19] plot_cnv_observation:Start
INFO [2022-06-22 23:56:19] Observation data size: Cells= 5432 Genes= 2575
Error in file(file, ifelse(append, "a", "w")) : 
  cannot open the connection

This is the traceback:

> traceback()
8: file(file, ifelse(append, "a", "w"))
7: cat(res, file = file, append = append, sep = "\n")
6: write.tree(as.phylo(infercnv_obj@tumor_subclusters$hc[[obs_annotations_names[i]]]), 
       file = paste(file_base_name, sprintf("%s.observations_dendrogram.txt", 
           output_filename_prefix), sep = .Platform$file.sep))
5: .plot_cnv_observations(infercnv_obj = infercnv_obj, obs_data = obs_data, 
       file_base_name = out_dir, do_plot = !is.na(output_format), 
       write_expr_matrix = write_expr_matrix, output_filename_prefix = output_filename, 
       cluster_contig = ref_contig, contigs = contigs, contig_colors = ct.colors[contigs], 
       contig_labels = contig_labels, contig_names = contig_names, 
       col_pal = custom_pal, contig_seps = col_sep, num_obs_groups = k_obs_groups, 
       obs_annotations_groups = obs_annotations_groups, obs_annotations_names = obs_annotations_names, 
       grouping_key_coln = grouping_key_coln[1], cluster_by_groups = cluster_by_groups, 
       cnv_title = title, cnv_obs_title = obs_title, contig_lab_size = contig_cex, 
       breaksList = breaksList_t, gene_position_breaks = gene_position_breaks, 
       x.center = x.center, hclust_method = hclust_method, layout_lmat = force_layout[["lmat"]], 
       layout_lhei = force_layout[["lhei"]], layout_lwid = force_layout[["lwid"]], 
       useRaster = useRaster)
4: plot_cnv(infercnv_obj = hmm.infercnv_obj, k_obs_groups = k_obs_groups, 
       cluster_by_groups = cluster_by_groups, cluster_references = cluster_references, 
       plot_chr_scale = plot_chr_scale, chr_lengths = chr_lengths, 
       out_dir = out_dir, title = sprintf("%02d_HMM_preds.repr_intensities", 
           step_count), output_filename = sprintf("infercnv.%02d_HMM_pred%s.Pnorm_%g.repr_intensities", 
           step_count, hmm_resume_file_token, BayesMaxPNormal), 
       output_format = output_format, write_expr_matrix = TRUE, 
       x.center = 1, x.range = c(-1, 3), png_res = png_res, useRaster = useRaster)
3: infercnv::run(infercnv_obj, cutoff = 0.1, out_dir = "oligo_anissa_noMHC_unkownMyelo_CLST_refMyeloBut33_wi201_scaled", 
       num_threads = 6, window_length = 201, HMM_type = "i6", BayesMaxPNormal = 0.5, 
       plot_steps = F, plot_probabilities = F, save_rds = F, save_final_rds = T, 
       no_prelim_plot = T, cluster_by_groups = T, denoise = T, analysis_mode = "subclusters", 
       scale_data = T, HMM = T)
2: withCallingHandlers(expr, warning = function(w) if (inherits(w, 
       classes)) tryInvokeRestart("muffleWarning"))
1: suppressWarnings(infercnv::run(infercnv_obj, cutoff = 0.1, out_dir = "oligo_anissa_noMHC_unkownMyelo_CLST_refMyeloBut33_wi201_scaled", 
       num_threads = 6, window_length = 201, HMM_type = "i6", BayesMaxPNormal = 0.5, 
       plot_steps = F, plot_probabilities = F, save_rds = F, save_final_rds = T, 
       no_prelim_plot = T, cluster_by_groups = T, denoise = T, analysis_mode = "subclusters", 
       scale_data = T, HMM = T))

How come previous steps wrote outputs in the same folder without any issues and then this one pops out of nowhere?

Best, Andy

GeorgescuC commented 2 years ago

Hi @andynkili ,

What type of system are you running on? Since the previous HMM steps plots seem to have worked just fine, my first guessse would be that either the disk has become (maybe temporarily) full, or that connection to a network drive might have dropped. Since you set "save_rds=F", it is not possible to directly restart from the same step, but have you attempted to run the process again?

Regards, Christophe.

andynkili commented 2 years ago

@GeorgescuC ,

Silly me! It was just a network failure, I should have thought about that one! Thank you for taking time to respond.

Have a great one, Andy