0
$\begingroup$

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:

enter image description here

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...

$\endgroup$
  • 1
    $\begingroup$ UpSet plots are in many ways similar to Venn diagrams, in that the represent some sort of metric for group overlap. What I expect you want to do is get the number of DE genes in various comparisons and put those numbers into an UpSet plot. $\endgroup$ – Devon Ryan Apr 14 '18 at 13:33
  • $\begingroup$ upsetR takes as input a data.table in the long format. I found this example/code very helpful when I first started using upsetR. $\endgroup$ – fridaymeetssunday Apr 14 '18 at 19:37
  • $\begingroup$ I need to get the binary matrix to be able to feed it into the UpSetR. Right now I have a matrix where rows are genes and columns are groups. Somehow for each gene I need to set a threshold value to convert it to binary ‘expressed/not expressed’ probably. Groups are vectors of numbers, so I need to find their intersection somehow. I do not know which software or R package do that: I would not want to do it manually. $\endgroup$ – Nikita Vlasenko Apr 14 '18 at 21:00
  • $\begingroup$ I am pretty confused but the problem is rather definite: I need to represent groups, their similarity, as an UpSet plot. $\endgroup$ – Nikita Vlasenko Apr 14 '18 at 21:13
  • 3
    $\begingroup$ I think, it would be good to rephrase your question to match your ultimate goal something like "How can I use UpSet plot for expression/RNA-seq?". Say what is you sample and why you want to do the UpSet plot. $\endgroup$ – Kamil S Jaron Apr 15 '18 at 17:43
2
$\begingroup$

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 <- mtcars

tmp$car <- rownames(mtcars)
list <- lapply(colnames(mtcars), function(x) {
  tmp[tmp[[x]] > median(tmp[[x]]), "car"]
})
names(list) <- colnames(mtcars)

upset(fromList(list))

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

$\endgroup$
1
$\begingroup$

I wrote a script to create the binary data frame with my differential expression data. If it is of any help to anyone:

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.