individualizing the UpSetR or ComplexUpset (combining the intersections + queries + keep.order + group.by)

635 views Asked by At

I would like to get a plot which on the left side keeps 6 rows in the order listed S1-6, and as for columns I'm only am interested in the selected intersections (only non-empty S1 and S2 and one specific empty S1-S2 intersect).

upset(df, 
    sets = c("S1","S2","S3","S4", "S5","S6"),
    matrix.color="black", 
    point.size=1, 
    line.size = 0.3, 
    text.scale=c(1, 0.5, 0.5, 0.4, 0.75, 0.6), 
    mainbar.y.max=21, 
    mb.ratio = c(0.7, 0.3),
    intersections = list( 
    list("S1"), 
    list("S1", "S3"), 
    list("S1", "S4"), 
    list("S1", "S6"),
    list("S1", "S3", "S4"), 
    list("S1", "S3", "S6"),
    list("S1", "S4", "S6"),
    list("S1", "S3", "S4", "S5"), 
    list("S1", "S3", "S4", "S6"), 
    list("S1", "S3", "S4", "S5", "S6"), 
    list("S1", "S2"),
    list("S2"), 
    list("S2", "S3"), 
    list("S2", "S3", "S4"), 
    list("S2", "S3", "S4", "S6"), 
    list("S2", "S3", "S4", "S5", "S6")),     
    queries = list(
    list(query = intersects, params = list("S1"), color = "maroon", active = T),
    list(query = intersects, params = list("S1", "S3"), color = "maroon", active = T),
    list(query = intersects, params = list("S1", "S4"), color = "maroon", active = T),
    list(query = intersects, params = list("S1", "S6"), color = "maroon", active = T),
    list(query = intersects, params = list("S1", "S3", "S4"), color = "maroon", active = T),
    list(query = intersects, params = list("S1", "S3", "S6"),color = "maroon", active = T),
    list(query = intersects, params = list("S1", "S4", "S6"), color = "maroon", active = T),
    list(query = intersects, params = list("S1", "S3", "S4", "S5"), color = "maroon", active = T),
    list(query = intersects, params = list("S1", "S3", "S4", "S6"), color = "maroon", active = T),
    list(query = intersects, params = list("S1", "S3", "S4", "S5", "S6"), color = "maroon", active = T),
    list(query = intersects, params = list("S1", "S2"), color = "black", active = T),
    list(query = intersects, params = list("S2"), color = "blue", active = T),
    list(query = intersects, params = list("S2", "S3"), color = "blue", active = T),
    list(query = intersects, params = list("S2", "S3", "S4"), color = "blue", active = T),
    list(query = intersects, params = list("S2", "S3", "S4", "S6"), color = "blue", active = T),
    list(query = intersects, params = list("S2", "S3", "S4", "S5", "S6"), color = "blue", active = T) 
    ))

here is how my plot looks like

BUT, I the rows order has changed and I would like to use group.by="sets", so my question is how I can change order of both rows and columns, select intersections shown and change the color of selected set. I would like to have S1-6 on the left and grouped reds, then black empty intersection, and then grouped blues.

The ComplexUpset package is very nice, but I wasn't able to get what I need either. Could someone help me please?

0

There are 0 answers