INFO [2023-12-21 13:06:50] Parsing gene order file: gencode.v32_gene_pos.txt
INFO [2023-12-21 13:06:50] ::order_reduce:Start.
Error in FUN(left, right) : non-numeric argument to binary operator
原因和解决方法
- 在infercnv_1.18.1及1.19.1的版本中,出现此错误的位置是
which(genomic_position[2] + genomic_position[3] == 0)
flog.info(paste("::order_reduce:Start.", sep=""))
ret_results <- list(expr=NULL, order=NULL, chr_order=NULL)
if (is.null(data) || is.null(genomic_position)){
return(ret_results)
}
# Drop pos_gen entries that are position 0
remove_by_position <- -1 * which(genomic_position[2] + genomic_position[3] == 0)
if (length(remove_by_position)) {
flog.debug(paste("::process_data:order_reduce: removing genes specified by pos == 0, count: ",
length(remove_by_position), sep=""))
genomic_position <- genomic_position[remove_by_position, , drop=FALSE]
}
# Reduce to genes in pos file
flog.debug(paste("::process_data:order_reduce: gene identifers in expression matrix: ",
row.names(data), collapse="\n", sep=""))
- 说明基因注释文件的第二列和第三列有非数值类型
non-numeric
的元素出现,大概率是因为你的基因注释文件如下,有表头header
:
chr start stop
DDX11L1 chr1 11869 14412
WASH7P chr1 14363 29806
FAM138A chr1 34554 36081
OR4F5 chr1 69091 70008
OR4F29 chr1 367640 368634
OR4F16 chr1 621059 622053
- 通过broad研究所gtf_to_position_file.py准备的注释文件是没有
header
的
- 并且,infercnv读取基因注释文件时的代码如下,也就是说不能有
header
,否则header
的值会作为第二列和第三列的值,也就是出现了charactor
类型:
gene_order <- read.table(gene_order_file, header=FALSE, row.names=1, sep="\t", check.names=FALSE)
DDX11L1 chr1 11869 14412
WASH7P chr1 14363 29806
FAM138A chr1 34554 36081
OR4F5 chr1 69091 70008
OR4F29 chr1 367640 368634
OR4F16 chr1 621059 622053