comparison report_clonality/RScript.r @ 67:69a6bba9ada9 draft

Uploaded
author davidvanzessen
date Thu, 21 Jul 2016 03:56:52 -0400
parents 7696dd687f39
children a59de79f6c0f
comparison
equal deleted inserted replaced
66:7696dd687f39 67:69a6bba9ada9
17 install.packages("data.table", repos="http://cran.xl-mirror.nl/") 17 install.packages("data.table", repos="http://cran.xl-mirror.nl/")
18 } 18 }
19 library(data.table) 19 library(data.table)
20 20
21 if (!("reshape2" %in% rownames(installed.packages()))) { 21 if (!("reshape2" %in% rownames(installed.packages()))) {
22 install.packages("reshape2", repos="http://cran.xl-mirror.nl/") 22 install.packages("reshape2", repos="http://cran.xl-mirror.nl/")
23 } 23 }
24 library(reshape2) 24 library(reshape2)
25 25
26 if (!("lymphclon" %in% rownames(installed.packages()))) { 26 if (!("lymphclon" %in% rownames(installed.packages()))) {
27 install.packages("lymphclon", repos="http://cran.xl-mirror.nl/") 27 install.packages("lymphclon", repos="http://cran.xl-mirror.nl/")
28 } 28 }
29 library(lymphclon) 29 library(lymphclon)
30 30
31 # ---------------------- parameters ---------------------- 31 # ---------------------- parameters ----------------------
32 32
179 count = rbind(sample.count, rep.count) 179 count = rbind(sample.count, rep.count)
180 180
181 181
182 182
183 write.table(x=count, file="productive_counting.txt", sep=",",quote=F,row.names=F,col.names=F) 183 write.table(x=count, file="productive_counting.txt", sep=",",quote=F,row.names=F,col.names=F)
184
185 # ---------------------- V+J+CDR3 sequence count ----------------------
186
187 VJCDR3.count = data.frame(table(clonalityFrame$Top.V.Gene, clonalityFrame$Top.J.Gene, clonalityFrame$CDR3.Seq.DNA))
188 names(VJCDR3.count) = c("Top.V.Gene", "Top.J.Gene", "CDR3.Seq.DNA", "Count")
189
190 VJCDR3.count = VJCDR3.count[VJCDR3.count$Count > 0,]
191 VJCDR3.count = VJCDR3.count[order(-VJCDR3.count$Count),]
192
193 write.table(x=VJCDR3.count, file="VJCDR3_count.txt", sep="\t",quote=F,row.names=F,col.names=T)
184 194
185 # ---------------------- Frequency calculation for V, D and J ---------------------- 195 # ---------------------- Frequency calculation for V, D and J ----------------------
186 196
187 print("Report Clonality - frequency calculation V, D and J") 197 print("Report Clonality - frequency calculation V, D and J")
188 198