Error when using UpSetR package
1
0
Entering edit mode
3.4 years ago
peter.berry5 ▴ 60

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 • 2.4k views
ADD COMMENT
4
Entering edit mode
3.4 years ago

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')
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode

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

ADD REPLY
0
Entering edit mode

Perfect. Thanks for that.

ADD REPLY

Login before adding your answer.

Traffic: 1965 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6