Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in STEP 15 during CNV analysis:plot_cnv(): auto thresholding at: (NA , NA) #683

Open
Duiduipeng opened this issue Jan 4, 2025 · 0 comments

Comments

@Duiduipeng
Copy link

This is the code for my run:
gene_order=read.table("F:/Rtest0924/Filered2 Data/inferCNV/hg38_gencode_v27.txt", row.names = 1)
MergeData<-readRDS("F:/Rtest0924/Filered2 Data/celltype.rds")
counts <- GetAssayData(MergeData, slot = 'counts')
Idents(MergeData) <- MergeData$celltype
sc_Merge <- subset(MergeData, idents = c(
"Fibroblast",
"Schwann Cell",
"T cell",
"Endothelium",
"Neuroendocrine-Related Cells",
"CAF",
"Smooth Muscle Cells",
"MPS",
"Adipocytes",
"T/NK"
))
reference_celltypes <- c("T cell", "MPS", "T/NK")
target_celltypes <- c("Neuroendocrine-Related Cells","Fibroblast", "Schwann Cell", "Endothelium", "CAF",
"Smooth Muscle Cells", "Adipocytes")
reference_cells <- row.names([email protected])[[email protected]$celltype %in% reference_celltypes]
target_cells <- row.names([email protected])[[email protected]$celltype %in% target_celltypes]
cells <- append(reference_cells, target_cells)
sc=subset(sc_Merge, cells=cells)
Anno=[email protected][,c("cellname","celltype")]
Anno$celltype=as.character(Anno$celltype)

Anno[is.na(Anno$seurat_clusters),3]=Anno[is.na(Anno$seurat_clusters),2]

rownames(Anno)=Anno$cellname
Anno=as.matrix(Anno)
ref_group_names = c(reference_cells, target_cells)
Anno=Anno%>% as.data.frame()
infercnv_sc = CreateInfercnvObject(raw_counts_matrix = counts,
annotations_file = Anno,
delim="\t",
gene_order_file = gene_order,
ref_group_names =ref_group_names)
infercnv_sc = infercnv::run(infercnv_sc,
cutoff=1, # cutoff=1 works well for Smart-seq2, and cutoff=0.1 works well for 10x Genomics
out_dir="F:/Rtest0924/Filered2 Data/inferCNV",
cluster_by_groups=TRUE,
denoise=FALSE,
HMM=FALSE,
write_expr_matrix=T,
output_format = "pdf")
This is an error:
INFO [2025-01-04 14:53:14] ::plot_cnv:Start
INFO [2025-01-04 14:53:14] ::plot_cnv:Current data dimensions (r,c)=9028,8123 Total=73334444 Min=1 Max=1.
INFO [2025-01-04 14:53:14] ::plot_cnv:Depending on the size of the matrix this may take a moment.
INFO [2025-01-04 14:53:14] plot_cnv(): auto thresholding at: (NA , NA)
错误于seq.default(x.range[1], x.range[2], length.out = nb_breaks):
'from' must be a finite number
此外: 警告信息:
In max(nchar(obs_annotations_names)) : max里所有的参数都不存在;返回-Inf
debug finds that the error is in the source code:
plot_cnv(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, x.center = final_center_val,
x.range = final_scale_limits, title = "inferCNV",
output_filename = "infercnv", output_format = output_format,
write_expr_matrix = write_expr_matrix, write_phylo = write_phylo,
png_res = png_res, useRaster = useRaster)
}
May I ask what is the reason for the error? What can I do about it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant