-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDriverGeneSurvival.r
210 lines (152 loc) · 8.02 KB
/
DriverGeneSurvival.r
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
library(TCGAbiolinks)
library(dplyr)
library(DT)
library(SummarizedExperiment)
library(survival)
#Define notin for use later
`%notin%` <- Negate(`%in%`)
# Query Patient database, in this case COAD
query <- GDCquery(
project = c('TCGA-COAD'),
data.category = "Gene expression",
data.type = "Gene expression quantification",
platform = "Illumina HiSeq",
file.type = "normalized_results",
experimental.strategy = "RNA-Seq",
legacy = TRUE
)
GDCdownload(query, method = "api", files.per.chunk = 10)
patients_COAD <- GDCprepare(query)
#Query Maf database, specifically COAD
query_maf_COAD <- GDCquery(project = "TCGA-COAD",
data.category = "Simple Nucleotide Variation",
data.type = "Masked Somatic Mutation",
legacy = F)
GDCdownload(query_maf_COAD, directory = "GDCdata/")
maf_COAD = GDCprepare(query_maf_COAD, directory = "GDCdata/")
#driver_genes_COAD <- c("MGA", "GTF2I", "MSH6", "RRAS2", "RPL22", "PIK3R2",
# "TAF1", "SOS1", "PDS5B", "ZFHX3", "ZMYM2", "ATF7IP",
# "INPPL1", "ATR", "ARID5B", "SOX17", "MYCN", "CTNND1",
# "FOXA2", "DICER1", "SCAF4", "SIN3A", "KMT2B", "ACVR1",
# "CCND1", "CHD3", "AMER1")
#List the Driver Genes for this specific cancer type
COAD_driver_genes <- c("AMER1", "TCFZL2", "ZFP36L2", "PCBP1", "SOX9", "TGIF1")
#Find maf files with these driver genes
COAD_gene <- filter(maf_COAD, (Hugo_Symbol %in% COAD_driver_genes))
#Generate patient ID based on tumor sample barcode
COAD_gene <- transform(COAD_gene, patient_ID = substr(COAD_gene$Tumor_Sample_Barcode,1,12))
#Find patient IDs where mutations are present
driver_gene_sample_barcodes = COAD_gene$patient_ID
#Select patients that have the driver gene mutation based off of tumor sample barcodes as found above
COAD_patients_with_driver_genes = filter(as.data.frame(colData(patients_COAD)), patient %in% driver_gene_sample_barcodes)
#Fit a survival function for patients with these specific driver gene mutations and plot
Survival_Function = survfit(Surv(COAD_patients_with_driver_genes$days_to_last_follow_up,
COAD_patients_with_driver_genes$vital_status == "Alive")~1)
Survival_Function
svg(filename = "COAD with driver genes survival.svg")
plot(Survival_Function)
dev.off()
#Fit a survival model for patients without these specific driver gene mutations and plot
COAD_patients_without_driver_genes = filter(as.data.frame(colData(patients_COAD)), patient %notin% driver_gene_sample_barcodes)
Survival_Function = survfit(Surv(COAD_patients_without_driver_genes$days_to_last_follow_up,
COAD_patients_without_driver_genes$vital_status == "Alive")~1)
Survival_Function
svg(filename = "COAD without driver genes survival.svg")
plot(Survival_Function)
dev.off()
### Repeat with LUAD
# Query Patient database, in this case COAD
query <- GDCquery(
project = c('TCGA-LUAD'),
data.category = "Gene expression",
data.type = "Gene expression quantification",
platform = "Illumina HiSeq",
file.type = "normalized_results",
experimental.strategy = "RNA-Seq",
legacy = TRUE
)
GDCdownload(query, method = "api", files.per.chunk = 10)
patients_LUAD <- GDCprepare(query)
#Query Maf database, specifically COAD
query_maf_LUAD <- GDCquery(project = "TCGA-LUAD",
data.category = "Simple Nucleotide Variation",
data.type = "Masked Somatic Mutation",
legacy = F)
GDCdownload(query_maf_LUAD, directory = "GDCdata/")
maf_LUAD = GDCprepare(query_maf_LUAD, directory = "GDCdata/")
#List the Driver Genes for this specific cancer type
LUAD_driver_genes <- c("MGA", "RIT1", "TP53")
#Find maf files with these driver genes
LUAD_gene <- filter(maf_LUAD, (Hugo_Symbol %in% LUAD_driver_genes))
#Generate patient ID based on tumor sample barcode
LUAD_gene <- transform(LUAD_gene, patient_ID = substr(LUAD_gene$Tumor_Sample_Barcode,1,12))
#Find patient IDs where mutations are present
driver_gene_sample_barcodes = LUAD_gene$patient_ID
LUAD_patients_df <- as.data.frame(colData(patients_LUAD))
#Select patients that have the driver gene mutation based off of tumor sample barcodes as found above
LUAD_patients_with_driver_genes = filter(as.data.frame(colData(patients_LUAD)), patient %in% driver_gene_sample_barcodes)
#Fit a survival function for patients with these specific driver gene mutations and plot
Survival_Function = survfit(Surv(LUAD_patients_with_driver_genes$days_to_last_follow_up,
LUAD_patients_with_driver_genes$vital_status == "Alive")~1)
Survival_Function
svg(filename = "LUAD with driver genes survival.svg")
plot(Survival_Function)
dev.off()
#Fit a survival model for patients without these specific driver gene mutations and plot
LUAD_patients_without_driver_genes = filter(as.data.frame(colData(patients_LUAD)), patient %notin% driver_gene_sample_barcodes)
Survival_Function = survfit(Surv(LUAD_patients_without_driver_genes$days_to_last_follow_up,
LUAD_patients_without_driver_genes$vital_status == "Alive")~1)
Survival_Function
svg(filename = "LUAD without driver genes survival.svg")
plot(Survival_Function)
dev.off()
### Repeat with UCEC
# Query Patient database, in this case COAD
query <- GDCquery(
project = c('TCGA-UCEC'),
data.category = "Gene expression",
data.type = "Gene expression quantification",
platform = "Illumina HiSeq",
file.type = "normalized_results",
experimental.strategy = "RNA-Seq",
legacy = TRUE
)
GDCdownload(query, method = "api", files.per.chunk = 10)
patients_UCEC <- GDCprepare(query)
#Query Maf database, specifically COAD
query_maf_UCEC <- GDCquery(project = "TCGA-UCEC",
data.category = "Simple Nucleotide Variation",
data.type = "Masked Somatic Mutation",
legacy = F)
GDCdownload(query_maf_UCEC, directory = "GDCdata/")
maf_UCEC = GDCprepare(query_maf_UCEC, directory = "GDCdata/")
#List the Driver Genes for this specific cancer type
UCEC_driver_genes <- c("MSH6", "RRAS2", "RPL22", "PIK3R2",
"TAF1", "SOS1", "PDS5B", "ZFHX3", "ZMYM2", "ATF7IP",
"INPPL1", "ATR", "ARID5B", "SOX17", "MYCN", "CTNND1",
"FOXA2", "DICER1", "SCAF4", "SIN3A", "KMT2B", "ACVR1",
"CCND1", "CHD3")
#Find maf files with these driver genes
UCEC_gene <- filter(maf_UCEC, (Hugo_Symbol %in% UCEC_driver_genes))
#Generate patient ID based on tumor sample barcode
UCEC_gene <- transform(UCEC_gene, patient_ID = substr(UCEC_gene$Tumor_Sample_Barcode,1,12))
#Find patient IDs where mutations are present
driver_gene_sample_barcodes = UCEC_gene$patient_ID
UCEC_patients_df <- as.data.frame(colData(patients_UCEC))
#Select patients that have the driver gene mutation based off of tumor sample barcodes as found above
UCEC_patients_with_driver_genes = filter(as.data.frame(colData(patients_UCEC)), patient %in% driver_gene_sample_barcodes)
#Fit a survival function for patients with these specific driver gene mutations and plot
Survival_Function = survfit(Surv(UCEC_patients_with_driver_genes$days_to_last_follow_up,
UCEC_patients_with_driver_genes$vital_status == "Alive")~1)
Survival_Function
svg(filename = "UCEC with driver genes survival.svg")
plot(Survival_Function)
dev.off()
#Fit a survival model for patients without these specific driver gene mutations and plot
UCEC_patients_without_driver_genes = filter(as.data.frame(colData(patients_UCEC)), patient %notin% driver_gene_sample_barcodes)
Survival_Function = survfit(Surv(UCEC_patients_without_driver_genes$days_to_last_follow_up,
UCEC_patients_without_driver_genes$vital_status == "Alive")~1)
Survival_Function
svg(filename = "UCEC without driver genes survival.svg")
plot(Survival_Function)
dev.off()