Mercurial > repos > davidvanzessen > mutation_analysis
comparison mutation_analysis.r @ 78:b523ce95d857 draft
Uploaded
author | davidvanzessen |
---|---|
date | Wed, 11 May 2016 10:29:33 -0400 |
parents | 13c3710604ef |
children | e39176ccddc8 |
comparison
equal
deleted
inserted
replaced
77:c5c86d15cb94 | 78:b523ce95d857 |
---|---|
167 write.table(dat[,mutation.sum.columns], "mutation_by_id.txt", sep="\t",quote=F,row.names=F,col.names=T) | 167 write.table(dat[,mutation.sum.columns], "mutation_by_id.txt", sep="\t",quote=F,row.names=F,col.names=T) |
168 | 168 |
169 setwd(outputdir) | 169 setwd(outputdir) |
170 | 170 |
171 calculate_result = function(i, gene, dat, matrx, f, fname, name){ | 171 calculate_result = function(i, gene, dat, matrx, f, fname, name){ |
172 tmp = dat[grepl(paste(".*", gene, ".*", sep=""), dat$best_match),] | 172 tmp = dat[grepl(paste("^", gene, ".*", sep=""), dat$best_match),] |
173 | 173 |
174 j = i - 1 | 174 j = i - 1 |
175 x = (j * 3) + 1 | 175 x = (j * 3) + 1 |
176 y = (j * 3) + 2 | 176 y = (j * 3) + 2 |
177 z = (j * 3) + 3 | 177 z = (j * 3) + 3 |
265 | 265 |
266 write.table(x=transitionTable, file=paste("transitions_", name ,"_", fname, ".txt", sep=""), sep=",",quote=F,row.names=T,col.names=NA) | 266 write.table(x=transitionTable, file=paste("transitions_", name ,"_", fname, ".txt", sep=""), sep=",",quote=F,row.names=T,col.names=NA) |
267 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) | 267 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) |
268 | 268 |
269 cat(matrx[1,x], file=paste(name, "_", fname, "_value.txt" ,sep="")) | 269 cat(matrx[1,x], file=paste(name, "_", fname, "_value.txt" ,sep="")) |
270 cat(length(tmp$Sequence.ID), file=paste(name, "_", fname, "_n.txt" ,sep="")) | 270 cat(nrow(tmp), file=paste(name, "_", fname, "_n.txt" ,sep="")) |
271 | |
272 print(paste(fname, name, nrow(tmp))) | |
271 | 273 |
272 matrx | 274 matrx |
273 } | 275 } |
274 | 276 |
275 nts = c("a", "c", "g", "t") | 277 nts = c("a", "c", "g", "t") |