# 3.6 - TCGA.pipe: Running ELMER for TCGA data in a compact way

# TCGA.pipe: Running ELMER for TCGA data in a compact way

`TCGA.pipe` is a function for easily downloading TCGA data from GDC using TCGAbiolinks package (Colaprico et al. 2016) and performing all the analyses in ELMER. For illustration purpose, we skip the downloading step. The user can use the `getTCGA` function to download TCGA data or use `TCGA.pipe` by including “download” in the analysis option.

The following command will do distal DNA methylation analysis and predict putative target genes, motif analysis and identify regulatory transcription factors.

    TCGA.pipe("LUSC",
              wd = "./ELMER.example",
              cores = parallel::detectCores()/2,
              mode = "unsupervised"
              permu.size = 300,
              Pe = 0.01,
              analysis = c("distal.probes","diffMeth","pair","motif","TF.search"),
              diff.dir = "hypo",
              rm.chr = paste0("chr",c("X","Y")))

TCGA.pipe: Mode argument

In this new version we added the argument `mode` in the `TCGA.pipe` function. This will automatically set the `minSubgroupFrac` to the following values:

Modes available:

- `unsupervised`:
  - Use 20% of each group to identify differently methylated regions (`minSubgroupFrac` = 0.2 in `get.diff.meth`)
  - Use 40% of all samples to create Unmethytlated (U) and Methylated (M) groups in the other steps (the lowest quintile of samples is the U group and the highest quintile samples is the M group) (`minSubgroupFrac` = 0.4 in `get.pairs` and `get.TFs` functions)
- `supervised`:
  - Use all samples in all functions and set Unmethytlated (U) and Methylated (M) one of the group selected in the analysis.

The `unsupervised` mode should be used when want to be able to detect a specific (possibly unknown) molecular subtype among tumor; these subtypes often make up only a minority of samples, and 20% was chosen as a lower bound for the purposes of statistical power. If you are using pre-defined group labels, such as treated replicates vs. untreated replicated, use `supervised` mode (all samples),

For more information please read the analysis section of the vignette.

# Using mutation data to identify groups

We add in `TCGA.pipe` function (download step) the option to identify mutant samples to perform WT vs Mutant analysis. It will download open MAF file from GDC database (Grossman et al. 2016), select a gene and identify the which are the mutant samples based on the following classification: (it can be changed using the atgument `mutant_variant_classification`).

Mutations classification

Argument | Description
--- | ---
Frame_Shift_Del | Mutant
Frame_Shift_Ins | Mutant
Missense_Mutation | Mutant
Nonsense_Mutation | Mutant
Splice_Site | Mutant
In_Frame_Del | Mutant
In_Frame_Ins | Mutant
Translation_Start_Site | Mutant
Nonstop_Mutation | Mutant
Silent | WT
3’UTR | WT
5’UTR | WT
3’Flank | WT
5’Flank | WT
IGR1 (intergenic region) | WT
Intron | WT
RNA | WT
Target_region | WT

The arguments to be used are below:

`TCGA.pipe` mutation arguments

Argument | Description
--- | ---
genes | List of genes for which mutations will be verified. A column in the MAE with the name of the gene will be created with two groups WT (tumor samples without mutation), MUT (tumor samples w/ mutation), NA (not tumor samples)
mutant_variant_classification | List of GDC variant classification from MAF files to consider a samples mutant. Only used when argument gene is set.
group.col | A column defining the groups of the sample. You can view the available columns using: colnames(MultiAssayExperiment::colData(data)).
group1 | A group from group.col. ELMER will run group1 vs group2. That means, if direction is hyper, get probes hypermethylated in group 1 compared to group 2.
group2 | A group from group.col. ELMER will run group1 vs group2. That means, if direction is hyper, get probes hypermethylated in group 1 compared to group 2.

