How can I use UpSet plot for expression/RNA-seq data I have a data.frame of 27 000 x 17 and I want to feed it into UpSetR program, but getting the error:


  Error in start_col:end_col : argument of length 0


My data.frame looks like that:



And the upSetR code that I am using:

upset(df, nsets = 4, number.angles = 30, point.size = 3.5, line.size = 2, 
mainbar.y.label = "Gene Intersections", sets.x.label = "Genes Per Group", 
text.scale = c(1.3, 1.3, 1, 1, 2, 0.75))


What am I doing wrong here? Any suggestions would be greatly appreciated.


  Update


I found here a similar issue: 

https://plus.google.com/109635504520741246387/posts/Etujrp6sU1Q

They say that the input should be binary. But then, how can I calculate this binary matrix from the rlog-data? I am not sure...
You need to generate a list of gene ID vectors to feed into upset. In the example below, I am selecting observations (genes) which have an level above the median level. You could also choose only genes above the 3rd quartile, etc. You then need to convert these from a list of character vectors to a presence/absence matrix. UpSetR has a fromList function that does just this.

In future, be more specific about what you want to achieve and supply example data for people to work with.

library("UpSetR")

tmp &lt;- mtcars

tmp$car &lt;- rownames(mtcars)
list &lt;- lapply(colnames(mtcars), function(x) {
  tmp[tmp[[x]] &gt; median(tmp[[x]]), "car"]
})
names(list) &lt;- colnames(mtcars)

upset(fromList(list))




Created on 2019-10-17 by the reprex package (v0.3.0)