comparison mutation_analysis.r @ 123:0453ea4d9f14 draft

Uploaded
author davidvanzessen
date Mon, 22 Aug 2016 07:00:23 -0400
parents 613278c1bde0
children
comparison
equal deleted inserted replaced
122:3d64b3efd352 123:0453ea4d9f14
229 matrx[9,z] = round(matrx[9,x] / matrx[9,y], digits=1) 229 matrx[9,z] = round(matrx[9,x] / matrx[9,y], digits=1)
230 230
231 if(fname == "sum"){ 231 if(fname == "sum"){
232 matrx[10,x] = round(f(rowSums(tmp[,c("FR2.IMGT.Nb.of.nucleotides", "FR3.IMGT.Nb.of.nucleotides")], na.rm=T)), digits=1) 232 matrx[10,x] = round(f(rowSums(tmp[,c("FR2.IMGT.Nb.of.nucleotides", "FR3.IMGT.Nb.of.nucleotides")], na.rm=T)), digits=1)
233 matrx[10,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1) 233 matrx[10,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1)
234 matrx[10,z] = round(matrx[10,x] / matrx[10,y], digits=1) 234 matrx[10,z] = round(matrx[10,x] / matrx[10,y] * 100, digits=1)
235 235
236 matrx[11,x] = round(f(rowSums(tmp[,c("CDR1.IMGT.Nb.of.nucleotides", "CDR2.IMGT.Nb.of.nucleotides")], na.rm=T)), digits=1) 236 matrx[11,x] = round(f(rowSums(tmp[,c("CDR1.IMGT.Nb.of.nucleotides", "CDR2.IMGT.Nb.of.nucleotides")], na.rm=T)), digits=1)
237 matrx[11,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1) 237 matrx[11,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1)
238 matrx[11,z] = round(matrx[11,x] / matrx[11,y], digits=1) 238 matrx[11,z] = round(matrx[11,x] / matrx[11,y] * 100, digits=1)
239 } 239 }
240 } 240 }
241 241
242 transitionTable = data.frame(A=zeros,C=zeros,G=zeros,T=zeros) 242 transitionTable = data.frame(A=zeros,C=zeros,G=zeros,T=zeros)
243 row.names(transitionTable) = c("A", "C", "G", "T") 243 row.names(transitionTable) = c("A", "C", "G", "T")
336 336
337 matrx = calculate_result(i + 1, ".*", dat[!grepl("unmatched", dat$best_match),], matrx, func, fname, name="all") 337 matrx = calculate_result(i + 1, ".*", dat[!grepl("unmatched", dat$best_match),], matrx, func, fname, name="all")
338 338
339 result = data.frame(matrx) 339 result = data.frame(matrx)
340 if(fname == "sum"){ 340 if(fname == "sum"){
341 row.names(result) = c("Number of Mutations (%)", "Transition (%)", "Transversions (%)", "Transitions at G C (%)", "Targeting of C G (%)", "Transitions at A T (%)", "Targeting of A T (%)", "FR R/S (ratio)", "CDR R/S (ratio)", "nt in FR", "nt in CDR") 341 row.names(result) = c("Number of Mutations (%)", "Transitions (%)", "Transversions (%)", "Transitions at G C (%)", "Targeting of C G (%)", "Transitions at A T (%)", "Targeting of A T (%)", "FR R/S (ratio)", "CDR R/S (ratio)", "nt in FR", "nt in CDR")
342 } else { 342 } else {
343 row.names(result) = c("Number of Mutations (%)", "Transition (%)", "Transversions (%)", "Transitions at G C (%)", "Targeting of C G (%)", "Transitions at A T (%)", "Targeting of A T (%)", "FR R/S (ratio)", "CDR R/S (ratio)") 343 row.names(result) = c("Number of Mutations (%)", "Transitions (%)", "Transversions (%)", "Transitions at G C (%)", "Targeting of C G (%)", "Transitions at A T (%)", "Targeting of A T (%)", "FR R/S (ratio)", "CDR R/S (ratio)")
344 } 344 }
345 345
346 write.table(x=result, file=paste("mutations_", fname, ".txt", sep=""), sep=",",quote=F,row.names=T,col.names=F) 346 write.table(x=result, file=paste("mutations_", fname, ".txt", sep=""), sep=",",quote=F,row.names=T,col.names=F)
347 } 347 }
348 348