Here is an example we TCGA-LUSC data is downloaded and we will compare TP53 Mutant vs TP53 WT samples.

    TCGA.pipe("LUSC",
              wd = "./ELMER.example",
              cores = parallel::detectCores()/2,
              mode = "supervised"
              genes = "TP53",
              group.col = "TP53",
              group1 = "Mutant",
              group2 = "WT",
              permu.size = 300,
              Pe = 0.01,
              analysis = c("download","diffMeth","pair","motif","TF.search"),
              diff.dir = "hypo",
              rm.chr = paste0("chr",c("X","Y")))

# Session Info

    sessionInfo()

    ## R version 4.5.2 (2025-10-31)
    ## Platform: x86_64-pc-linux-gnu
    ## Running under: Ubuntu 24.04.3 LTS
    ##
    ## Matrix products: default
    ## BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
    ## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0
    ##
    ## locale:
    ##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
    ##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C
    ##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
    ##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
    ##  [9] LC_ADDRESS=C               LC_TELEPHONE=C
    ## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
    ##
    ## time zone: Etc/UTC
    ## tzcode source: system (glibc)
    ##
    ## attached base packages:
    ## [1] stats4    stats     graphics  grDevices utils     datasets  methods
    ## [8] base
    ##
    ## other attached packages:
    ##  [1] MultiAssayExperiment_1.36.1 SummarizedExperiment_1.40.0
    ##  [3] Biobase_2.70.0              MatrixGenerics_1.22.0
    ##  [5] matrixStats_1.5.0           GenomicRanges_1.62.1
    ##  [7] Seqinfo_1.0.0               IRanges_2.44.0
    ##  [9] S4Vectors_0.48.0            sesameData_1.28.0
    ## [11] ExperimentHub_3.0.0         AnnotationHub_4.0.0
    ## [13] BiocFileCache_3.0.0         dbplyr_2.5.1
    ## [15] BiocGenerics_0.56.0         generics_0.1.4
    ## [17] BiocStyle_2.38.0            dplyr_1.2.0
    ## [19] DT_0.34.0                   ELMER_2.34.2
    ## [21] ELMER.data_2.34.0
    ##
    ## loaded via a namespace (and not attached):
    ##   [1] BiocIO_1.20.0               bitops_1.0-9
    ##   [3] filelock_1.0.3              tibble_3.3.1
    ##   [5] XML_3.99-0.20               rpart_4.1.24
    ##   [7] lifecycle_1.0.5             httr2_1.2.2
    ##   [9] rstatix_0.7.3               doParallel_1.0.17
    ##  [11] vroom_1.7.0                 lattice_0.22-7
    ##  [13] ensembldb_2.34.0            crosstalk_1.2.2
    ##  [15] backports_1.5.0             magrittr_2.0.4
    ##  [17] Hmisc_5.2-5                 plotly_4.12.0
    ##  [19] sass_0.4.10                 rmarkdown_2.30
    ##  [21] jquerylib_0.1.4             yaml_2.3.12
    ##  [23] otel_0.2.0                  Gviz_1.54.0
    ##  [25] DBI_1.2.3                   buildtools_1.0.0
    ##  [27] RColorBrewer_1.1-3          abind_1.4-8
    ##  [29] rvest_1.0.5                 purrr_1.2.1
    ##  [31] AnnotationFilter_1.34.0     biovizBase_1.58.0
    ##  [33] RCurl_1.98-1.17             nnet_7.3-20
    ##  [35] VariantAnnotation_1.56.0    rappdirs_0.3.4
    ##  [37] circlize_0.4.17             ggrepel_0.9.6
    ##  [39] maketools_1.3.2             codetools_0.2-20
    ##  [41] DelayedArray_0.36.0         xml2_1.5.2
    ##  [43] tidyselect_1.2.1            shape_1.4.6.1
    ##  [45] UCSC.utils_1.6.1            farver_2.1.2
    ##  [47] TCGAbiolinksGUI.data_1.30.0 base64enc_0.1-6
    ##  [49] GenomicAlignments_1.46.0    jsonlite_2.0.0
    ##  [51] GetoptLong_1.1.0            Formula_1.2-5
    ##  [53] iterators_1.0.14            foreach_1.5.2
    ##  [55] tools_4.5.2                 progress_1.2.3
    ##  [57] Rcpp_1.1.1                  glue_1.8.0
    ##  [59] gridExtra_2.3               SparseArray_1.10.8
    ##  [61] BiocBaseUtils_1.12.0        xfun_0.56
    ##  [63] GenomeInfoDb_1.46.2         withr_3.0.2
    ##  [65] BiocManager_1.30.27         fastmap_1.2.0
    ##  [67] latticeExtra_0.6-31         digest_0.6.39
    ##  [69] R6_2.6.1                    colorspace_2.1-2
    ##  [71] jpeg_0.1-11                 dichromat_2.0-0.1
    ##  [73] biomaRt_2.66.0              RSQLite_2.4.5
    ##  [75] cigarillo_1.0.0             tidyr_1.3.2
    ##  [77] data.table_1.18.2.1         rtracklayer_1.70.1
    ##  [79] prettyunits_1.2.0           httr_1.4.7
    ##  [81] htmlwidgets_1.6.4           S4Arrays_1.10.1
    ##  [83] pkgconfig_2.0.3             gtable_0.3.6
    ##  [85] blob_1.3.0                  ComplexHeatmap_2.26.1
    ##  [87] S7_0.2.1                    XVector_0.50.0
    ##  [89] sys_3.4.3                   htmltools_0.5.9
    ##  [91] carData_3.0-6               ProtGenerics_1.42.0
    ##  [93] clue_0.3-66                 scales_1.4.0
    ##  [95] png_0.1-8                   knitr_1.51
    ##  [97] rstudioapi_0.18.0           tzdb_0.5.0
    ##  [99] reshape2_1.4.5              rjson_0.2.23
    ## [101] checkmate_2.3.4             curl_7.0.0
    ## [103] cachem_1.1.0                GlobalOptions_0.1.3
    ## [105] stringr_1.6.0               BiocVersion_3.22.0
    ## [107] parallel_4.5.2              foreign_0.8-91
    ## [109] AnnotationDbi_1.72.0        restfulr_0.0.16
    ## [111] pillar_1.11.1               grid_4.5.2
    ## [113] reshape_0.8.10              vctrs_0.7.1
    ## [115] ggpubr_0.6.2                car_3.1-5
    ## [117] cluster_2.1.8.1             htmlTable_2.4.3
    ## [119] evaluate_1.0.5              TCGAbiolinks_2.38.0
    ## [121] readr_2.1.6                 GenomicFeatures_1.62.0
    ## [123] cli_3.6.5                   compiler_4.5.2
    ## [125] Rsamtools_2.26.0            rlang_1.1.7
    ## [127] crayon_1.5.3                ggsignif_0.6.4
    ## [129] labeling_0.4.3              interp_1.1-6
    ## [131] plyr_1.8.9                  stringi_1.8.7
    ## [133] viridisLite_0.4.3           deldir_2.0-4
    ## [135] BiocParallel_1.44.0         Biostrings_2.78.0
    ## [137] lazyeval_0.2.2              Matrix_1.7-4
    ## [139] BSgenome_1.78.0             hms_1.1.4
    ## [141] bit64_4.6.0-1               ggplot2_4.0.2
    ## [143] KEGGREST_1.50.0             broom_1.0.12
    ## [145] memoise_2.0.1               bslib_0.10.0
    ## [147] bit_4.6.0                   downloader_0.4.1

# Bibliography

Colaprico, Antonio, Tiago C. Silva, Catharina Olsen, Luciano Garofano, Claudia Cava, Davide Garolini, Thais S. Sabedot, et al. 2016. “TCGAbiolinks: An r/Bioconductor Package for Integrative Analysis of TCGA Data.” Nucleic Acids Research 44 (8): e71. https://doi.org/10.1093/nar/gkv1507.
Grossman, Robert L et al. 2016. “Toward a Shared Vision for Cancer Genomic Data.” New England Journal of Medicine 375 (12): 1109–12.