Mercurial > repos > davidvanzessen > mutation_analysis
changeset 71:9165bec41c02 draft
Uploaded
author | davidvanzessen |
---|---|
date | Wed, 04 May 2016 03:48:57 -0400 |
parents | c2e1d5a93f98 |
children | 51d92233fb5d |
files | mutation_analysis.r |
diffstat | 1 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mutation_analysis.r Thu Apr 28 08:11:55 2016 -0400 +++ b/mutation_analysis.r Wed May 04 03:48:57 2016 -0400 @@ -51,6 +51,7 @@ "CDR2.IMGT.Nb.of.nucleotides", "FR2.IMGT.a.t", "CDR1.IMGT.Nb.of.mutations", + "CDR3.IMGT.Nb.of.nucleotides", "CDR1.IMGT.a.g", "FR3.IMGT.a.c", "FR1.IMGT.g.a", @@ -222,6 +223,16 @@ matrx[9,x] = round(f(tmp$nonSilentMutationsCDR, na.rm=T), digits=1) matrx[9,y] = round(f(tmp$silentMutationsCDR, na.rm=T), digits=1) matrx[9,z] = round(matrx[9,x] / matrx[9,y], digits=1) + + if(fname == "sum"){ + matrx[10,x] = round(f(rowSums(tmp[,c("FR2.IMGT.Nb.of.nucleotides", "FR3.IMGT.Nb.of.nucleotides")], na.rm=T)), digits=1) + matrx[10,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1) + matrx[10,z] = round(matrx[10,x] / matrx[10,y], digits=1) + + matrx[11,x] = round(f(rowSums(tmp[,c("CDR1.IMGT.Nb.of.nucleotides", "CDR3.IMGT.Nb.of.nucleotides")], na.rm=T)), digits=1) + matrx[11,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1) + matrx[11,z] = round(matrx[11,x] / matrx[11,y], digits=1) + } } transitionTable = data.frame(A=zeros,C=zeros,G=zeros,T=zeros) @@ -275,7 +286,11 @@ func = funcs[[i]] fname = fnames[[i]] - matrx = matrix(data = 0, ncol=((length(genes) + 1) * 3),nrow=9) + rows = 9 + if(fname == "sum"){ + rows = 11 + } + matrx = matrix(data = 0, ncol=((length(genes) + 1) * 3),nrow=rows) for(i in 1:length(genes)){ matrx = calculate_result(i, genes[i], dat, matrx, func, fname, genes[i]) @@ -284,7 +299,11 @@ matrx = calculate_result(i + 1, ".*", dat, matrx, func, fname, name="all") result = data.frame(matrx) - 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)") + if(fname == "sum"){ + 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") + } else { + 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)") + } write.table(x=result, file=paste("mutations_", fname, ".txt", sep=""), sep=",",quote=F,row.names=T,col.names=F) }