【问题标题】:circos.heatmap(): Error in rowMeans(m) : 'x' must be an array of at least two dimensionscircos.heatmap():rowMeans(m)中的错误:'x'必须是至少二维的数组
【发布时间】:2021-10-03 18:40:21
【问题描述】:

我正在按照教程制作circular plots in R。假设我有这个数据集:

set.seed(123)
    mat1 = rbind(cbind(matrix(rnorm(50*5, mean = 1), nr = 50), 
                   matrix(rnorm(50*5, mean = -1), nr = 50)),
                cbind(matrix(rnorm(50*5, mean = -1), nr = 50), 
                   matrix(rnorm(50*5, mean = 1), nr = 50))
                )
    rownames(mat1) = paste0("R", 1:100)
    colnames(mat1) = paste0("C", 1:10)
    mat1 = mat1[sample(100, 100), ] # randomly permute rows
    split = sample(letters[1:5], 100, replace = TRUE)
    split = factor(split, levels = letters[1:5])

我尝试使用Heatmap 并正确返回。

library(ComplexHeatmap)
Heatmap(mat1, row_split = split)

enter image description here

但是,当我尝试使用circos.heatmap() 时,它返回错误:

library(circlize)
col_fun1 = colorRamp2(c(-2, 0, 2), c("blue", "white", "red"))
circos.heatmap(mat = mat1, split = split, col = col_fun1)
circos.heatmap(mat = mat1, col = col_fun1)
> Error in rowMeans(m) : 'x' must be an array of at least two dimensions

矩阵本身的尺寸为 100 x 10。有什么我遗漏的吗?

【问题讨论】:

    标签: r data-visualization circlize


    【解决方案1】:

    CRAN版本也有同样的问题,安装dev版本后已修复

    devtools::install_github("jokergoo/circlize")
    

    -测试

    > library(circlize)
    ========================================
    circlize version 0.4.13
    CRAN page: https://cran.r-project.org/package=circlize
    Github page: https://github.com/jokergoo/circlize
    Documentation: https://jokergoo.github.io/circlize_book/book/
    
    If you use it in published research, please cite:
    Gu, Z. circlize implements and enhances circular visualization
      in R. Bioinformatics 2014.
    
    This message can be suppressed by:
      suppressPackageStartupMessages(library(circlize))
    ========================================
    
    > col_fun1 = colorRamp2(c(-2, 0, 2), c("blue", "white", "red"))
    > ?circos.heatmap
    starting httpd help server ... done
    > 
    > set.seed(123)
    > mat1 = rbind(cbind(matrix(rnorm(50*5, mean = 1), nr = 50), 
    +                    matrix(rnorm(50*5, mean = -1), nr = 50)),
    +              cbind(matrix(rnorm(50*5, mean = -1), nr = 50), 
    +                    matrix(rnorm(50*5, mean = 1), nr = 50))
    +             )
    > rownames(mat1) = paste0("R", 1:100)
    > colnames(mat1) = paste0("C", 1:10)
    > mat1 = mat1[sample(100, 100), ] # randomly permute rows
    > split = sample(letters[1:5], 100, replace = TRUE)
    > spilt = factor(split, levels = letters[1:5])
    > col_fun1 = colorRamp2(c(-2, 0, 2), c("blue", "white", "red"))
    > circos.heatmap(mat1, split = split, col = col_fun1)
    > circos.clear()
    

    -输出

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-14
      • 2018-02-28
      • 1970-01-01
      • 2017-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多