UpsetR intersection numbers
1
0
Entering edit mode
13 months ago
Mehmet ▴ 670

Dear All,

I am using UpsetR for visualize OrthoFinder gene count results based on the command below:

upset(fromList(mydata), nsets = 7, matrix.color = "red", sets.bar.color = "blue")

This is my data:

   A B C  D E F  G
1  0 2 1  9 1 5 17
2  0 0 0  5 0 0  5
3  0 0 0  5 0 2 32
4  0 0 0 14 0 0 16
5  0 0 0  5 0 2 14
6  0 0 0  7 0 0  9
7  0 0 0 10 0 0  7
8  0 0 0 11 0 0  8
9  0 0 0  0 0 0  2
10 1 1 1  6 1 2  7
11 0 0 0  7 0 2  4
12 0 0 0  4 0 2  8
13 0 0 0  4 0 1 11
14 0 0 0  3 0 0  5
15 0 1 1  2 0 1  5
16 1 0 0  3 0 2  4
17 0 0 0  4 0 1  5
18 0 0 0  3 0 2  5
19 1 1 1  3 1 3  3
20 0 0 0  6 0 1  4

But I can not see the intersection of all columns. For instance at lines 10 and 19 there are numbers in all columns. But the figure does not have this. Am I missing something ?

The figure is at :

figure

R gene sequencing • 546 views
ADD COMMENT
0
Entering edit mode

nsets limits the number of interactions shown to 7. If you want more than you have to increase that number.

ADD REPLY
0
Entering edit mode

Thank you for reply, but it did not change.

I selected F and G columns only to test using two different functions below:

in the first code I used upset function only and in the second code I used fromList function as well. But results are different. I attached two figures (fromList and upset titles).

> upset(mydata, sets = c("F", "G"), matrix.color = "red", sets.bar.color = "blue",  nsets = 100000000000000000, group.by = "freq", order.by = "freq")

> upset(fromList(mydata), sets = c("F", "G"), matrix.color = "red", sets.bar.color = "blue",  nsets = 100000000000000000, group.by = "freq", order.by = "freq")

upset and fromlist functions

ADD REPLY
0
Entering edit mode

Is mydata a list or a data frame? It should be a list. Based on the output, it looks like a data frame.

What does str(mydata) look like?

ADD REPLY
0
Entering edit mode
13 months ago
Mehmet ▴ 670

I converted mydata to a list as below:

> str(mydata)
List of 7
 $ A: int [1:99] 0 0 0 0 0 0 0 0 0 1 ...
 $ B: int [1:99] 2 0 0 0 0 0 0 0 0 1 ...
 $ C: int [1:99] 1 0 0 0 0 0 0 0 0 1 ...
 $ D: int [1:99] 9 5 5 14 5 7 10 11 0 6 ...
 $ E: int [1:99] 1 0 0 0 0 0 0 0 0 1 ...
 $ F: int [1:99] 5 0 2 0 2 0 0 0 0 2 ...
 $ G: int [1:99] 17 5 32 16 14 9 7 8 2 7 ...


> head(mydata)
$A
 [1] 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
[53] 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 1 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

$B
 [1] 2 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1
[53] 0 1 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0

$C
 [1] 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
[53] 0 1 0 0 0 0 0 2 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0

$D
 [1]  9  5  5 14  5  7 10 11  0  6  7  4  4  3  2  3  4  3  3  6  3  2  6  4  5  0  2  4  0  2  5  1  2  4
[35]  3  3  7  1  5  2  4  0  1  1  5  2  2  1  0  2  4  2  2  2  4  1  4  2  2  2  2  2  2  2  2  4  4  1
[69]  2  4  2  5  1  2  2  3  2  2  3  2  2  2  1  1  0  4  4  1  2  2  1  0  0  2  1  2  3  2  2

$E
 [1] 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1
[53] 1 1 0 0 0 0 0 2 1 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 2 0 0 0 0 0 0 0 0 0 2 0 0 0 1 0

$F
 [1]  5  0  2  0  2  0  0  0  0  2  2  2  1  0  1  2  1  2  3  1  2  2  8  2  1  0  1  1  0  0  1  1  1  6
[35]  0  2  0  1  2  2  0  0  0  0  2  2  1  2 16  2  1  2  1  2  0  1  1  2  1  2  1  2  2  1  2  1  1  0
[69]  1  1  1  0  4  1  2  2  0  2  1  1  1  1  1  2  0  0  0  0  2  0  0  2  3  0  1  0  0  1  1

and used as below:

> upset(mydata)
Error in 1:ncol(data) : argument of length 0

for another usage:

>upset(fromList(mydata), sets = c("A", "B"))

which shows the intersection size between A and B is 3, which is not true when I check the data.

ADD COMMENT
0
Entering edit mode

OK.I have solved and I am explaining here.

UpsetR requires a binary data frame (numbers with zero and one only). Numbers bigger than 1 should replace with 1.The, upset function reads the data frame and produces graphs after calculating intersection size.

Probably, UpsetR ignores if a row is not consisted of binary data.

ADD REPLY
0
Entering edit mode

UpsetR requires a binary data frame

UpsetR works with multiple data formats.

The vignette starts with a non-binary list as example:

# example of list input (list of named vectors)
listInput <- list(one = c(1, 2, 3, 5, 7, 8, 11, 12, 13), two = c(1, 2, 4, 5, 
    10), three = c(1, 5, 6, 7, 8, 9, 10, 12, 13))
ADD REPLY

Login before adding your answer.

Traffic: 1306 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