broadinstitute / infercnv

Inferring CNV from Single-Cell RNA-Seq
Other
526 stars 159 forks source link

Error in !all.equal(ref_group_names, orig_ref_group_names) : invalid argument type #477

Open qiangfan2022 opened 1 year ago

qiangfan2022 commented 1 year ago

Hello, Thanks a lot for this tool.

I have run the following code:

library(infercnv) infercnv_obj = CreateInfercnvObject(raw_counts_matrix=expr.infercnv, annotations_file=infercnv.meta, delim="\t", gene_order_file=system.file("extdata", "genepos.txt", package = "infercnv"), ref_group_names=c("B cells"))

The head of "expr.infercnv" just like: CN1_AAACCCAAGACGCATG-1 CN1_AAACGAAAGGGCGAAG-1 CN1_AAACGCTGTAGCCAGA-1 CN1_AAAGAACAGCCTCATA-1 FAM87B 0.000000 0 0 0 LINC00115 0.000000 0 0 0 FAM41C 0.000000 0 0 0 SAMD11 0.000000 0 0 0 NOC2L 2.655178 0 0 0 KLHL17 0.000000 0 0 0

The head of "infercnv.meta" just like: Cells_ID Cell_Type CN1_AAACCCAAGACGCATG-1 CN1_AAACCCAAGACGCATG-1 Hepatocytes CN1_AAACGAAAGGGCGAAG-1 CN1_AAACGAAAGGGCGAAG-1 Hepatocytes CN1_AAACGCTGTAGCCAGA-1 CN1_AAACGCTGTAGCCAGA-1 B cells CN1_AAAGAACAGCCTCATA-1 CN1_AAAGAACAGCCTCATA-1 B cells CN1_AAAGGATAGTATCCTG-1 CN1_AAAGGATAGTATCCTG-1 Hepatocytes CN1_AAAGGGCGTTGCACGC-1 CN1_AAAGGGCGTTGCACGC-1 Cholangiocytes

The head of genepos" just like: FAM87B chr1 817371 819837 LINC00115 chr1 824228 827539 FAM41C chr1 868071 876903 SAMD11 chr1 923923 944575 NOC2L chr1 944203 959309 KLHL17 chr1 960584 965719 PLEKHN1 chr1 966482 975865 PERM1 chr1 975198 982117 HES4 chr1 998962 1000172 ISG15 chr1 1001138 1014540 AGRN chr1 1020120 1056118 RNF223 chr1 1070967 1074306

Finally the return message just like: INFO [2022-11-10 01:34:30] Parsing gene order file: C:/Program Files/R/R-4.0.3/library/infercnv/extdata/genepos.txt INFO [2022-11-10 01:34:30] ::order_reduce:Start. INFO [2022-11-10 01:34:31] .order_reduce(): expr and order match. INFO [2022-11-10 01:34:32] ::process_data:order_reduce:Reduction from positional data, new dimensions (r,c) = 20043,6239 Total=11811243.1705709 Min=0 Max=8.80338018248814. INFO [2022-11-10 01:34:32] num genes removed taking into account provided gene ordering list: 764 = 3.81180462006686% removed. INFO [2022-11-10 01:34:33] -filtering out cells < 100 or > Inf, removing 0 % of cells Error in !all.equal(ref_group_names, orig_ref_group_names) : invalid argument type

So i just wonder how to fix?

GeorgescuC commented 1 year ago

Hi @qiangfan2022 ,

The annotation file, "infercnv.meta" in your case, expects only 2 columns, one containing the cell name, and one containing the annotation name. In the file you shared the head of, there are 3 columns with the cell name being duplicated. Simply dropping one of the columns and using that version of the file should be enough.

Regards, Christophe.