This is an example of a Venn diagram using R package {VennDiagram}. Metabolomics peaks identified from different filtering criteria were compared.
ever <- colnames ( readRDS ( 'data/metabolome_7080peaks.rds' )) |
incid <- colnames ( readRDS ( 'data/metabolome_7098peaks.rds' )) |
cur <- colnames ( readRDS ( 'data/metabolome_7109peaks.rds' )) |
onset <- colnames ( readRDS ( 'data/metabolome_7150peaks.rds' )) |
lc <- colnames ( readRDS ( 'data/metabolome_7300peaks.rds' )) |
n.ever.incid <- sum (ever % in % incid) |
n.ever.cur <- sum (ever % in % cur) |
n.ever.onset <- sum (ever % in % onset) |
n.ever.lc <- sum (ever % in % lc) |
n.incid.cur <- sum (incid % in % cur) |
n.incid.onset <- sum (incid % in % onset) |
n.incid.lc <- sum (incid % in % lc) |
n.cur.onset <- sum (cur % in % onset) |
n.cur.lc <- sum (cur % in % lc) |
n.onset.lc <- sum (onset % in % lc) |
n.ever.incid.cur <- sum (ever % in % incid & ever % in % cur) |
n.ever.incid.onset <- sum (ever % in % incid & ever % in % onset) |
n.ever.incid.lc <- sum (ever % in % incid & ever % in % lc) |
n.ever.cur.onset <- sum (ever % in % cur & ever % in % onset) |
n.ever.cur.lc <- sum (ever % in % cur & ever % in % lc) |
n.ever.onset.lc <- sum (ever % in % onset & ever % in % lc) |
n.incid.cur.onset <- sum (incid % in % cur & incid % in % onset) |
n.incid.cur.lc <- sum (incid % in % cur & incid % in % lc) |
n.incid.onset.lc <- sum (incid % in % onset & incid % in % lc) |
n.cur.onset.lc <- sum (cur % in % onset & cur % in % lc) |
n.ever.incid.cur.onset <- sum (ever % in % incid & ever % in % cur & ever % in % onset) |
n.ever.incid.cur.lc <- sum (ever % in % incid & ever % in % cur & ever % in % lc) |
n.ever.incid.onset.lc <- sum (ever % in % incid & ever % in % onset & ever % in % lc) |
n.ever.cur.onset.lc <- sum (ever % in % cur & ever % in % onset & ever % in % lc) |
n.incid.cur.onset.lc <- sum (incid % in % cur & incid % in % onset & incid % in % lc) |
n.ever.incid.cur.onset.lc <- |
sum (ever % in % incid & ever % in % cur & ever % in % onset & ever % in % lc) |
png ( 'results/descriptive_analyses/venn_diagram_5sets.png' , |
height = 1600, width = 1600, res = 200) |
area1 = n.ever, area2 = n.incid, area3 = n.cur, area4 = n.onset, area5 = n.lc, |
n12 = n.ever.incid, n13 = n.ever.cur, n14 = n.ever.onset, n15 = n.ever.lc, |
n23 = n.incid.cur, n24 = n.incid.onset, n25 = n.incid.lc, |
n34 = n.cur.onset, n35 = n.cur.lc, n45 = n.onset.lc, |
n123 = n.ever.incid.cur, n124 = n.ever.incid.onset, n125 = n.ever.incid.lc, |
n134 = n.ever.cur.onset, n135 = n.ever.cur.lc, n145 = n.ever.onset.lc, |
n234 = n.incid.cur.onset, n235 = n.incid.cur.lc, n245 = n.incid.onset.lc, |
n1234 = n.ever.incid.cur.onset, n1235 = n.ever.incid.cur.lc, |
n1245 = n.ever.incid.onset.lc, n1345 = n.ever.cur.onset.lc, |
n2345 = n.incid.cur.onset.lc, n12345 = n.ever.incid.cur.onset.lc, |
category = c ( 'ever asthma' , 'incident asthma' , 'current asthma' , |
'age of onset' , 'LCA-derived classes' ), |
fill = c ( 'dodgerblue' , 'goldenrod1' , 'darkorange1' , 'seagreen3' , 'orchid3' ), |
alpha = rep (0.5, 5), fontfamily = 'sans' , |
cat.fontfamily = 'sans' , scaled = FALSE , |
cat.pos = c (0,0,180,180,0), cat.dist = c (0.18, 0.2, 0.15, 0.17, 0.2)) |