broadinstitute / infercnv

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

Error in if (num_genes_removed > 0) { : argument is of length zero #564

Open Bongjun86 opened 1 year ago

Bongjun86 commented 1 year ago

Hi. I am new to inferCNV.

I am trying to create an inferCNV obj, and I got the error message.

first, I generated a count matrix from a Seurat object.

counts_matrix = GetAssayData(data_sub2, slot="counts")

Second, I generated metadata

metadata <- as.data.frame(data_sub2[[]][, 6, drop=FALSE])

And I tried to generate inferCNV obj using code shown below

infercnv_obj = CreateInfercnvObject(raw_counts_matrix=counts_matrix, annotations_file=metadata, delim="\t", gene_order_file="/Users/bkim6/Desktop/BJ/NSCLC_atlas_Epithelial/inferCNV/gencode_v19_gen_pos.complete.txt", ref_group_names=c("normal"))

The error messages were shown.

INFO [2023-06-20 15:58:39] Parsing gene order file: /Users/bkim6/Desktop/BJ/NSCLC_atlas_Epithelial/inferCNV/gencode_v19_gen_pos.complete.txt INFO [2023-06-20 15:58:39] ::order_reduce:Start. INFO [2023-06-20 15:58:39] ::process_data:order_reduce:The position file and the expression file row (gene) names do not match. Error in if (num_genes_removed > 0) { : argument is of length zero

Could you help me to fix this?