-
Notifications
You must be signed in to change notification settings - Fork 2
/
data_divider.R
53 lines (29 loc) · 1.73 KB
/
data_divider.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
#Need to cut down list of probes to genes to include only methylated probes.
ADC.genes.to.meth.probes.list <- vector("list", N)
names(ADC.genes.to.meth.probes.list) <- names(genes.to.probes.list)
for(i in 1:N){
matches <- match(genes.to.probes.list[[i]], ADC.potentially.methylated.probes)
ind <- which(is.na(matches) == FALSE)
ADC.genes.to.meth.probes.list[[i]] <- genes.to.probes.list[[i]][ind]
}
#Create a separate file of methylation data for each gene.
for (i in 1:N){
probe.ind <- match(ADC.genes.to.meth.probes.list[[i]], names(ADC.potentially.methylated.data))
data <- ADC.potentially.methylated.data[, c(1:4,probe.ind)]
filename <- paste("D:/Phil/find_methylation_status/output/meth_genes/ADC_meth_genes/find_methylation_status_ADC_", names(ADC.genes.to.meth.probes.list)[i], ".csv", sep="")
write.csv(data, filename, row.names=FALSE)
}
SCC.genes.to.meth.probes.list <- vector("list", N)
names(SCC.genes.to.meth.probes.list) <- names(genes.to.probes.list)
for(i in 1:N){
matches <- match(genes.to.probes.list[[i]], SCC.potentially.methylated.probes)
ind <- which(is.na(matches) == FALSE)
SCC.genes.to.meth.probes.list[[i]] <- genes.to.probes.list[[i]][ind]
}
#Create a separate file of methylation data for each gene.
for (i in 1:N){
probe.ind <- match(SCC.genes.to.meth.probes.list[[i]], names(SCC.potentially.methylated.data))
data <- SCC.potentially.methylated.data[, c(1:4,probe.ind)]
filename <- paste("D:/Phil/find_methylation_status/output/meth_genes/SCC_meth_genes/find_methylation_status_SCC_", names(SCC.genes.to.meth.probes.list)[i], ".csv", sep="")
write.csv(data, filename, row.names=FALSE)
}