Question: Extract Interaction Matrix from UpSetR
0
gravatar for ste.lu
6 months ago by
ste.lu60
ste.lu60 wrote:

Do you know if there is a way to extract the interaction matrix UpSetR is creating for its plots?

I want to plot the interactions in between the columns of my data.frame, but I have several columns and UpSetR style of plotting is quite heavy. To solve this problem, I'd like to extract the values and interactions UpSetR is calculating for its matrix and use it to build a heatmap which I think will be more easy to read.

Do you have any suggestion on how to export the upsetR data?

Example of UpSetR: https://cloud.githubusercontent.com/assets/12614369/8468576/18d5ef52-203c-11e5-9f5d-e034ec41c538.png

What I have in mind (source: Intervene R package): https://intervene.readthedocs.io/en/latest/_images/pairwise_tribar.png

My dataframe structure is like:

dummy_df <- data.frame(A = c(1,1,1,0),
                 B = c(0,1,0,1),
                 C = c(0,1,0,1),
                 D = c(1,0,0,0),
                 E = c(0,0,0,0))

But I have a 2000x24 dataframe.

If it's not possible to extract this info from UpsetR: Ultimately, I'd like to have a list of interaction which is reporting how many times that columns have "1s" together in the same row. e.g.:

ABC = 1,
AD = 1,
BC = 1,
A = 1,

And a matrix reporting the rows which are sharing "1s" in columns (it can be the count, but better a fraction)

 A B C D E
A 1  
B 0.25 1  
C 0.25 0.5  1 
D 0 0 0 1
E 0 0 0 0 1

Any help would be much appreciated.

matrix tool upsetr interactions R • 254 views
ADD COMMENTlink modified 6 months ago by Alex Reynolds29k • written 6 months ago by ste.lu60
1
gravatar for Alex Reynolds
6 months ago by
Alex Reynolds29k
Seattle, WA USA
Alex Reynolds29k wrote:

You might find this useful: https://tools.altiusinstitute.org/checkerboard/

Click on "Example" and "Import" buttons in the left-most column, then click on "Select All" in the second column, "Render" in the third column, and you can see the mileage-between-cities-like figure on the right.

To reuse this with your data, you'd just reformat your pairwise matrix into a JSON object like that in the example, and paste it into the input field. Then "Import", "Select All", and "Render" as before.

ADD COMMENTlink written 6 months ago by Alex Reynolds29k

Thanks for your answer. Do you know if there is a package (preferably in R) which I can implement in my script?

ADD REPLYlink written 6 months ago by ste.lu60

R: heatmap for triangular matrix maybe?

ADD REPLYlink written 6 months ago by Alex Reynolds29k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1728 users visited in the last hour