Gene intersections

lt= list(
      Alzheimers = geneids_ad, 
      Autism = geneids_asd,
      Bipolar = geneids_bd,
      Schizophrenia = geneids_scz,
      Parkinsons=geneids_pd
    )
m1 = make_comb_mat(lt, mode='intersect')
row_size = set_size(m1)

m1
## A combination matrix with 5 sets and 27 combinations.
##   ranges of combination set size: c(1, 322).
##   mode for the combination size: intersect.
##   sets are on rows.
## 
## Top 8 combination sets are:
##   Alzheimers Autism Bipolar Schizophrenia Parkinsons  code size
##            x                                         10000  322
##                                         x            00010  131
##                   x                                  01000   77
##            x                            x            10010   47
##            x      x                                  11000   24
##                   x                     x            01010   24
##                                                    x 00001   24
##                           x             x            00110   20
## 
## Sets are:
##             set size
##      Alzheimers  322
##          Autism   77
##         Bipolar   20
##   Schizophrenia  131
##      Parkinsons   24
z=UpSet(m1[comb_degree(m1) > 1], pt_size = unit(5, "mm"), lwd = 3,
    comb_col = c("red", "blue", "black", 'red')[comb_degree(m1[comb_degree(m1) > 1])])



ht = draw(z)
od = column_order(ht)
row_od = row_order(ht)

cs = comb_size(m1[comb_degree(m1) > 1])
decorate_annotation("intersection_size", {
    grid.text(cs[od], x = seq_along(cs), y = unit(cs[od], "native") + unit(2, "pt"), 
        default.units = "native", just = "bottom", gp = gpar(fontsize = 8))
})