broadinstitute / infercnv

Inferring CNV from Single-Cell RNA-Seq
Other
548 stars 161 forks source link

Not getting the reference part of the heatmap #667

Open Cristinacondel1 opened 2 months ago

Cristinacondel1 commented 2 months ago

Dear All,

I'm running the code for inferCNV and everything gets generated correctly but in all the heatmaps generated the reference cell heatmap is missing.

Screenshot 2024-06-13 at 13 56 36

The code I'm using for the run is as follows:

# Create the inferCNV object
  infercnv_obj <- CreateInfercnvObject(
    raw_counts_matrix = HNSC_matrix,
    annotations_file = annotation_file_path,
    delim = ",",
    gene_order_file = "/omics/odcf/analysis/OE0509_projects/hnscc/single_cell/Single_Cell_Analysis/Single_Cell_Datasets/All_Cells_Together/Integration/InferCNV/hg38_gencode_v27.txt",
    ref_group_names = c("Immune", "Stromal"),
    chr_exclude = c("chrM")
  )

   # Perform inferCNV operations to reveal CNV signal

  infercnv_obj <- infercnv::run(
    infercnv_obj,
    cutoff = 0.1,
    out_dir = paste0("output_dir_", dataset_id), 
    cluster_by_groups = TRUE,
    denoise = TRUE,
    HMM = TRUE
  )

At one point I got the following error message, but already all the heatmaps were generated:

Error in heatmap.cnv(obs_data, Rowv = obs_dendrogram, Colv = FALSE, cluster.by.row = TRUE,  :
  'RowIndividualColors' must be a character vector of length nrow(x)
Calls: <Anonymous> ... plot_subclusters -> plot_cnv -> .plot_cnv_observations -> heatmap.cnv
In addition: Warning messages:
1: In cbind(row_groupings, get_group_color_palette()(length(table(hcl_obs_annotations_groups)))[hcl_obs_annotations_groups]) :
  number of rows of result is not a multiple of vector length (arg 2)
2: In cbind(split_groups, row_groupings[, 1], hcl_obs_annotations_groups,  :
  number of rows of result is not a multiple of vector length (arg 3)
Execution halted 

But I'm not sure how to proceed after trying out and checking that all input files are in the right format.

hayden-bell commented 1 month ago

I had the same issue. It is possible that it is related to the size of the your reference and the Cairo back-end is then unable to generate a matrix of that size.

See https://github.com/broadinstitute/infercnv/wiki/Infercnv-runs-successfully-and-generated-plots-but-they-are-blank

peizhu1205 commented 1 month ago

output_format="pdf": Changing the output format to PDF can resolve this issue.