Signatures

Tx = read.table(file = "Signature/Chen2.txt", row.names = NULL, header = TRUE)
Chen2 = setdiff(as.character(unique(Tx$Symbol)), "---")

Tx = read.table(file = "Signature/Lu1.txt", row.names = NULL, header = TRUE)
Lu1 = as.character(Tx$Gene)

Tx = read.table(file = "Signature/Tomida1_a.txt", row.names = NULL, header = TRUE)
Tomida1_a = as.character(Tx$Gene)
  groupColor = c("#08519c", "#ce1256", "#54278f")
  venn.plot <- draw.triple.venn(
          area1 = length(Lu1),
          area2 = length(Chen2),
          area3 = length(Tomida1_a),
          n12   = length(intersect(Lu1, Chen2)),
          n13   = length(intersect(Lu1, Tomida1_a)),
          n23   = length(intersect(Chen2, Tomida1_a)),
          n123  = length(intersect(intersect(Lu1, Chen2), Tomida1_a)),
          category = c("Lu1", "Chen2", "Tomida1_a"),
          fill = c("white", "white", "white"),
          lty  = "solid",
          lwd  = 3,
          cex  = 2,
          cat.cex = 1,
          col     = groupColor,
          cat.col = groupColor,
          euler   = TRUE)

Master regulators

source("code/MR.R")
load("Data/LungMR_GRN.RData")

Tx = read.table(file = "Signature/Tomida1_a.txt", row.names = NULL, header = TRUE)
gs = list(HihgRisk = filter(Tx, Group == "Fatal")[, "Gene"], LowRisk = filter(Tx, Group == "Favorable")[, "Gene"])
T1 = mrMulti(GEX, GRN, gs, nsample = 50)
write.table(T1, file = "out/LungGRN_Tomida1_a.txt", row.names = FALSE, col.names = TRUE, sep = "\t")

Tx = read.table(file = "Signature/Lu1.txt", row.names = NULL, header = TRUE)
gs = list(HihgRisk = filter(Tx, Risk == "HighRisk")[, "Gene"], LowRisk = filter(Tx, Risk == "LowRisk")[, "Gene"])
T2 = mrMulti(GEX, GRN, gs, nsample = 50)
write.table(T2, file = "out/LungGRN_Lu1.txt", row.names = FALSE, col.names = TRUE, sep = "\t")

Tx = read.table(file = "Signature/Chen2.txt", row.names = NULL, header = TRUE)
gs = list(HihgRisk = filter(Tx, Coef > 0)[, "Symbol"])
T3 = mrMulti(GEX, GRN, gs, nsample = 50)
write.table(T3, file = "out/LungGRN_Chen2.txt", row.names = FALSE, col.names = TRUE, sep = "\t")
T1 = read.table(file = "out/LungGRN_Chen2.txt", row.names = NULL, header = TRUE, sep = "\t")
T1$signature = "Chen2"

T2 = read.table(file = "out/LungGRN_Lu1.txt", row.names = NULL, header = TRUE, sep = "\t")
T2$signature = "Lu1"

T3 = read.table(file = "out/LungGRN_Tomida1_a.txt", row.names = NULL, header = TRUE, sep = "\t")
T3$signature = "Tomida1_a"
mTable = rbind(T1, T2, T3)

uTable = filter(mTable, p.value < 0.01, NES > 0)
x = table(uTable$Regulon, uTable$signature)
idx = rowSums(x >= 6) > 0
x = x[idx, ]
mm = as.matrix(x >= 6) + 0

venn.plot <- draw.triple.venn(
        area1 = sum(mm[,1]),
        area2 = sum(mm[,2]),
        area3 = sum(mm[,3]),
        n12   = sum(rowSums(mm[, c(1,2)]) == 2),
        n13   = sum(rowSums(mm[, c(1,3)]) == 2),
        n23   = sum(rowSums(mm[, c(2,3)]) == 2),
        n123  = sum(rowSums(mm[, c(1,2,3)]) == 3),
        category = colnames(mm),
        fill = c("white", "white", "white"),
        lty  = "solid",
        lwd  = 3,
        cex  = 2,
        cat.cex = 1,
        col     = groupColor,
        cat.col = groupColor,
        euler   = TRUE)

Examples of Master Regulators

uTable = filter(mTable, p.value < 0.01, NES > 0)
ux = as.data.frame.matrix(table(uTable$Regulon, uTable$signature)) %>% filter(Chen2 + Lu1 + Tomida1_a > 0)
write.table(ux, file = "out/EarlyStages_Summary_Activated.txt", row.names = TRUE, col.names = TRUE, sep = "\t")
filter(ux, Chen2 >=6, Lu1 >= 6, Tomida1_a >= 6)
         Chen2 Lu1 Tomida1_a
ASF1B        7   7         6
AURKA        7   7         7
AURKB        7   7         7
BUB1B        7   7         7
CCNA2        7   7         7
CENPI        6   6         6
CHEK1        7   7         7
CHEK2        6   6         6
CKS1B        7   6         7
EIF4EBP1     7   7         7
EZH2         7   7         7
FEN1         7   7         7
FOXM1        7   7         7
GTSE1        6   6         6
HMGA1        7   7         7
MCM2         7   7         6
MCM4         7   7         7
MCM7         6   6         7
MKI67        7   6         7
MYBL2        7   7         6
PSRC1        6   6         6
PTTG1        7   7         7
RACGAP1      7   7         7
RAD51        7   7         7
RANBP1       7   6         7
RFC4         7   7         7
SPAG5        7   7         7
TIMELESS     7   7         7
TRIP13       7   7         7
TTK          7   6         7
UBE2C        7   7         7
ZWINT        7   7         7
dTable = filter(mTable, p.value < 0.01, NES < 0)
dx = as.data.frame.matrix(table(dTable$Regulon, dTable$signature)) %>% filter(Chen2 + Lu1 + Tomida1_a > 0)
write.table(dx, file = "out/EarlyStages_Summary_Repressed.txt", row.names = TRUE, col.names = TRUE, sep = "\t")
filter(dx, Chen2 >=6, Lu1 >= 6, Tomida1_a >= 6)
        Chen2 Lu1 Tomida1_a
CBX7        7   6         7
CHRDL1      7   7         7
CRY2        7   6         7
CTSH        6   6         6
DPYSL2      6   7         7
FRY         6   6         6
IL11RA      7   6         6
ITGA8       7   6         7
LRRN3       6   7         7
NR3C2       6   6         6
PLA2G1B     6   7         6
RGL1        6   6         6
SORBS1      7   7         7
SPARCL1     6   6         6
TGFBR2      6   7         6
ZBTB16      7   6         6