broadinstitute / infercnv

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

Error in validate_infercnv_obj(infercnv_obj): Problem detected w/ infercnv_obj and Error: No feature overlap between existing object and new layer data #659

Open Prakrithi-P opened 5 months ago

Prakrithi-P commented 5 months ago

Hi when I run inferCNV I get errors, irrespective of the versions.

In an older Version

options("CY112sn_subset.assay.version" = "v3") infercnv_obj = CreateInfercnvObject( raw_counts_matrix=GetAssayData(CY112sn_subset, slot="scale.data"), annotations_file=infercnv_meta, delim="\t", gene_order_file="infercnv//hg38_gencode_v27.txt", ref_group_names=c("CD8+ T cell","B cell","CD4+ T cell","Lymphatic endothelial cell","Fibroblast","Endothelial cell"))

Macrophage

out_dir = tempfile() infercnv_obj_default = infercnv::run( infercnv_obj, cutoff=1, # cutoff=1 works well for Smart-seq2, and cutoff=0.1 works well for 10x Genomics out_dir="./infercnv/CY112/", cluster_by_groups=TRUE, plot_steps=FALSE, denoise=TRUE, HMM=FALSE, no_prelim_plot=TRUE, png_res=60 )

This gave me the following error: INFO [2024-04-18 17:56:52] define_signif_tumor_subclusters(p_val=0.1 INFO [2024-04-18 17:56:52] define_signif_tumor_subclusters(), tumor: CD8+ T cell INFO [2024-04-18 17:56:52] Less cells in group CD8+ T cell than k_nn setting. Keeping as a single subcluster. INFO [2024-04-18 17:56:52] define_signif_tumor_subclusters(), tumor: B cell INFO [2024-04-18 17:56:52] Less cells in group B cell than k_nn setting. Keeping as a single subcluster. INFO [2024-04-18 17:56:52] define_signif_tumor_subclusters(), tumor: Macrophage Warning message: “Data is of class matrix. Coercing to dgCMatrix.” Error: No feature overlap between existing object and new layer data Traceback:

  1. infercnv::run(infercnv_obj, cutoff = 1, out_dir = "./infercnv/CY112/", . cluster_by_groups = TRUE, plot_steps = FALSE, denoise = TRUE, . HMM = FALSE, no_prelim_plot = TRUE, png_res = 60)
  2. define_signif_tumor_subclusters(infercnv_obj = infercnv_obj, . p_val = tumor_subcluster_pval, k_nn = k_nn, leiden_resolution = leiden_resolution, . leiden_method = leiden_method, leiden_function = leiden_function, . hclust_method = hclust_method, cluster_by_groups = cluster_by_groups, . partition_method = tumor_subcluster_partition_method, per_chr_hmm_subclusters = per_chr_hmm_subclusters, . z_score_filter = z_score_filter)
  3. .single_tumor_leiden_subclustering(tumor_group = tumor_group, . tumor_group_idx = tumor_group_idx, tumor_expr_data = tumor_expr_data, . chrs = chrs, k_nn = k_nn, leiden_resolution = leiden_resolution, . leiden_method = leiden_method, leiden_function = leiden_function, . hclust_method = hclust_method)
  4. .leiden_seurat_preprocess_routine(expr_data = tumor_expr_data, . k_nn = k_nn, resolution_parameter = leiden_resolution, objective_function = leiden_function)
  5. CreateSeuratObject(expr_data, assay = "infercnv", project = "infercnv", . names.field = 1)
  6. CreateSeuratObject.default(expr_data, assay = "infercnv", project = "infercnv", . names.field = 1)
  7. CreateAssay5Object(counts = counts, min.cells = min.cells, min.features = min.features, . ...)
  8. .CreateStdAssay(counts = counts, min.cells = min.cells, min.features = min.features, . transpose = transpose, type = type, csum = csum, fsum = fsum, . ...)
  9. .CreateStdAssay.list(counts = counts, min.cells = min.cells, . min.features = min.features, transpose = transpose, type = type, . csum = csum, fsum = fsum, ...)
  10. LayerData<-(object = *tmp*, layer = layer, features = features[[layer]], . cells = cells[[layer]], transpose = transpose, value = counts[[layer]])
  11. LayerData<-.Assay5(object = *tmp*, layer = layer, features = features[[layer]], . cells = cells[[layer]], transpose = transpose, value = counts[[layer]])
  12. stop("No feature overlap between existing object and new layer data", . call. = FALSE)

In the New version 1.19.1, the same command gives the following error: INFO [2024-04-23 18:08:51] ::above_min_mean_expr_cutoff:Start INFO [2024-04-23 18:08:51] Removing 1919 genes from matrix as below mean expr threshold: 1 INFO [2024-04-23 18:08:51] validating infercnv_obj ERROR [2024-04-23 18:08:51] hmm.... rownames(infercnv_obj@expr.data != rownames(infercnv_obj@gene_order)) Error in validate_infercnv_obj(infercnv_obj): Problem detected w/ infercnv_obj Traceback:

  1. infercnv::run(infercnv_obj, cutoff = 1, out_dir = "./infercnv/CY128/", . cluster_by_groups = TRUE, plot_steps = FALSE, denoise = TRUE, . HMM = FALSE, no_prelim_plot = TRUE, png_res = 60)
  2. require_above_min_mean_expr_cutoff(infercnv_obj, cutoff)
  3. remove_genes(infercnv_obj, indices)
  4. validate_infercnv_obj(infercnv_obj)
  5. stop("Problem detected w/ infercnv_obj")

I get the same errors despite the rownames being the same. Could you please help me solve this?

Thanks, Prakrithi