Mercurial > repos > davidvanzessen > mutation_analysis
comparison mutation_analysis.r @ 68:3636d5aaa127 draft
Uploaded
| author | davidvanzessen |
|---|---|
| date | Wed, 20 Apr 2016 10:16:25 -0400 |
| parents | 7290a88ea202 |
| children | 9165bec41c02 |
comparison
equal
deleted
inserted
replaced
| 67:67a9ddf6a8f5 | 68:3636d5aaa127 |
|---|---|
| 170 | 170 |
| 171 setwd(outputdir) | 171 setwd(outputdir) |
| 172 | 172 |
| 173 | 173 |
| 174 calculate_result = function(i, gene, dat, matrx, f, fname, name){ | 174 calculate_result = function(i, gene, dat, matrx, f, fname, name){ |
| 175 tmp = dat[grepl(paste(".*", gene, ".*", sep=""), dat$best_match),] | 175 tmp = dat[grepl(paste(".*", gene, ".*", sep=""), dat$best_match),] |
| 176 | 176 |
| 177 j = i - 1 | 177 j = i - 1 |
| 178 x = (j * 3) + 1 | 178 x = (j * 3) + 1 |
| 179 y = (j * 3) + 2 | 179 y = (j * 3) + 2 |
| 180 z = (j * 3) + 3 | 180 z = (j * 3) + 3 |
| 181 | 181 |
| 182 if(nrow(tmp) > 0){ | 182 if(nrow(tmp) > 0){ |
| 183 | 183 |
| 184 matrx[1,x] = round(f(tmp$VRegionMutations, na.rm=T), digits=1) | 184 if(fname == "sum"){ |
| 185 matrx[1,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1) | 185 matrx[1,x] = round(f(tmp$VRegionMutations, na.rm=T), digits=1) |
| 186 matrx[1,z] = round(matrx[1,x] / matrx[1,y] * 100, digits=1) | 186 matrx[1,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1) |
| 187 matrx[1,z] = round(f(matrx[1,x] / matrx[1,y]) * 100, digits=1) | |
| 188 } else { | |
| 189 matrx[1,x] = round(f(tmp$VRegionMutations, na.rm=T), digits=1) | |
| 190 matrx[1,y] = round(f(tmp$VRegionNucleotides, na.rm=T), digits=1) | |
| 191 matrx[1,z] = round(f(tmp$VRegionMutations / tmp$VRegionNucleotides) * 100, digits=1) | |
| 192 } | |
| 187 | 193 |
| 188 matrx[2,x] = round(f(tmp$transitionMutations, na.rm=T), digits=1) | 194 matrx[2,x] = round(f(tmp$transitionMutations, na.rm=T), digits=1) |
| 189 matrx[2,y] = round(f(tmp$VRegionMutations, na.rm=T), digits=1) | 195 matrx[2,y] = round(f(tmp$VRegionMutations, na.rm=T), digits=1) |
| 190 matrx[2,z] = round(matrx[2,x] / matrx[2,y] * 100, digits=1) | 196 matrx[2,z] = round(matrx[2,x] / matrx[2,y] * 100, digits=1) |
| 191 | 197 |
