annotate shm_csr.r @ 94:84e9e5c8c101 draft

"planemo upload commit d4be85014b638f1d50b318d4b735be7f6e973140"
author rhpvorderman
date Fri, 24 Mar 2023 16:58:28 +0000
parents 8fcf31272f6e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
81
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
1 library(data.table)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
2 library(ggplot2)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
3 library(reshape2)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
4
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
5 args <- commandArgs(trailingOnly = TRUE)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
6
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
7 input = args[1]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
8 genes = unlist(strsplit(args[2], ","))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
9 outputdir = args[3]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
10 empty.region.filter = args[4]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
11 setwd(outputdir)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
12
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
13 #dat = read.table(input, header=T, sep="\t", fill=T, stringsAsFactors=F)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
14
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
15 dat = data.frame(fread(input, sep="\t", header=T, stringsAsFactors=F)) #fread because read.table suddenly skips certain rows...
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
16
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
17 if(length(dat$Sequence.ID) == 0){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
18 setwd(outputdir)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
19 result = data.frame(x = rep(0, 5), y = rep(0, 5), z = rep(NA, 5))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
20 row.names(result) = c("Number of Mutations (%)", "Transition (%)", "Transversions (%)", "Transitions at G C (%)", "Targeting of G C (%)")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
21 write.table(x=result, file="mutations.txt", sep=",",quote=F,row.names=T,col.names=F)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
22 transitionTable = data.frame(A=rep(0, 4),C=rep(0, 4),G=rep(0, 4),T=rep(0, 4))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
23 row.names(transitionTable) = c("A", "C", "G", "T")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
24 transitionTable["A","A"] = NA
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
25 transitionTable["C","C"] = NA
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
26 transitionTable["G","G"] = NA
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
27 transitionTable["T","T"] = NA
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
28
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
29 write.table(x=transitionTable, file="transitions.txt", sep=",",quote=F,row.names=T,col.names=NA)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
30 cat("0", file="n.txt")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
31 stop("No data")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
32 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
33
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
34 cleanup_columns = c("FR1.IMGT.c.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
35 "FR2.IMGT.g.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
36 "CDR1.IMGT.Nb.of.nucleotides",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
37 "CDR2.IMGT.t.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
38 "FR1.IMGT.c.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
39 "CDR1.IMGT.c.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
40 "FR2.IMGT.a.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
41 "FR2.IMGT.Nb.of.mutations",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
42 "FR2.IMGT.g.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
43 "FR2.IMGT.a.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
44 "FR3.IMGT.t.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
45 "FR3.IMGT.t.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
46 "FR2.IMGT.g.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
47 "FR3.IMGT.c.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
48 "FR1.IMGT.Nb.of.mutations",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
49 "CDR1.IMGT.g.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
50 "CDR1.IMGT.t.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
51 "CDR1.IMGT.g.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
52 "CDR2.IMGT.Nb.of.nucleotides",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
53 "FR2.IMGT.a.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
54 "CDR1.IMGT.Nb.of.mutations",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
55 "CDR3.IMGT.Nb.of.nucleotides",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
56 "CDR1.IMGT.a.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
57 "FR3.IMGT.a.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
58 "FR1.IMGT.g.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
59 "FR3.IMGT.a.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
60 "FR1.IMGT.a.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
61 "CDR2.IMGT.a.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
62 "CDR2.IMGT.Nb.of.mutations",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
63 "CDR2.IMGT.g.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
64 "CDR2.IMGT.a.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
65 "CDR1.IMGT.t.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
66 "FR3.IMGT.g.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
67 "FR1.IMGT.g.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
68 "FR3.IMGT.g.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
69 "CDR1.IMGT.a.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
70 "FR1.IMGT.a.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
71 "FR3.IMGT.a.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
72 "FR3.IMGT.Nb.of.nucleotides",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
73 "FR2.IMGT.t.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
74 "CDR2.IMGT.g.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
75 "FR2.IMGT.t.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
76 "CDR1.IMGT.t.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
77 "FR2.IMGT.t.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
78 "FR3.IMGT.t.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
79 "FR2.IMGT.Nb.of.nucleotides",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
80 "FR1.IMGT.t.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
81 "FR1.IMGT.t.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
82 "FR3.IMGT.c.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
83 "FR1.IMGT.t.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
84 "CDR2.IMGT.a.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
85 "FR2.IMGT.c.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
86 "CDR1.IMGT.g.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
87 "CDR2.IMGT.t.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
88 "FR1.IMGT.Nb.of.nucleotides",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
89 "CDR1.IMGT.c.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
90 "CDR2.IMGT.t.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
91 "FR3.IMGT.g.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
92 "CDR1.IMGT.a.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
93 "FR2.IMGT.c.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
94 "FR3.IMGT.Nb.of.mutations",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
95 "FR2.IMGT.c.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
96 "CDR2.IMGT.g.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
97 "FR1.IMGT.g.c",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
98 "CDR2.IMGT.c.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
99 "FR3.IMGT.c.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
100 "CDR1.IMGT.c.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
101 "CDR2.IMGT.c.g",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
102 "CDR2.IMGT.c.a",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
103 "FR1.IMGT.c.t",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
104 "FR1.IMGT.Nb.of.silent.mutations",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
105 "FR2.IMGT.Nb.of.silent.mutations",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
106 "FR3.IMGT.Nb.of.silent.mutations",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
107 "FR1.IMGT.Nb.of.nonsilent.mutations",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
108 "FR2.IMGT.Nb.of.nonsilent.mutations",
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
109 "FR3.IMGT.Nb.of.nonsilent.mutations")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
110
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
111 print("Cleaning up columns")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
112
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
113 for(col in cleanup_columns){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
114 dat[,col] = gsub("\\(.*\\)", "", dat[,col])
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
115 #dat[dat[,col] == "",] = "0"
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
116 dat[,col] = as.numeric(dat[,col])
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
117 dat[is.na(dat[,col]),col] = 0
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
118 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
119
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
120 regions = c("FR1", "CDR1", "FR2", "CDR2", "FR3")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
121 if(empty.region.filter == "FR1") {
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
122 regions = c("CDR1", "FR2", "CDR2", "FR3")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
123 } else if (empty.region.filter == "CDR1") {
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
124 regions = c("FR2", "CDR2", "FR3")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
125 } else if (empty.region.filter == "FR2") {
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
126 regions = c("CDR2", "FR3")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
127 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
128
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
129 pdfplots = list() #save() this later to create the pdf plots in another script (maybe avoids the "address (nil), cause memory not mapped")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
130
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
131 sum_by_row = function(x, columns) { sum(as.numeric(x[columns]), na.rm=T) }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
132
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
133 print("aggregating data into new columns")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
134
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
135 VRegionMutations_columns = paste(regions, ".IMGT.Nb.of.mutations", sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
136 dat$VRegionMutations = apply(dat, FUN=sum_by_row, 1, columns=VRegionMutations_columns)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
137
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
138 VRegionNucleotides_columns = paste(regions, ".IMGT.Nb.of.nucleotides", sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
139 dat$FR3.IMGT.Nb.of.nucleotides = nchar(dat$FR3.IMGT.seq)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
140 dat$VRegionNucleotides = apply(dat, FUN=sum_by_row, 1, columns=VRegionNucleotides_columns)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
141
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
142 transitionMutations_columns = paste(rep(regions, each=4), c(".IMGT.a.g", ".IMGT.g.a", ".IMGT.c.t", ".IMGT.t.c"), sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
143 dat$transitionMutations = apply(dat, FUN=sum_by_row, 1, columns=transitionMutations_columns)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
144
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
145 transversionMutations_columns = paste(rep(regions, each=8), c(".IMGT.a.c",".IMGT.c.a",".IMGT.a.t",".IMGT.t.a",".IMGT.g.c",".IMGT.c.g",".IMGT.g.t",".IMGT.t.g"), sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
146 dat$transversionMutations = apply(dat, FUN=sum_by_row, 1, columns=transversionMutations_columns)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
147
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
148 transitionMutationsAtGC_columns = paste(rep(regions, each=2), c(".IMGT.g.a",".IMGT.c.t"), sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
149 dat$transitionMutationsAtGC = apply(dat, FUN=sum_by_row, 1, columns=transitionMutationsAtGC_columns)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
150
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
151 totalMutationsAtGC_columns = paste(rep(regions, each=6), c(".IMGT.c.g",".IMGT.c.t",".IMGT.c.a",".IMGT.g.c",".IMGT.g.a",".IMGT.g.t"), sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
152 #totalMutationsAtGC_columns = paste(rep(regions, each=6), c(".IMGT.g.a",".IMGT.c.t",".IMGT.c.a",".IMGT.c.g",".IMGT.g.t"), sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
153 dat$totalMutationsAtGC = apply(dat, FUN=sum_by_row, 1, columns=totalMutationsAtGC_columns)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
154
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
155 transitionMutationsAtAT_columns = paste(rep(regions, each=2), c(".IMGT.a.g",".IMGT.t.c"), sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
156 dat$transitionMutationsAtAT = apply(dat, FUN=sum_by_row, 1, columns=transitionMutationsAtAT_columns)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
157
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
158 totalMutationsAtAT_columns = paste(rep(regions, each=6), c(".IMGT.a.g",".IMGT.a.c",".IMGT.a.t",".IMGT.t.g",".IMGT.t.c",".IMGT.t.a"), sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
159 #totalMutationsAtAT_columns = paste(rep(regions, each=5), c(".IMGT.a.g",".IMGT.t.c",".IMGT.a.c",".IMGT.g.c",".IMGT.t.g"), sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
160 dat$totalMutationsAtAT = apply(dat, FUN=sum_by_row, 1, columns=totalMutationsAtAT_columns)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
161
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
162 FRRegions = regions[grepl("FR", regions)]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
163 CDRRegions = regions[grepl("CDR", regions)]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
164
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
165 FR_silentMutations_columns = paste(FRRegions, ".IMGT.Nb.of.silent.mutations", sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
166 dat$silentMutationsFR = apply(dat, FUN=sum_by_row, 1, columns=FR_silentMutations_columns)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
167
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
168 CDR_silentMutations_columns = paste(CDRRegions, ".IMGT.Nb.of.silent.mutations", sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
169 dat$silentMutationsCDR = apply(dat, FUN=sum_by_row, 1, columns=CDR_silentMutations_columns)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
170
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
171 FR_nonSilentMutations_columns = paste(FRRegions, ".IMGT.Nb.of.nonsilent.mutations", sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
172 dat$nonSilentMutationsFR = apply(dat, FUN=sum_by_row, 1, columns=FR_nonSilentMutations_columns)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
173
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
174 CDR_nonSilentMutations_columns = paste(CDRRegions, ".IMGT.Nb.of.nonsilent.mutations", sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
175 dat$nonSilentMutationsCDR = apply(dat, FUN=sum_by_row, 1, columns=CDR_nonSilentMutations_columns)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
176
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
177 mutation.sum.columns = c("Sequence.ID", "VRegionMutations", "VRegionNucleotides", "transitionMutations", "transversionMutations", "transitionMutationsAtGC", "transitionMutationsAtAT", "silentMutationsFR", "nonSilentMutationsFR", "silentMutationsCDR", "nonSilentMutationsCDR")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
178 write.table(dat[,mutation.sum.columns], "mutation_by_id.txt", sep="\t",quote=F,row.names=F,col.names=T)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
179
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
180 setwd(outputdir)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
181
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
182 write.table(dat, input, sep="\t",quote=F,row.names=F,col.names=T)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
183
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
184 base.order.x = data.frame(base=c("A", "C", "G", "T"), order.x=1:4)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
185 base.order.y = data.frame(base=c("T", "G", "C", "A"), order.y=1:4)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
186
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
187 calculate_result = function(i, gene, dat, matrx, f, fname, name){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
188 tmp = dat[grepl(paste("^", gene, ".*", sep=""), dat$best_match),]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
189
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
190 j = i - 1
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
191 x = (j * 3) + 1
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
192 y = (j * 3) + 2
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
193 z = (j * 3) + 3
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
194
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
195 if(nrow(tmp) > 0){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
196 if(fname == "sum"){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
197 matrx[1,x] = round(f(tmp$VRegionMutations, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
198 matrx[1,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
199 matrx[1,z] = round(f(matrx[1,x] / matrx[1,y]) * 100, digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
200 } else {
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
201 matrx[1,x] = round(f(tmp$VRegionMutations, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
202 matrx[1,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
203 matrx[1,z] = round(f(tmp$VRegionMutations / tmp$VRegionNucleotides) * 100, digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
204 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
205
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
206 matrx[2,x] = round(f(tmp$transitionMutations, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
207 matrx[2,y] = round(f(tmp$VRegionMutations, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
208 matrx[2,z] = round(matrx[2,x] / matrx[2,y] * 100, digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
209
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
210 matrx[3,x] = round(f(tmp$transversionMutations, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
211 matrx[3,y] = round(f(tmp$VRegionMutations, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
212 matrx[3,z] = round(matrx[3,x] / matrx[3,y] * 100, digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
213
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
214 matrx[4,x] = round(f(tmp$transitionMutationsAtGC, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
215 matrx[4,y] = round(f(tmp$totalMutationsAtGC, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
216 matrx[4,z] = round(matrx[4,x] / matrx[4,y] * 100, digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
217
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
218 matrx[5,x] = round(f(tmp$totalMutationsAtGC, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
219 matrx[5,y] = round(f(tmp$VRegionMutations, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
220 matrx[5,z] = round(matrx[5,x] / matrx[5,y] * 100, digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
221
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
222 matrx[6,x] = round(f(tmp$transitionMutationsAtAT, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
223 matrx[6,y] = round(f(tmp$totalMutationsAtAT, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
224 matrx[6,z] = round(matrx[6,x] / matrx[6,y] * 100, digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
225
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
226 matrx[7,x] = round(f(tmp$totalMutationsAtAT, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
227 matrx[7,y] = round(f(tmp$VRegionMutations, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
228 matrx[7,z] = round(matrx[7,x] / matrx[7,y] * 100, digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
229
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
230 matrx[8,x] = round(f(tmp$nonSilentMutationsFR, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
231 matrx[8,y] = round(f(tmp$silentMutationsFR, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
232 matrx[8,z] = round(matrx[8,x] / matrx[8,y], digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
233
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
234 matrx[9,x] = round(f(tmp$nonSilentMutationsCDR, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
235 matrx[9,y] = round(f(tmp$silentMutationsCDR, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
236 matrx[9,z] = round(matrx[9,x] / matrx[9,y], digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
237
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
238 if(fname == "sum"){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
239
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
240 regions.fr = regions[grepl("FR", regions)]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
241 regions.fr = paste(regions.fr, ".IMGT.Nb.of.nucleotides", sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
242 regions.cdr = regions[grepl("CDR", regions)]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
243 regions.cdr = paste(regions.cdr, ".IMGT.Nb.of.nucleotides", sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
244
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
245 if(length(regions.fr) > 1){ #in case there is only on FR region (rowSums needs >1 column)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
246 matrx[10,x] = round(f(rowSums(tmp[,regions.fr], na.rm=T)), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
247 } else {
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
248 matrx[10,x] = round(f(tmp[,regions.fr], na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
249 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
250 matrx[10,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
251 matrx[10,z] = round(matrx[10,x] / matrx[10,y] * 100, digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
252
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
253 if(length(regions.cdr) > 1){ #in case there is only on CDR region
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
254 matrx[11,x] = round(f(rowSums(tmp[,regions.cdr], na.rm=T)), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
255 } else {
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
256 matrx[11,x] = round(f(tmp[,regions.cdr], na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
257 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
258 matrx[11,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
259 matrx[11,z] = round(matrx[11,x] / matrx[11,y] * 100, digits=1)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
260 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
261 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
262
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
263 transitionTable = data.frame(A=zeros,C=zeros,G=zeros,T=zeros)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
264 row.names(transitionTable) = c("A", "C", "G", "T")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
265 transitionTable["A","A"] = NA
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
266 transitionTable["C","C"] = NA
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
267 transitionTable["G","G"] = NA
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
268 transitionTable["T","T"] = NA
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
269
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
270 if(nrow(tmp) > 0){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
271 for(nt1 in nts){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
272 for(nt2 in nts){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
273 if(nt1 == nt2){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
274 next
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
275 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
276 NT1 = LETTERS[letters == nt1]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
277 NT2 = LETTERS[letters == nt2]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
278 FR1 = paste("FR1.IMGT.", nt1, ".", nt2, sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
279 CDR1 = paste("CDR1.IMGT.", nt1, ".", nt2, sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
280 FR2 = paste("FR2.IMGT.", nt1, ".", nt2, sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
281 CDR2 = paste("CDR2.IMGT.", nt1, ".", nt2, sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
282 FR3 = paste("FR3.IMGT.", nt1, ".", nt2, sep="")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
283 if (empty.region.filter == "leader"){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
284 transitionTable[NT1,NT2] = sum(tmp[,c(FR1, CDR1, FR2, CDR2, FR3)])
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
285 } else if (empty.region.filter == "FR1") {
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
286 transitionTable[NT1,NT2] = sum(tmp[,c(CDR1, FR2, CDR2, FR3)])
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
287 } else if (empty.region.filter == "CDR1") {
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
288 transitionTable[NT1,NT2] = sum(tmp[,c(FR2, CDR2, FR3)])
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
289 } else if (empty.region.filter == "FR2") {
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
290 transitionTable[NT1,NT2] = sum(tmp[,c(CDR2, FR3)])
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
291 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
292 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
293 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
294 transition = transitionTable
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
295 transition$id = names(transition)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
296
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
297 transition2 = melt(transition, id.vars="id")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
298
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
299 transition2 = merge(transition2, base.order.x, by.x="id", by.y="base")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
300
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
301 transition2 = merge(transition2, base.order.y, by.x="variable", by.y="base")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
302
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
303 transition2[is.na(transition2$value),]$value = 0
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
304
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
305 if(any(transition2$value != 0)){ #having a transition table filled with 0 is bad
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
306 print("Plotting heatmap and transition")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
307 png(filename=paste("transitions_stacked_", name, ".png", sep=""))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
308 p = ggplot(transition2, aes(factor(reorder(id, order.x)), y=value, fill=factor(reorder(variable, order.y)))) + geom_bar(position="fill", stat="identity", colour="black") #stacked bar
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
309 p = p + xlab("From base") + ylab("") + ggtitle("Bargraph transition information") + guides(fill=guide_legend(title=NULL))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
310 p = p + theme(panel.background = element_rect(fill = "white", colour="black"), text = element_text(size=16, colour="black")) + scale_fill_manual(values=c("A" = "blue4", "G" = "lightblue1", "C" = "olivedrab3", "T" = "olivedrab4"))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
311 #p = p + scale_colour_manual(values=c("A" = "black", "G" = "black", "C" = "black", "T" = "black"))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
312 print(p)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
313 dev.off()
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
314
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
315 pdfplots[[paste("transitions_stacked_", name, ".pdf", sep="")]] <<- p
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
316
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
317 png(filename=paste("transitions_heatmap_", name, ".png", sep=""))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
318 p = ggplot(transition2, aes(factor(reorder(variable, -order.y)), factor(reorder(id, -order.x)))) + geom_tile(aes(fill = value)) + scale_fill_gradient(low="white", high="steelblue") #heatmap
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
319 p = p + xlab("To base") + ylab("From Base") + ggtitle("Heatmap transition information") + theme(panel.background = element_rect(fill = "white", colour="black"), text = element_text(size=16, colour="black"))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
320 print(p)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
321 dev.off()
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
322
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
323 pdfplots[[paste("transitions_heatmap_", name, ".pdf", sep="")]] <<- p
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
324 } else {
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
325 #print("No data to plot")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
326 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
327 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
328
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
329 #print(paste("writing value file: ", name, "_", fname, "_value.txt" ,sep=""))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
330 write.table(x=transitionTable, file=paste("transitions_", name ,"_", fname, ".txt", sep=""), sep=",",quote=F,row.names=T,col.names=NA)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
331 write.table(x=tmp[,c("Sequence.ID", "best_match", "chunk_hit_percentage", "nt_hit_percentage", "start_locations")], file=paste("matched_", name , "_", fname, ".txt", sep=""), sep="\t",quote=F,row.names=F,col.names=T)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
332 cat(matrx[1,x], file=paste(name, "_", fname, "_value.txt" ,sep=""))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
333 cat(nrow(tmp), file=paste(name, "_", fname, "_n.txt" ,sep=""))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
334 #print(paste(fname, name, nrow(tmp)))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
335 matrx
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
336 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
337 nts = c("a", "c", "g", "t")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
338 zeros=rep(0, 4)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
339 funcs = c(median, sum, mean)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
340 fnames = c("median", "sum", "mean")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
341
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
342 print("Creating result tables")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
343
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
344 for(i in 1:length(funcs)){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
345 func = funcs[[i]]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
346 fname = fnames[[i]]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
347
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
348 print(paste("Creating table for", fname))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
349
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
350 rows = 9
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
351 if(fname == "sum"){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
352 rows = 11
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
353 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
354 matrx = matrix(data = 0, ncol=((length(genes) + 1) * 3),nrow=rows)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
355 for(i in 1:length(genes)){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
356 matrx = calculate_result(i, genes[i], dat, matrx, func, fname, genes[i])
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
357 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
358 matrx = calculate_result(i + 1, ".*", dat[!grepl("unmatched", dat$best_match),], matrx, func, fname, name="all")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
359
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
360 result = data.frame(matrx)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
361 if(fname == "sum"){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
362 row.names(result) = c("Number of Mutations (%)", "Transitions (%)", "Transversions (%)", "Transitions at G C (%)", "Targeting of G C (%)", "Transitions at A T (%)", "Targeting of A T (%)", "FR R/S (ratio)", "CDR R/S (ratio)", "nt in FR", "nt in CDR")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
363 } else {
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
364 row.names(result) = c("Number of Mutations (%)", "Transitions (%)", "Transversions (%)", "Transitions at G C (%)", "Targeting of G C (%)", "Transitions at A T (%)", "Targeting of A T (%)", "FR R/S (ratio)", "CDR R/S (ratio)")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
365 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
366 write.table(x=result, file=paste("mutations_", fname, ".txt", sep=""), sep=",",quote=F,row.names=T,col.names=F)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
367 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
368
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
369 print("Adding median number of mutations to sum table")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
370 sum.table = read.table("mutations_sum.txt", sep=",", header=F)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
371 median.table = read.table("mutations_median.txt", sep=",", header=F)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
372
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
373 new.table = sum.table[1,]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
374 new.table[2,] = median.table[1,]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
375 new.table[3:12,] = sum.table[2:11,]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
376 new.table[,1] = as.character(new.table[,1])
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
377 new.table[2,1] = "Median of Number of Mutations (%)"
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
378
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
379 #sum.table = sum.table[c("Number of Mutations (%)", "Median of Number of Mutations (%)", "Transition (%)", "Transversions (%)", "Transitions at G C (%)", "Targeting of G C (%)", "Transitions at A T (%)", "Targeting of A T (%)", "FR R/S (ratio)", "CDR R/S (ratio)", "nt in FR", "nt in CDR"),]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
380
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
381 write.table(x=new.table, file="mutations_sum.txt", sep=",",quote=F,row.names=F,col.names=F)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
382
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
383 print("Plotting IGA piechart")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
384
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
385 dat = dat[!grepl("^unmatched", dat$best_match),]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
386
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
387 #blegh
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
388
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
389 genesForPlot = dat[grepl("IGA", dat$best_match),]$best_match
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
390
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
391 if(length(genesForPlot) > 0){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
392 genesForPlot = data.frame(table(genesForPlot))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
393 colnames(genesForPlot) = c("Gene","Freq")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
394 genesForPlot$label = paste(genesForPlot$Gene, "-", genesForPlot$Freq)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
395
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
396 pc = ggplot(genesForPlot, aes(x = factor(1), y=Freq, fill=Gene))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
397 pc = pc + geom_bar(width = 1, stat = "identity") + scale_fill_manual(labels=genesForPlot$label, values=c("IGA1" = "lightblue1", "IGA2" = "blue4"))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
398 pc = pc + coord_polar(theta="y") + scale_y_continuous(breaks=NULL)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
399 pc = pc + theme(panel.background = element_rect(fill = "white", colour="black"), text = element_text(size=16, colour="black"), axis.title=element_blank(), axis.text=element_blank(), axis.ticks=element_blank())
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
400 pc = pc + xlab(" ") + ylab(" ") + ggtitle(paste("IGA subclass distribution", "( n =", sum(genesForPlot$Freq), ")"))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
401 write.table(genesForPlot, "IGA_pie.txt", sep="\t",quote=F,row.names=F,col.names=T)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
402
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
403 png(filename="IGA.png")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
404 print(pc)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
405 dev.off()
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
406
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
407 pdfplots[["IGA.pdf"]] <- pc
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
408 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
409
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
410 print("Plotting IGG piechart")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
411
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
412 genesForPlot = dat[grepl("IGG", dat$best_match),]$best_match
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
413
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
414 if(length(genesForPlot) > 0){
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
415 genesForPlot = data.frame(table(genesForPlot))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
416 colnames(genesForPlot) = c("Gene","Freq")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
417 genesForPlot$label = paste(genesForPlot$Gene, "-", genesForPlot$Freq)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
418
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
419 pc = ggplot(genesForPlot, aes(x = factor(1), y=Freq, fill=Gene))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
420 pc = pc + geom_bar(width = 1, stat = "identity") + scale_fill_manual(labels=genesForPlot$label, values=c("IGG1" = "olivedrab3", "IGG2" = "red", "IGG3" = "gold", "IGG4" = "darkred"))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
421 pc = pc + coord_polar(theta="y") + scale_y_continuous(breaks=NULL)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
422 pc = pc + theme(panel.background = element_rect(fill = "white", colour="black"), text = element_text(size=16, colour="black"), axis.title=element_blank(), axis.text=element_blank(), axis.ticks=element_blank())
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
423 pc = pc + xlab(" ") + ylab(" ") + ggtitle(paste("IGG subclass distribution", "( n =", sum(genesForPlot$Freq), ")"))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
424 write.table(genesForPlot, "IGG_pie.txt", sep="\t",quote=F,row.names=F,col.names=T)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
425
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
426 png(filename="IGG.png")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
427 print(pc)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
428 dev.off()
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
429
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
430 pdfplots[["IGG.pdf"]] <- pc
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
431 }
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
432
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
433 print("Plotting scatterplot")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
434
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
435 dat$percentage_mutations = round(dat$VRegionMutations / dat$VRegionNucleotides * 100, 2)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
436 dat.clss = dat
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
437
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
438 dat.clss$best_match = substr(dat.clss$best_match, 0, 3)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
439
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
440 dat.clss = rbind(dat, dat.clss)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
441
93
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
442 write.table(dat[,c("Sequence.ID", "best_match", "VRegionMutations", "VRegionNucleotides", "percentage_mutations")], "scatter.txt", sep="\t",quote=F,row.names=F,col.names=T)
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
443
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
444 if (nrow(dat) > 0) {
81
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
445 p = ggplot(dat.clss, aes(best_match, percentage_mutations))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
446 p = p + geom_point(aes(colour=best_match), position="jitter") + geom_boxplot(aes(middle=mean(percentage_mutations)), alpha=0.1, outlier.shape = NA)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
447 p = p + xlab("Subclass") + ylab("Frequency") + ggtitle("Frequency scatter plot") + theme(panel.background = element_rect(fill = "white", colour="black"), text = element_text(size=16, colour="black"))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
448 p = p + scale_fill_manual(values=c("IGA" = "blue4", "IGA1" = "lightblue1", "IGA2" = "blue4", "IGG" = "olivedrab3", "IGG1" = "olivedrab3", "IGG2" = "red", "IGG3" = "gold", "IGG4" = "darkred", "IGM" = "darkviolet", "IGE" = "darkorange", "all" = "blue4"))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
449 p = p + scale_colour_manual(guide = guide_legend(title = "Subclass"), values=c("IGA" = "blue4", "IGA1" = "lightblue1", "IGA2" = "blue4", "IGG" = "olivedrab3", "IGG1" = "olivedrab3", "IGG2" = "red", "IGG3" = "gold", "IGG4" = "darkred", "IGM" = "darkviolet", "IGE" = "darkorange", "all" = "blue4"))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
450 png(filename="scatter.png")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
451 print(p)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
452 dev.off()
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
453
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
454 pdfplots[["scatter.pdf"]] <- p
93
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
455 }
81
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
456
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
457 print("Plotting frequency ranges plot")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
458
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
459 dat$best_match_class = substr(dat$best_match, 0, 3)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
460 freq_labels = c("0", "0-2", "2-5", "5-10", "10-15", "15-20", "20")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
461 dat$frequency_bins = cut(dat$percentage_mutations, breaks=c(-Inf, 0, 2,5,10,15,20, Inf), labels=freq_labels)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
462
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
463 frequency_bins_sum = data.frame(data.table(dat)[, list(class_sum=sum(.N)), by=c("best_match_class")])
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
464
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
465 frequency_bins_data = data.frame(data.table(dat)[, list(frequency_count=.N), by=c("best_match_class", "frequency_bins")])
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
466
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
467 frequency_bins_data = merge(frequency_bins_data, frequency_bins_sum, by="best_match_class")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
468
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
469 frequency_bins_data$frequency = round(frequency_bins_data$frequency_count / frequency_bins_data$class_sum * 100, 2)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
470
93
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
471 if (nrow(frequency_bins_data) > 0) {
81
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
472 p = ggplot(frequency_bins_data, aes(frequency_bins, frequency))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
473 p = p + geom_bar(aes(fill=best_match_class), stat="identity", position="dodge") + theme(panel.background = element_rect(fill = "white", colour="black"), text = element_text(size=16, colour="black"))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
474 p = p + xlab("Frequency ranges") + ylab("Frequency") + ggtitle("Mutation Frequencies by class") + scale_fill_manual(guide = guide_legend(title = "Class"), values=c("IGA" = "blue4", "IGG" = "olivedrab3", "IGM" = "darkviolet", "IGE" = "darkorange", "all" = "blue4"))
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
475
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
476 png(filename="frequency_ranges.png")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
477 print(p)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
478 dev.off()
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
479
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
480 pdfplots[["frequency_ranges.pdf"]] <- p
93
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
481 }
81
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
482
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
483 save(pdfplots, file="pdfplots.RData")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
484
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
485 frequency_bins_data_by_class = frequency_bins_data
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
486
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
487 frequency_bins_data_by_class = frequency_bins_data_by_class[order(frequency_bins_data_by_class$best_match_class, frequency_bins_data_by_class$frequency_bins),]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
488
93
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
489
81
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
490 frequency_bins_data_by_class$frequency_bins = gsub("-", " to ", frequency_bins_data_by_class$frequency_bins)
93
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
491 if (nrow(frequency_bins_data_by_class) > 0) {
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
492 frequency_bins_data_by_class[frequency_bins_data_by_class$frequency_bins == "20", c("frequency_bins")] = "20 or higher"
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
493 frequency_bins_data_by_class[frequency_bins_data_by_class$frequency_bins == "0", c("frequency_bins")] = "0 or lower"
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
494 }
81
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
495 write.table(frequency_bins_data_by_class, "frequency_ranges_classes.txt", sep="\t",quote=F,row.names=F,col.names=T)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
496
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
497 frequency_bins_data = data.frame(data.table(dat)[, list(frequency_count=.N), by=c("best_match", "best_match_class", "frequency_bins")])
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
498
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
499 frequency_bins_sum = data.frame(data.table(dat)[, list(class_sum=sum(.N)), by=c("best_match")])
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
500
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
501 frequency_bins_data = merge(frequency_bins_data, frequency_bins_sum, by="best_match")
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
502
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
503 frequency_bins_data$frequency = round(frequency_bins_data$frequency_count / frequency_bins_data$class_sum * 100, 2)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
504
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
505 frequency_bins_data = frequency_bins_data[order(frequency_bins_data$best_match, frequency_bins_data$frequency_bins),]
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
506 frequency_bins_data$frequency_bins = gsub("-", " to ", frequency_bins_data$frequency_bins)
93
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
507 if (nrow(frequency_bins_data) > 0) {
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
508 frequency_bins_data[frequency_bins_data$frequency_bins == "20", c("frequency_bins")] = "20 or higher"
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
509 frequency_bins_data[frequency_bins_data$frequency_bins == "0", c("frequency_bins")] = "0 or lower"
8fcf31272f6e planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
rhpvorderman
parents: 81
diff changeset
510 }
81
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
511 write.table(frequency_bins_data, "frequency_ranges_subclasses.txt", sep="\t",quote=F,row.names=F,col.names=T)
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
512
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
513
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
514
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
515
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
516
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
517
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
518
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
519
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
520
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
521
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
522
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
523
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
524
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
525
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
526
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
527
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
528
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
529
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
530
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
531
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
532
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
533
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
534
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
535
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
536
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
537
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
538
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
539
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
540
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
541
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
542
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
543
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
544
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
545
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
546
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
547
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
548
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
549
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
550
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
551
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
552
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
553
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
554
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
555
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
556
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
557
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
558
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
559
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
560
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
561
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
562
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
563
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
564
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
565
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
566
b6f9a640e098 Uploaded
davidvanzessen
parents:
diff changeset
567