forked from BioinformaticsFMRP/TCGAbiolinks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tcgaBiolinks.Rmd
executable file
·2596 lines (2165 loc) · 115 KB
/
tcgaBiolinks.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Working with TCGAbiolinks package"
author: "Antonio Colaprico, Tiago Chedraoui Silva, Luciano Garofano,
Catharina Olsen, Davide Garolini, Claudia Cava, Isabella Castiglioni,
Thais Sarraf Sabedot, Tathiane Maistro Malta, Stefano Pagnotta, Michele Ceccarelli,
Gianluca Bontempi, Houtan Noushmehr"
date: "`r Sys.Date()`"
output:
BiocStyle::html_document:
toc: true
number_sections: false
toc_depth: 2
highlight: haddock
references:
- id: ref1
title: Orchestrating high-throughput genomic analysis with Bioconductor
author:
- family: Huber, Wolfgang and Carey, Vincent J and Gentleman, Robert and Anders, Simon and Carlson, Marc and Carvalho, Benilton S and Bravo, Hector Corrada and Davis, Sean and Gatto, Laurent and Girke, Thomas and others
given:
journal: Nature methods
volume: 12
number: 2
pages: 115-121
issued:
year: 2015
- id: ref2
title: GC-content normalization for RNA-Seq data
author:
- family: Risso, Davide and Schwartz, Katja and Sherlock, Gavin and Dudoit, Sandrine
given:
journal: BMC bioinformatics
volume: 12
number: 1
pages: 480
issued:
year: 2011
- id: ref3
title: Evaluation of statistical methods for normalization and differential expression in mRNA-Seq experiments
author:
- family: Bullard, James H and Purdom, Elizabeth and Hansen, Kasper D and Dudoit, Sandrine
given:
journal: BMC bioinformatics
volume: 11
number: 1
pages: 94
issued:
year: 2010
- id: ref4
title: Inferring regulatory element landscapes and transcription factor networks from cancer methylomes
author:
- family: Yao, L., Shen, H., Laird, P. W., Farnham, P. J., & Berman, B. P.
given:
journal: Genome biology
volume: 16
number: 1
pages: 105
issued:
year: 2015
- id: ref5
title: Evaluation of statistical methods for normalization and differential expression in mRNA-Seq experiments
author:
- family: James H Bullard, Elizabeth Purdom, Kasper D Hansen and Sandrine Dudoit
given:
journal: BMC Bioinformatics
volume: 11
number: 1
pages: 94
issued:
year: 2010
- id: ref6
title: GC-content normalization for RNA-Seq data
author:
- family: Risso, D., Schwartz, K., Sherlock, G., & Dudoit, S.
given:
journal: BMC Bioinformatics
volume: 12
number: 1
pages: 480
issued:
year: 2011
- id: ref7
title: Identification of a CpG island methylator phenotype that defines a distinct subgroup of glioma
author:
- family: Noushmehr, H., Weisenberger, D.J., Diefes, K., Phillips, H.S., Pujara, K., Berman, B.P., Pan, F., Pelloski, C.E., Sulman, E.P., Bhat, K.P. et al.
given:
journal: Cancer cell
volume: 17
number: 5
pages: 510-522
issued:
year: 2010
- id: ref8
title: Molecular Profiling Reveals Biologically Discrete Subsets and Pathways of Progression in Diffuse Glioma
author:
- family: Ceccarelli, Michele and Barthel, Floris P and Malta, Tathiane M and Sabedot, Thais S and Salama, Sofie R and Murray, Bradley A and Morozova, Olena and Newton, Yulia and Radenbaugh, Amie and Pagnotta, Stefano M and others
given:
journal: Cell
URL: "http://doi.org/10.1016/j.cell.2015.12.028"
DOI: "10.1016/j.cell.2015.12.028"
volume: 164
number: 3
pages: 550-563
issued:
year: 2016
- id: ref9
title: Comprehensive molecular profiling of lung adenocarcinoma
author:
- family: Cancer Genome Atlas Research Network and others
given:
journal: Nature
URL: "http://doi.org/10.1038/nature13385"
DOI: "10.1038/nature13385"
volume: 511
number: 7511
pages: 543-550
issued:
year: 2014
- id: ref10
title: Comprehensive molecular characterization of gastric adenocarcinoma
author:
- family: Cancer Genome Atlas Research Network and others
given:
journal: Nature
URL: "http://doi.org/10.1038/nature13480"
DOI: "10.1038/nature13480"
issued:
year: 2014
- id: ref11
title: Comprehensive molecular portraits of human breast tumours
author:
- family: Cancer Genome Atlas Research Network and others
given:
journal: Nature
URL: "http://doi.org/10.1038/nature11412"
DOI: "10.1038/nature11412"
volume: 490
number: 7418
pages: 61-70
issued:
year: 2012
- id: ref12
title: Comprehensive molecular characterization of human colon and rectal cancer
author:
- family: Cancer Genome Atlas Research Network and others
given:
journal: Nature
URL: "http://doi.org/10.1038/nature11252"
DOI: "10.1038/nature11252"
volume: 487
number: 7407
pages: 330-337
issued:
year: 2012
- id: ref13
title: Genomic classification of cutaneous melanoma
author:
- family: Cancer Genome Atlas Research Network and others
given:
journal: Cell
URL: "http://doi.org/10.1016/j.cell.2015.05.044"
DOI: "10.1016/j.cell.2015.05.044"
volume: 161
number: 7
pages: 1681-1696
issued:
year: 2015
- id: ref14
title: Comprehensive genomic characterization of head and neck squamous cell carcinomas
author:
- family: Cancer Genome Atlas Research Network and others
given:
journal: Nature
URL: "http://doi.org/10.1038/nature14129"
DOI: "10.1038/nature14129"
volume: 517
number: 7536
pages: 576-582
issued:
year: 2015
- id: ref15
title: The somatic genomic landscape of chromophobe renal cell carcinoma
author:
- family: Davis, Caleb F and Ricketts, Christopher J and Wang, Min and Yang, Lixing and Cherniack, Andrew D and Shen, Hui and Buhay, Christian and Kang, Hyojin and Kim, Sang Cheol and Fahey, Catherine C and others
given:
journal: Cancer Cell
URL: "http://doi.org/10.1016/j.ccr.2014.07.014"
DOI: "10.1016/j.ccr.2014.07.014"
volume: 26
number: 3
pages: 319-330
issued:
year: 2014
- id: ref16
title: Comprehensive genomic characterization of squamous cell lung cancers
author:
- family: Cancer Genome Atlas Research Network and others
given:
journal: Nature
URL: "http://doi.org/10.1038/nature11404"
DOI: "10.1038/nature11404"
volume: 489
number: 7417
pages: 519-525
issued:
year: 2012
- id: ref17
title: Integrated genomic characterization of endometrial carcinoma
author:
- family: Cancer Genome Atlas Research Network and others
given:
journal: Nature
URL: "http://doi.org/10.1038/nature12113"
DOI: "10.1038/nature12113"
volume: 497
number: 7447
pages: 67-73
issued:
year: 2013
- id: ref18
title: Integrated genomic characterization of papillary thyroid carcinoma
author:
- family: Cancer Genome Atlas Research Network and others
given:
journal: Cell
URL: "http://doi.org/10.1016/j.cell.2014.09.050"
DOI: "10.1016/j.cell.2014.09.050"
volume: 159
number: 3
pages: 676-690
issued:
year: 2014
- id: ref19
title: The molecular taxonomy of primary prostate cancer
author:
- family: Cancer Genome Atlas Research Network and others
given:
journal: Cell
URL: "http://doi.org/10.1016/j.cell.2015.10.025"
DOI: "10.1016/j.cell.2015.10.025"
volume: 163
number: 4
pages: 1011-1025
issued:
year: 2015
- id: ref20
title: Comprehensive Molecular Characterization of Papillary Renal-Cell Carcinoma
author:
- family: Linehan, W Marston and Spellman, Paul T and Ricketts, Christopher J and Creighton, Chad J and Fei, Suzanne S and Davis, Caleb and Wheeler, David A and Murray, Bradley A and Schmidt, Laura and Vocke, Cathy D and others
given:
journal: NEW ENGLAND JOURNAL OF MEDICINE
URL: "http://doi.org/10.1056/NEJMoa1505917"
DOI: "10.1056/NEJMoa1505917"
volume: 374
number: 2
pages: 135-145
issued:
year: 2016
- id: ref21
title: Comprehensive molecular characterization of clear cell renal cell carcinoma
author:
- family: Cancer Genome Atlas Research Network and others
given:
journal: Nature
URL: "http://doi.org/10.1038/nature12222"
DOI: "10.1038/nature12222"
volume: 499
number: 7456
pages: 43-49
issued:
year: 2013
- id: ref22
title: Comprehensive Pan-Genomic Characterization of Adrenocortical Carcinoma
author:
- family: Cancer Genome Atlas Research Network and others
given:
journal: Cancer Cell
URL: "http://dx.doi.org/10.1016/j.ccell.2016.04.002"
DOI: "10.1016/j.ccell.2016.04.002"
volume: 29
pages: 43-49
issued:
year: 2016
- id: ref23
title: Complex heatmaps reveal patterns and correlations in multidimensional genomic data
author:
- family: Gu, Zuguang and Eils, Roland and Schlesner, Matthias
given:
journal: Bioinformatics
URL: "http://dx.doi.org/10.1016/j.ccell.2016.04.002"
DOI: "10.1016/j.ccell.2016.04.002"
pages: "btw313"
issued:
year: 2016
- id: ref24
title: "TCGA Workflow: Analyze cancer genomics and epigenomics data using Bioconductor packages"
author:
- family: Silva, TC and Colaprico, A and Olsen, C and D'Angelo, F and Bontempi, G and Ceccarelli, M and Noushmehr, H
given:
journal: F1000Research
URL: "http://dx.doi.org/10.12688/f1000research.8923.1"
DOI: "10.12688/f1000research.8923.1"
volume: 5
number: 1542
issued:
year: 2016
- id: ref25
title: "TCGAbiolinks: an R/Bioconductor package for integrative analysis of TCGA data"
author:
- family: Colaprico, Antonio and Silva, Tiago C. and Olsen, Catharina and Garofano, Luciano and Cava, Claudia and Garolini, Davide and Sabedot, Thais S. and Malta, Tathiane M. and Pagnotta, Stefano M. and Castiglioni, Isabella and Ceccarelli, Michele and Bontempi, Gianluca and Noushmehr, Houtan
given:
journal: Nucleic Acids Research
URL: "http://dx.doi.org/10.1093/nar/gkv1507"
DOI: "10.1093/nar/gkv1507"
volume: 44
number: 8
pages: e71
issued:
year: 2016
vignette: >
%\VignetteIndexEntry{Working with TCGAbiolinks package}
%\VignetteEngine{knitr::rmarkdown}
\usepackage[utf8]{inputenc}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(dpi = 300)
knitr::opts_chunk$set(cache=FALSE)
```
```{r, echo = FALSE,hide=TRUE, message=FALSE,warning=FALSE}
devtools::load_all(".")
```
## Updates
Recently the TCGA data has been moved from the DCC server to
The National Cancer Institute (NCI) Genomic Data Commons (GDC) Data Portal
In this version of the package, we rewrote all the functions that were acessing
the old TCGA server to GDC.
The GDC, which receives, processes, harmonizes, and distributes clinical, biospecimen, and genomic data from multiple cancer research programs, has data from the following programs:
* The Cancer Genome Atlas (TCGA)
* Therapeutically Applicable Research to Generate Effective Treatments (TARGET)
* the Cancer Genome Characterization Initiative (CGCI)
The big change is that the GDC data is harmonized against GRCh38. However, not all
data has been harmonized yet. The old TCGA data can be acessed through GDC legacy Archive,
in which the majority of data can be found.
More information about the project can be found in [GCD FAQS](https://gdc.nci.nih.gov/about-gdc/gdc-faqs)
The functions `TCGAquery`, `TCGAdownload`, `TCGAPrepare`, `TCGAquery_maf`,
`TCGAquery_clinical`, were replaced by
`GDCquery`, `GDCdownload`, `GDCprepare`, `GDCquery_maf`, `GDCquery_clinical`.
And it can acess both the GDC and GDC Legacy Archive.
Note: Not all the examples in this vignette were updated.
## Introduction
Motivation: The Cancer Genome Atlas (TCGA) provides us with an enormous collection of data sets,
not only spanning a large number of cancers but also a large number of experimental platforms.
Even though the data can be accessed and downloaded from the database, the possibility to analyse
these downloaded data directly in one single R package has not yet been available.
TCGAbiolinks consists of three parts or levels. Firstly, we provide different options to query and
download from TCGA relevant data from all currently platforms and their subsequent pre-processing
for commonly used bio-informatics (tools) packages in Bioconductor or CRAN. Secondly, the package
allows to integrate different data types and it can be used for different types of analyses dealing
with all platforms such as diff.expression, network inference or survival analysis, etc, and then
it allows to visualize the obtained results. Thirdly we added a social level where a researcher
can found a similar intereset in a bioinformatic community, and allows both to find a validation
of results in literature in pubmed and also to retrieve questions and answers from site such as
support.bioconductor.org, biostars.org, stackoverflow,etc.
This document describes how to search, download and analyze TCGA data using the
`TCGAbiolinks` package.
## Installation
To install use the code below.
```{r, eval = FALSE}
source("https://bioconductor.org/biocLite.R")
biocLite("TCGAbiolinks")
```
## Citation
Please cite TCGAbiolinks package:
* "TCGAbiolinks: an R/Bioconductor package for integrative analysis of TCGA data." Nucleic acids research (2015): [gkv1507](http://dx.doi.org/doi:10.1093/nar/gkv1507). [@ref25]
Related publications to this package:
* "TCGA Workflow: Analyze cancer genomics and epigenomics data using Bioconductor packages". F1000Research [10.12688/f1000research.8923.1](http://dx.doi.org/doi:10.12688/f1000research.8923.1) [@ref24]
Also, if you have used ELMER analysis please cite:
* Yao, L., Shen, H., Laird, P. W., Farnham, P. J., & Berman, B. P. "Inferring regulatory element landscapes and transcription factor networks from cancer methylomes." Genome Biol 16 (2015): 105.
* Yao, Lijing, Benjamin P. Berman, and Peggy J. Farnham. "Demystifying the secret mission of enhancers: linking distal regulatory elements to target genes." Critical reviews in biochemistry and molecular biology 50.6 (2015): 550-573.
# `GDCquery`: Searching TCGA open-access data
## `GDCquery`: Searching GDC data for download
You can easily search GDC data using the `GDCquery` function.
Using a summary of filters as used in the TCGA portal, the function works
with the following arguments:
* **project** A valid project (see table below)
* **data.category** A valid project (see list with getProjectSummary(project))
* **data.type** A data type to filter the files to download
* **sample.type** A sample type to filter the files to download (See table below)
* **workflow.type** GDC workflow type
* **barcode** A list of barcodes to filter the files to download
* **legacy** Search in the legacy repository? Default: FALSE
* **platform** Experimental data platform (HumanMethylation450, AgilentG4502A_07 etc). Used only for legacy repository
* **file.type** A string to filter files, based on its names. Used only for legacy repository
The next subsections will detail each of the search arguments.
Below, we show some search examples:
```{r, eval = FALSE}
#---------------------------------------------------------------
# For available entries and combinations please se table below
#---------------------------------------------------------------
# Gene expression aligned against Hg38
query <- GDCquery(project = "TARGET-AML",
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "HTSeq - Counts")
# Using sample type to get only Primary solid Tumor samples and Solid Tissue Normal
query.mirna <- GDCquery(project = "TCGA-ACC",
data.category = "Transcriptome Profiling",
data.type = "miRNA Expression Quantification",
sample.type = c("Primary solid Tumor","Solid Tissue Normal"))
# Example Using legacy to accessing hg19 and filtering by barcode
query <- GDCquery(project = "TCGA-GBM",
data.category = "DNA methylation",
platform = "Illumina Human Methylation 27",
legacy = TRUE,
barcode = c("TCGA-02-0047-01A-01D-0186-05","TCGA-06-2559-01A-01D-0788-05"))
# Gene expression aligned against hg19.
query.exp.hg19 <- GDCquery(project = "TCGA-GBM",
data.category = "Gene expression",
data.type = "Gene expression quantification",
platform = "Illumina HiSeq",
file.type = "normalized_results",
experimental.strategy = "RNA-Seq",
barcode = c("TCGA-14-0736-02A-01R-2005-01", "TCGA-06-0211-02A-02R-2005-01"),
legacy = TRUE)
# Searching idat file for DNA methylation
query <- GDCquery(project = "TCGA-OV",
data.category = "Raw microarray data",
data.type = "Raw intensities",
experimental.strategy = "Methylation array",
legacy = TRUE,
file.type = ".idat",
platform = "Illumina Human Methylation 450")
```
The list of projects is below:
```{r, eval = TRUE, echo = FALSE}
knitr::kable(getGDCprojects(), digits = 2,
caption = "List of projects",row.names = FALSE)
```
The list of sample.type is below:
```{r, eval = TRUE, echo = FALSE}
knitr::kable(getBarcodeDefinition(), digits = 2,
caption = "List sample types",row.names = FALSE)
```
The other fields (data.category, data.type, workflow.type, platform, file.type) can be found below.
Please, not that these tables are still incomplete.
## Harmonized data
| data.category | data.type | workflow.type | platform |
|-----------------------------|-----------------------------------|-----------------|----------|
| Transcriptome Profiling | Gene Expression Quantification | HTSeq - Counts | |
| | | HTSeq - FPKM-UQ | |
| | | HTSeq - FPKM | |
| | Isoform Expression Quantification | - | |
| | miRNA Expression Quantification | - | |
| Copy Number Variation | Copy Number Segment | | |
| | Masked Copy Number Segment | | |
| Simple Nucleotide Variation | | | |
| Raw Sequencing Data | | | |
| Biospecimen | | | |
| Clinical | | | |
| DNA Methylation | | | Illumina Human Methylation 450|
| | | | Illumina Human Methylation 27 |
## Legacy data
| data.category | data.type | platform | file.type |
|-----------------------------|-----------------------------------|-------------------------------------|--------------------|
| Copy number variation | - | Affymetrix SNP Array 6.0 | nocnv_hg18.seg |
| | - | Affymetrix SNP Array 6.0 | hg18.seg |
| | - | Affymetrix SNP Array 6.0 | nocnv_hg19.seg |
| | - | Affymetrix SNP Array 6.0 | hg19.seg |
| | - | Illumina HiSeq | - |
| Simple nucleotide variation | | | |
| Raw sequencing data | | | |
| Biospecimen | | | |
| Clinical | | | |
| Protein expression | | MDA RPPA Core | - |
| Gene expression | Gene expression quantification | Illumina HiSeq | normalized_results |
| | | Illumina HiSeq | results |
| | | HT_HG-U133A | - |
| | | AgilentG4502A_07_2 | - |
| | | AgilentG4502A_07_1 | - |
| | | HuEx-1_0-st-v2 | FIRMA.txt |
| | | | gene.txt |
| | Isoform expression quantification | | |
| | miRNA gene quantification | | hg19.mirna |
| | | | mirna |
| | Exon junction quantification | | |
| | Exon quantification | | |
| | miRNA isoform quantification | | hg19.isoform |
| | | | isoform |
| DNA methylation | | Illumina Human Methylation 450 | - |
| | | Illumina Human Methylation 27 | - |
| | | Illumina DNA Methylation OMA003 CPI | - |
| | | Illumina DNA Methylation OMA002 CPI | - |
| | | Illumina Hi Seq | |
| Raw microarray data | Raw intensities | Illumina Human Methylation 450 | idat |
| | | Illumina Human Methylation 27 | idat |
| Other | | | |
## `GDCquery_maf`: Working with mutation files.
In order to download the Mutation Annotation Format (MAF), we provide the user
with the `GDCquery_maf` function. Briefly, it will get the open acess maf files from
[https://gdc-docs.nci.nih.gov/Data/Release_Notes/Data_Release_Notes/](https://gdc-docs.nci.nih.gov/Data/Release_Notes/Data_Release_Notes/).
Four separate variant calling pipelines are implemented for GDC data harmonization which are described [here](https://gdc-docs.nci.nih.gov/Data/Bioinformatics_Pipelines/DNA_Seq_Variant_Calling_Pipeline/)
The arguments that will be used to filter the data are:
* tumor: A TCGA project without the TCGA- prefix.
* save.csv: Save the maf as csv file
* pipelines: Four separate variant calling pipelines are implemented for GDC data harmonization. Options: muse, varscan2, somaticsniper, mutect.
```{r, eval = FALSE}
acc.muse.maf <- GDCquery_Maf("ACC", pipelines = "muse")
acc.varscan2.maf <- GDCquery_Maf("ACC", pipelines = "varscan2")
acc.somaticsniper.maf <- GDCquery_Maf("ACC", pipelines = "somaticsniper")
acc.mutect.maf <- GDCquery_Maf("ACC", pipelines = "mutect")
```
This mutation data can be visualized through a oncoprint from the [ComplexHeatmap](http://bioconductor.org/packages/ComplexHeatmap/) package [@ref23].
```{r, eval=FALSE, message=FALSE, warning=FALSE}
mut <- GDCquery_Maf("ACC", pipelines = "muse")
clin <- GDCquery_clinic("TCGA-ACC","clinical")
clin <- clin[,c("bcr_patient_barcode","disease","gender","tumor_stage","race","vital_status")]
TCGAvisualize_oncoprint(mut = mut, genes = mut$Hugo_Symbol[1:20],
filename = "oncoprint.pdf",
annotation = clin,
color=c("background"="#CCCCCC","DEL"="purple","INS"="yellow","SNP"="brown"),
rows.font.size=10,
width = 5,
heatmap.legend.side = "right",
dist.col = 0,
label.font.size = 10)
```
```{r, fig.width=6, fig.height=4, echo=FALSE, fig.align="center"}
library(png)
library(grid)
img <- readPNG("oncoprint.png")
grid.raster(img)
```
## `GDCquery_clinic` and `GDCprepare_clinic`: Working with clinical data.
In GDC database the clinical data can be retrieved in two sources:
* indexed clinical (from json)
* xml files
there are two main differences:
* XML has more information: radiation, drugs information, follow-ups, biospecimen, etc. So the indexed one is only a subset of the XML files
* The indexed data contains the updated data with the follow up informaiton. For example: if the patient is alive in the first time clinical data was collect and the in the next follow-up he is dead, the indexed data will show dead. The XML will have two fields, one for the first time saying he is alive (in the clinical part) and the follow-up saying he is dead. You can see this case here: https://gist.github.com/tiagochst/cfa384297ff0950a6489e3f4b296ecd7
```{r, fig.height=6, message=FALSE, warning=FALSE, include=FALSE}
clin.query <- GDCquery(project = "TCGA-BLCA", data.category = "Clinical", barcode = "TCGA-FD-A5C0")
json <- tryCatch(GDCdownload(clin.query),
error = function(e) GDCdownload(clin.query, method = "client"))
clinical.patient <- GDCprepare_clinic(clin.query, clinical.info = "patient")
clinical.patient.followup <- GDCprepare_clinic(clin.query, clinical.info = "follow_up")
clinical.index <- GDCquery_clinic("TCGA-BLCA")
```
```{r, eval=FALSE, fig.height=6, message=FALSE, warning=FALSE, include=TRUE}
clin.query <- GDCquery(project = "TCGA-BLCA", data.category = "Clinical", barcode = "TCGA-FD-A5C0")
json <- tryCatch(GDCdownload(clin.query),
error = function(e) GDCdownload(clin.query, method = "client"))
clinical.patient <- GDCprepare_clinic(clin.query, clinical.info = "patient")
clinical.patient.followup <- GDCprepare_clinic(clin.query, clinical.info = "follow_up")
clinical.index <- GDCquery_clinic("TCGA-BLCA")
```
```{r, echo=TRUE, message=FALSE, warning=FALSE, fig.height=6}
# Example of the second difference:
clinical.patient[,c("vital_status","days_to_death","days_to_last_followup")]
clinical.patient.followup[,c("vital_status","days_to_death","days_to_last_followup")]
# indexed data is equivalent to follow ups information
clinical.index[clinical.index$submitter_id=="TCGA-FD-A5C0",
c("vital_status","days_to_death","days_to_last_follow_up")]
```
You can retrieve clinical data using the `GDCquery_clinic` function.
This will get only the indexed GDC clinical data. This is the same as clicking on the
download clinical buttun in the data portal.
This means this function is not parsing the XML files, see `GDCprepare_clinic` function.
The arguments of this function are:
* project: project_id ("TCGA-OV","TCGA-BRCA","TARGET-WT", etc)
* type: ("clinical","biospecimen")
* save.csv: save the clinical/biospeciment into a csv file. Pattern: project_type.csv
Examples of use:
```{r, eval = FALSE}
clin <- GDCquery_clinic("TCGA-ACC", type = "clinical", save.csv = TRUE)
clin <- GDCquery_clinic("TCGA-ACC", type = "biospecimen", save.csv = TRUE)
```
To parse the TCGA clinical XML files, please use `GDCprepare_clinic` function. It receives as
argument the query object and which clinical information we should retrieve.
The possible values for the argument `clinical.info` are:
* For clinical XML files:
* admin
* drug
* follow_up
* patient
* new_tumor_event
* radiation
* stage_event
* For biospecimen XML files:
* admin
* aliquot
* analyte
* bio_patient
* portion
* protocol
* sample
* slide
```{r, eval = FALSE}
query <- GDCquery(project = "TCGA-COAD",
data.category = "Clinical",
barcode = c("TCGA-RU-A8FL","TCGA-AA-3972"))
GDCdownload(query)
clinical <- GDCprepare_clinic(query, clinical.info = "patient")
clinical.drug <- GDCprepare_clinic(query, clinical.info = "drug")
clinical.radiation <- GDCprepare_clinic(query, clinical.info = "radiation")
clinical.admin <- GDCprepare_clinic(query, clinical.info = "admin")
query <- GDCquery(project = "TCGA-COAD",
data.category = "Biospecimen",
barcode = c("TCGA-RU-A8FL","TCGA-AA-3972"))
GDCdownload(query)
clinical.admin <- GDCprepare_clinic(query, clinical.info = "admin")
clinical.sample <- GDCprepare_clinic(query, clinical.info = "sample")
clinical.slide <- GDCprepare_clinic(query, clinical.info = "slide")
clinical.portion <- GDCprepare_clinic(query, clinical.info = "portion")
```
Also, some functions to work with clinical data are provided.
For example the function `TCGAquery_SampleTypes` will filter barcodes based on a
type the argument typesample.
Some of the typesamples possibilities are:
TP (PRIMARY SOLID TUMOR),
TR (RECURRENT SOLID TUMOR),
NT (Solid Tissue Normal) etc.
Please, see ?TCGAquery_SampleTypes for all the possible values.
The function `TCGAquery_MatchedCoupledSampleTypes` will filter the samples that
have all the typesample provided as argument. For example, if TP and TR are set
as typesample, the function will return the barcodes of a patient if it has both types.
So, if it has a TP, but not a TR, no barcode will be returned. If it has a TP and a TR
both barcodes are returned.
The function `TCGAquery_clinicFilt` will filter your data, returning the list
of barcodes that matches all the filter.
The arguments of `TCGAquery_clinicFilt` are:
* **barcode** List of barcodes
* **clinical_patient_data** clinical patient data obtained with clinic function
Ex: clinical_patient_data <- TCGAquery_clinic("LGG","clinical_patient")
* **HER** her2 immunohistochemistry receptor status: "Positive" or "Negative"
* **gender** "MALE" or "FEMALE"
* **PR** Progesterone receptor status: "Positive" or "Negative"
* **stage** Pathologic Stage: "stage_IX", "stage_I", "stage_IA", "stage_IB", "stage_IIX",
"stage_IIA", "stage_IIB", "stage_IIIX","stage_IIIA", "stage_IIIB",
"stage_IIIC", "stage_IV" -
* **ER** Estrogen receptor status: "Positive" or "Negative"
An example of the function is below:
```{r, eval = FALSE}
bar <- c("TCGA-G9-6378-02A-11R-1789-07", "TCGA-CH-5767-04A-11R-1789-07",
"TCGA-G9-6332-60A-11R-1789-07", "TCGA-G9-6336-01A-11R-1789-07",
"TCGA-G9-6336-11A-11R-1789-07", "TCGA-G9-7336-11A-11R-1789-07",
"TCGA-G9-7336-04A-11R-1789-07", "TCGA-G9-7336-14A-11R-1789-07",
"TCGA-G9-7036-04A-11R-1789-07", "TCGA-G9-7036-02A-11R-1789-07",
"TCGA-G9-7036-11A-11R-1789-07", "TCGA-G9-7036-03A-11R-1789-07",
"TCGA-G9-7036-10A-11R-1789-07", "TCGA-BH-A1ES-10A-11R-1789-07",
"TCGA-BH-A1F0-10A-11R-1789-07", "TCGA-BH-A0BZ-02A-11R-1789-07",
"TCGA-B6-A0WY-04A-11R-1789-07", "TCGA-BH-A1FG-04A-11R-1789-08",
"TCGA-D8-A1JS-04A-11R-2089-08", "TCGA-AN-A0FN-11A-11R-8789-08",
"TCGA-AR-A2LQ-12A-11R-8799-08", "TCGA-AR-A2LH-03A-11R-1789-07",
"TCGA-BH-A1F8-04A-11R-5789-07", "TCGA-AR-A24T-04A-55R-1789-07",
"TCGA-AO-A0J5-05A-11R-1789-07", "TCGA-BH-A0B4-11A-12R-1789-07",
"TCGA-B6-A1KN-60A-13R-1789-07", "TCGA-AO-A0J5-01A-11R-1789-07",
"TCGA-AO-A0J5-01A-11R-1789-07", "TCGA-G9-6336-11A-11R-1789-07",
"TCGA-G9-6380-11A-11R-1789-07", "TCGA-G9-6380-01A-11R-1789-07",
"TCGA-G9-6340-01A-11R-1789-07", "TCGA-G9-6340-11A-11R-1789-07")
S <- TCGAquery_SampleTypes(bar,"TP")
S2 <- TCGAquery_SampleTypes(bar,"NB")
# Retrieve multiple tissue types NOT FROM THE SAME PATIENTS
SS <- TCGAquery_SampleTypes(bar,c("TP","NB"))
# Retrieve multiple tissue types FROM THE SAME PATIENTS
SSS <- TCGAquery_MatchedCoupledSampleTypes(bar,c("NT","TP"))
# Get clinical data
clin.query <- GDCquery(project = "TCGA-BRCA", data.category = "Clinical",
barcode = c("TCGA-3C-AALK","TCGA-A2-A04Q","TCGA-A4-A04Q"))
tryCatch(GDCdownload(clin.query), error = function(e) GDCdownload(clin.query, method = "client"))
clinical.patient <- GDCprepare_clinic(clin.query, clinical.info = "patient")
female_erpos_herpos <- TCGAquery_clinicFilt(bar,
clinical.patient,
HER="Positive",
gender="FEMALE",
ER="Positive")
```
The result is shown below:
```{r, eval = TRUE, echo = FALSE}
bar <- c("TCGA-G9-6378-02A-11R-1789-07", "TCGA-CH-5767-04A-11R-1789-07",
"TCGA-G9-6332-60A-11R-1789-07", "TCGA-G9-6336-01A-11R-1789-07",
"TCGA-G9-6336-11A-11R-1789-07", "TCGA-G9-7336-11A-11R-1789-07",
"TCGA-G9-7336-04A-11R-1789-07", "TCGA-G9-7336-14A-11R-1789-07",
"TCGA-G9-7036-04A-11R-1789-07", "TCGA-G9-7036-02A-11R-1789-07",
"TCGA-G9-7036-11A-11R-1789-07", "TCGA-G9-7036-03A-11R-1789-07",
"TCGA-G9-7036-10A-11R-1789-07", "TCGA-BH-A1ES-10A-11R-1789-07",
"TCGA-BH-A1F0-10A-11R-1789-07", "TCGA-BH-A0BZ-02A-11R-1789-07",
"TCGA-D8-A1JS-04A-11R-2089-08", "TCGA-AN-A0FN-11A-11R-8789-08",
"TCGA-AR-A2LQ-12A-11R-8799-08", "TCGA-AR-A2LH-03A-11R-1789-07",
"TCGA-BH-A1F8-04A-11R-5789-07", "TCGA-AR-A24T-04A-55R-1789-07",
"TCGA-AO-A0J5-05A-11R-1789-07", "TCGA-BH-A0B4-11A-12R-1789-07",
"TCGA-B6-A1KN-60A-13R-1789-07", "TCGA-AO-A0J5-01A-11R-1789-07",
"TCGA-AO-A0J5-01A-11R-1789-07", "TCGA-G9-6336-11A-11R-1789-07",
"TCGA-G9-6380-11A-11R-1789-07", "TCGA-G9-6380-01A-11R-1789-07",
"TCGA-G9-6340-01A-11R-1789-07","TCGA-G9-6340-11A-11R-1789-07")
clin.query <- GDCquery(project = "TCGA-BRCA", data.category = "Clinical",
barcode = c("TCGA-3C-AALK","TCGA-A2-A04Q","TCGA-A4-A04Q"))
tryCatch(GDCdownload(clin.query), error = function(e) GDCdownload(clin.query, method = "client"))
clinical.patient <- GDCprepare_clinic(clin.query, clinical.info = "patient")
female_erpos_herpos <- TCGAquery_clinicFilt(bar,
clinical.patient,
HER="Positive",
gender="FEMALE",
ER="Positive")
print(female_erpos_herpos)
```
## `TCGAquery_subtype`: Working with molecular subtypes data.
The Cancer Genome Atlas (TCGA) Research Network has reported integrated genome-wide
studies of various diseases. We have added some of the subtypes defined by these
report in our package. The ACC[@ref22], BRCA [@ref11], COAD [@ref12], GBM [@ref8], HNSC [@ref14], KICH [@ref15], KIRC[@ref21], KIRP [@ref20], LGG [@ref8], LUAD [@ref9],
LUSC[@ref16], PRAD[@ref19], READ [@ref12], SKCM [@ref13], STAD [@ref10], THCA [@ref18], UCEC [@ref17] tumors have data added.
These subtypes will be automatically added in the summarizedExperiment
object through TCGAprepare. But you can also use the `TCGAquery_subtype` function
to retrive this information.
```{r, eval = FALSE}
# Check with subtypes from TCGAprepare and update examples
GBM_path_subtypes <- TCGAquery_subtype(tumor = "gbm")
LGG_path_subtypes <- TCGAquery_subtype(tumor = "lgg")
```
A subset of the lgg subytpe is shown below:
```{r, eval = TRUE, echo = FALSE}
knitr::kable(lgg.gbm.subtype[1:10,c(1,2,3,4)], digits = 2,
caption = "Table with LGG molecular subtypes from TCGAquery_subtype",
row.names = TRUE)
```
# `GDCdownload`: Downloading GDC data
You can easily download data using the `GDCdownload` function.
It uses GDC transfer tool to download gdc data doing a system call.
For this reason some times the update will stop to show, which does not means that
the download process has stopped. Once the process has finished it will give a signal to R.
The data from query will be save in a folder: project/source/data.category (where source is harmonized or legacy)
The arguments are:
* **query** A query for `GDCquery` function
* **token.file** A token file to download protect data (not test yet)
* **method** Use API (POST method) or gdc client tool (API is faster, but the data might get corrupted in the download, and it might need to be executed again). Options: "api", "client"
* **directory** Directory/Folder where the data was downloaded. Default: GDCdata
* **chunks.per.download** This will make the API method only download n (chunks.per.download) files at a time. This may reduce the download problems when the data size is too large.
### `GDCdownload`: Example of use
```{r, eval = FALSE}
query <- GDCquery(project = "TCGA-ACC", data.category = "Copy Number Variation",
data.type = "Copy Number Segment",
barcode = c( "TCGA-OR-A5KU-01A-11D-A29H-01", "TCGA-OR-A5JK-01A-11D-A29H-01"))
GDCdownload(query)
data <- GDCprepare(query)
#--------------------------------------
# Gene expression
#--------------------------------------
# Aligned against Hg38
# mRNA pipeline: https://gdc-docs.nci.nih.gov/Data/Bioinformatics_Pipelines/Expression_mRNA_Pipeline/
query.exp.hg38 <- GDCquery(project = "TCGA-GBM",
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "HTSeq - FPKM-UQ",
barcode = c("TCGA-14-0736-02A-01R-2005-01", "TCGA-06-0211-02A-02R-2005-01"))
GDCdownload(query.exp.hg38)
expdat <- GDCprepare(query = query.exp.hg38,
save = TRUE,
save.filename = "exp.rda")
# Aligned against Hg19
query.exp.hg19 <- GDCquery(project = "TCGA-GBM",
data.category = "Gene expression",
data.type = "Gene expression quantification",
platform = "Illumina HiSeq",
file.type = "normalized_results",
experimental.strategy = "RNA-Seq",
barcode = c("TCGA-14-0736-02A-01R-2005-01", "TCGA-06-0211-02A-02R-2005-01"),
legacy = TRUE)
GDCdownload(query.exp.hg19)
data <- GDCprepare(query.exp.hg19)
#--------------------------------------
# DNA methylation data
#--------------------------------------
# DNA methylation aligned to hg38
query_met.hg38 <- GDCquery(project= "TCGA-LGG",
data.category = "DNA Methylation",
platform = "Illumina Human Methylation 450",
barcode = c("TCGA-HT-8111-01A-11D-2399-05","TCGA-HT-A5R5-01A-11D-A28N-05"))
GDCdownload(query_met.hg38)
data.hg38 <- GDCprepare(query_met.hg38)
# DNA methylation aligned to hg19
query_meth.hg19 <- GDCquery(project= "TCGA-LGG",
data.category = "DNA methylation",
platform = "Illumina Human Methylation 450",
barcode = c("TCGA-HT-8111-01A-11D-2399-05","TCGA-HT-A5R5-01A-11D-A28N-05"),
legacy = TRUE)
GDCdownload(query_meth.hg19)
data.hg19 <- GDCprepare(query_meth.hg19)
# A function to download only 20 samples
legacyPipeline <- function(project, data.category, platform, n = 20){
query <- GDCquery(project = project,
data.category = data.category,
platform = platform,
legacy = TRUE)
cases <- query$results[[1]]$cases[1:n] # Get two samples from the search
query <- GDCquery(project = project,
data.category = data.category,
platform = platform,
legacy = TRUE,
barcode = cases)
GDCdownload(query,chunks.per.download = 5)
data <- GDCprepare(query)
return(data)
}
# DNA methylation
data <- legacyPipeline("TCGA-GBM","DNA methylation","Illumina Human Methylation 27")
data <- legacyPipeline("TCGA-GBM","DNA methylation","Illumina Human Methylation 450")
data <- legacyPipeline("TCGA-GBM","DNA methylation","Illumina DNA Methylation OMA003 CPI")
data <- legacyPipeline("TCGA-GBM","DNA methylation","Illumina DNA Methylation OMA002 CPI")
#-------------------------------------------------------
# Example to idat files from TCGA projects
#-------------------------------------------------------
projects <- TCGAbiolinks:::getGDCprojects()$project_id
projects <- projects[grepl('^TCGA',projects,perl=T)]
match.file.cases.all <- NULL
for(proj in projects){
print(proj)
query <- GDCquery(project = proj,
data.category = "Raw microarray data",
data.type = "Raw intensities",
experimental.strategy = "Methylation array",
legacy = TRUE,
file.type = ".idat",
platform = "Illumina Human Methylation 450")
match.file.cases <- query$results[[1]][,c("file_name","cases")]
match.file.cases$project <- proj
match.file.cases.all <- rbind(match.file.cases.all,match.file.cases)
tryCatch(GDCdownload(query, method = "api",chunks.per.download = 20),
error = function(e) GDCdownload(query, method = "client"))
}
# This will create a map between idat file name, cases (barcode) and project
readr::write_tsv(match.file.cases.all, path = "idat_filename_case.txt")
# code to move all files to local folder
for(file in dir(".",pattern = ".idat", recursive = T)){
TCGAbiolinks::move(file,basename(file))
}
```
# `GDCprepare`: Preparing the data
This function is still under development, it is not working for all cases. See the tables below with the status.
Examples of query, download, prepare can be found in this [gist](https://gist.github.com/tiagochst/a701bad3fa3800ade7063760755e0aad).
## Harmonized data
| Data.category | Data.type | Workflow Type | Status |
|-----------------------------|-----------------------------------|-----------------|-----------------------------------------------------------------------------|
| Transcriptome Profiling | Gene Expression Quantification | HTSeq - Counts | Data frame or SE (losing 5% of information when mapping to genomic regions) |
| | | HTSeq - FPKM-UQ | Returning only a (losing 5% of information when mapping to genomic regions) |
| | | HTSeq - FPKM | Returning only a (losing 5% of information when mapping to genomic regions) |
| | Isoform Expression Quantification | Not needed | |
| | miRNA Expression Quantification | Not needed | Returning only a dataframe for the moment |
| Copy number variation | Copy Number Segment | | Returning only a dataframe for the moment |
| | Masked Copy Number Segment | | Returning only a dataframe for the moment |
| Simple Nucleotide Variation | | | |
| Raw Sequencing Data | | | |
| Biospecimen | | | |
| Clinical | | | |
## Legacy data
| Data.category | Data.type | Platform | file.type | Status |
|-----------------------------|-----------------------------------|-------------------------------------|--------------------|-----------------|
| Transcriptome Profiling | | | | |
| Copy number variation | - | Affymetrix SNP Array 6.0 | nocnv_hg18.seg | Working |
| | - | Affymetrix SNP Array 6.0 | hg18.seg | Working |