require(data.table)
## Create gene_exp and gene_cna manually. The following shows an example
## consisting of 3 genes (BRCA2, TP53, and GNPAT) and 5 samples (A to E).
gene_exp <- data.table(
GENE = c("BRCA2", "TP53", "GNPAT"),
A = c(-0.95, 0.89, 0.21), B = c(1.72, -0.05, NA),
C = c(-1.18, 1.15, 2.47), D = c(-1.24, -0.07, 1.2),
E = c(1.01, 0.93, 1.54)
)
gene_cna <- data.table(
GENE = c("BRCA2", "TP53", "GNPAT"),
A = c(1, 1, NA), B = c(-1, -1, 1),
C = c(1, -1, 1), D = c(1, -1, -1),
E = c(0, 0, -1)
)
## Find CNA-driven genes
cna_driven_genes <- find_cna_driven_gene(
gene_cna, gene_exp, progress=FALSE
)
# Gain driven genes
cna_driven_genes$gain_driven
# Loss driven genes
cna_driven_genes$loss_driven
# Gene shown in both gain and loss records
cna_driven_genes$bothRun the code above in your browser using DataLab