Skip to content

Instantly share code, notes, and snippets.

@tiagochst
Created July 17, 2017 23:37
Show Gist options
  • Save tiagochst/8d7a8f32ef53e462f40535187b921420 to your computer and use it in GitHub Desktop.
Save tiagochst/8d7a8f32ef53e462f40535187b921420 to your computer and use it in GitHub Desktop.
# Section 1
library("Bioc2017.TCGAbiolinks.ELMER")
library(TCGAbiolinks)
library(SummarizedExperiment)
library(DT)
library(dplyr)
query.exp <- GDCquery(project = "TCGA-LUSC",
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "HTSeq - FPKM-UQ",
barcode = c("TCGA-34-5231-01","TCGA-77-7138-01"))
GDCdownload(query.exp)
exp <- GDCprepare(query = query.exp,
save = TRUE,
save.filename = "Exp_LUSC.rda",
summarizedExperiment = TRUE)
query.met <- GDCquery(project = "TCGA-LUSC",
data.category = "DNA Methylation",
platform = "Illumina Human Methylation 450",
barcode = c("TCGA-34-5231-01A-21D-1818-05","TCGA-77-7138-01A-41D-2043-05"))
GDCdownload(query.met)
met <- GDCprepare(query = query.met,
save = TRUE,
save.filename = "DNAmethylation_LUSC.rda",
summarizedExperiment = TRUE)
# Section 2
library("Bioc2017.TCGAbiolinks.ELMER")
library(MultiAssayExperiment)
library(ELMER)
lusc.exp
lusc.met
distal.probes <- get.feature.probe(genome = "hg38", met.platform = "450K")
mae <- createMAE(exp = lusc.exp,
met = lusc.met,
save = TRUE,
linearize.exp = TRUE,
filter.probes = distal.probes,
save.filename = "mae_bioc2017.rda",
met.platform = "450K",
genome = "hg19",
TCGA = TRUE)
mae
colData(mae)[1:5,] %>% as.data.frame %>% datatable(options = list(scrollX = TRUE))
sampleMap(mae)[1:5,] %>% as.data.frame %>% datatable(options = list(scrollX = TRUE))
sig.diff <- get.diff.meth(data = mae,
group.col = "definition",
group1 = "Primary solid Tumor",
group2 = "Solid Tissue Normal",
minSubgroupFrac = 0.2,
sig.dif = 0.3,
diff.dir = "hypo", # Search for hypomethylated probes in group 1
cores = 1,
dir.out ="result",
pvalue = 0.01)
nearGenes <- GetNearGenes(data = mae,
probes = sig.diff$probe,
numFlankingGenes = 20, # 10 upstream and 10 dowstream genes
cores = 1)
Hypo.pair <- get.pair(data = mae,
group.col = "definition",
group1 = "Primary solid Tumor",
group2 = "Solid Tissue Normal",
nearGenes = nearGenes,
minSubgroupFrac = 0.4, # % of samples to use in to create groups U/M
permu.dir = "result/permu",
permu.size = 100, # Please set to 100000 to get significant results
pvalue = 0.05,
Pe = 0.01, # Please set to 0.001 to get significant results
filter.probes = TRUE, # See preAssociationProbeFiltering function
filter.percentage = 0.05,
filter.portion = 0.3,
dir.out = "result",
cores = 1,
label = "hypo")
enriched.motif <- get.enriched.motif(data = mae,
probes = Hypo.pair$Probe,
dir.out = "result",
label = "hypo",
min.incidence = 10,
lower.OR = 1.1)
names(enriched.motif) # enriched motifs
head(enriched.motif["P73_HUMAN.H10MO.A"]) ## probes in the given set that have TP53 motif.
## identify regulatory TF for the enriched motifs
TF <- get.TFs(data = mae,
group.col = "definition",
group1 = "Primary solid Tumor",
group2 = "Solid Tissue Normal",
minSubgroupFrac = 0.4,
enriched.motif = enriched.motif,
dir.out = "result",
cores = 1,
label = "hypo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment