This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error when using UpSetR package

I'm using the UpSetR package to show intersects between sets of differentially expressed proteins from cells grown under different conditions. However, when I run my code I get the following error message

Error in dim(X) <- c(n, length(X)/n) : dims [product 2] do not match the length of object [3] 

if I understand the output of the traceback I ran the error is in the colSums (data[sets]) set, but I've no idea how to fix this.

My code is as follows

df1 <- c("GAPDH", "ACTB", "CTSB", "DHRF", "AARS", "ACOT2" )
df2 <- c("GAPDH", "ACTB", "CTSB", "LDHA", "ACOT8" )
df3 <- c("GAPDH", "ACTB", "DHRF", "LDHA" )
data <- list(df1, df2, df3)
data_v2 <- UpSetR::fromList(data) 
upset(fromList(data_v2), 
      nintersects = NA, 
      nsets = 3,
      empty.intersections = "on",
      order.by = "freq", 
      decreasing = T, 
      number.angles = 0, 
      text.scale = 1.1, 
      point.size = 2.8, 
      line.size = 1
      )

dim(data_v2) # 8 observations of 3 variables
length(data_v2) #3

Any advice would be appreciated. I'm not sure what to try next.

upsetr r

1 answer

I don't think you should be using fromList twice in your code.

Also, you could try this alternative: https://github.com/const-ae/ggupset

I looked into it... you need to name your list.

 names(data) <- c('Set1','Set2','Set3')

I've modified the code and it now works.

df1 <- c("GAPDH", "ACTB", "CTSB", "DHRF", "AARS", "ACOT2" )
df2 <- c("GAPDH", "ACTB", "CTSB", "LDHA", "ACOT8" )
df3 <- c("GAPDH", "ACTB", "DHRF", "LDHA" )
data <- list(df1, df2, df3)
names(data) <- c("Fred", "Ciara", "Pat") 
data_v2 <- UpSetR::fromList(data) 
upset(fromList(data_v2), 
      nintersects = NA, 
      nsets = 3,
      sets = c("Fred", "Ciara", "Pat"),
      empty.intersections = "on",
      order.by = "freq", 
      decreasing = T, 
      number.angles = 0, 
      text.scale = 1.1, 
      point.size = 2.8, 
      line.size = 1
      )

The pplot it drew is below. I have 2 further questions thou.

e

  1. Surely there should be bars showing the single interesction between Fred and Ciara (CTSB), Fred and Pat (DHRF) and Ciara and Pat (LDHA)? I understood that the function of nintersects = NA, was to ensure that all intersections were shown.

  2. Why is the barplot showing sample size saying all sets have 2 members rather than the actual numbers (Fred = 6, Ciara = 5 and Pat = 4) and how do I change this?

Thanks

Because you need to remove one of the fromList() calls...

Just remove the data_v2 <- UpSetR::fromList(data) line and change the data_v2 in the line below to data

Log in to answer this question.