2

我正在尝试使用UpSetR包中的查询功能来突出显示取决于一个变量的某些项目。

我的数据集Dropbox 链接

我可以毫无问题地做一个基本的情节:

stress <- read_delim("upset_plot_high_freq.csv", "\t", escape_double = FALSE, trim_ws = TRUE)
stress_data<-as.data.frame(stress)
    upset(stress_data, sets = c("reg_region","sweep","gene_association","chromatin"),

          mainbar.y.label = "Number of TEs", sets.x.label = "Total number of TEs", 
      text.scale = 2, group.by = "degree", order.by="freq")

我的(简化的)数据集的基本扰乱图

但是,当我尝试进行一些基本查询时,我会遇到各种错误。例如,在一个基本查询中,我要求将变量中具有给定值的所有元素涂成蓝色,我收到以下错误:

myfunction <- function(row, min){
  newData <- (row["chip_num"] > min)
}

upset(stress_data, sets = c("reg_region","sweep","gene_association","chromatin"),
      queries = list(query = myfunction, params = list(0), active = TRUE), 
      mainbar.y.label = "Number of TEs", sets.x.label = "Total number of TEs", 
      text.scale = 2, group.by = "degree", order.by="freq")

查询 [[i]]$color 中的错误:“闭包”类型的对象不是子集

4

1 回答 1

3

的输入queries必须是列表列表:

library(UpSetR)
library(readr)

stress <- read_delim("upset_plot_fixed_freq.csv", "\t", 
                     escape_double = FALSE, trim_ws = TRUE)
stress_data <- as.data.frame(stress)
names(stress_data)[c(9,12,13,10)] <- c("reg_region","sweep",
                                       "gene_association","chromatin")

myfunction <- function(row, min) {
  newData <- (row["chip_num"] > min)
}

upset(stress_data, sets=c("reg_region","sweep","gene_association","chromatin","chip_num"),
      queries = list(list(query = myfunction, params = list(0), active = T)), 
      mainbar.y.label = "Number of TEs", sets.x.label = "Total number of TEs", 
      text.scale = 2, group.by = "degree", order.by="freq")

在此处输入图像描述

于 2017-11-23T19:23:34.677 回答