comparison shm_csr.r @ 8:3968d04b5724 draft

Uploaded
author davidvanzessen
date Mon, 07 Nov 2016 06:52:53 -0500
parents ad9be244b104
children 372ccdcf0b2d
comparison
equal deleted inserted replaced
7:ad9be244b104 8:3968d04b5724
173 mutation.sum.columns = c("Sequence.ID", "VRegionMutations", "VRegionNucleotides", "transitionMutations", "transversionMutations", "transitionMutationsAtGC", "transitionMutationsAtAT", "silentMutationsFR", "nonSilentMutationsFR", "silentMutationsCDR", "nonSilentMutationsCDR") 173 mutation.sum.columns = c("Sequence.ID", "VRegionMutations", "VRegionNucleotides", "transitionMutations", "transversionMutations", "transitionMutationsAtGC", "transitionMutationsAtAT", "silentMutationsFR", "nonSilentMutationsFR", "silentMutationsCDR", "nonSilentMutationsCDR")
174 write.table(dat[,mutation.sum.columns], "mutation_by_id.txt", sep="\t",quote=F,row.names=F,col.names=T) 174 write.table(dat[,mutation.sum.columns], "mutation_by_id.txt", sep="\t",quote=F,row.names=F,col.names=T)
175 175
176 setwd(outputdir) 176 setwd(outputdir)
177 177
178 write.table(dat, input, sep="\t",quote=F,row.names=F,col.names=T)
179
178 base.order = data.frame(base=c("A", "T", "C", "G"), order=1:4) 180 base.order = data.frame(base=c("A", "T", "C", "G"), order=1:4)
179 181
180 calculate_result = function(i, gene, dat, matrx, f, fname, name){ 182 calculate_result = function(i, gene, dat, matrx, f, fname, name){
181 tmp = dat[grepl(paste("^", gene, ".*", sep=""), dat$best_match),] 183 tmp = dat[grepl(paste("^", gene, ".*", sep=""), dat$best_match),]
182 184
435 print(p) 437 print(p)
436 dev.off() 438 dev.off()
437 439
438 write.table(dat[,c("Sequence.ID", "best_match", "VRegionMutations", "VRegionNucleotides", "percentage_mutations")], "scatter.txt", sep="\t",quote=F,row.names=F,col.names=T) 440 write.table(dat[,c("Sequence.ID", "best_match", "VRegionMutations", "VRegionNucleotides", "percentage_mutations")], "scatter.txt", sep="\t",quote=F,row.names=F,col.names=T)
439 441
440 write.table(dat, input, sep="\t",quote=F,row.names=F,col.names=T)
441
442 print("Plotting frequency ranges plot") 442 print("Plotting frequency ranges plot")
443 443
444 dat$best_match_class = substr(dat$best_match, 0, 3) 444 dat$best_match_class = substr(dat$best_match, 0, 3)
445 freq_labels = c("0", "0-2", "2-5", "5-10", "10-15", "15-20", "20") 445 freq_labels = c("0", "0-2", "2-5", "5-10", "10-15", "15-20", "20")
446 dat$frequency_bins = cut(dat$percentage_mutations, breaks=c(-Inf, 0, 2,5,10,15,20, Inf), labels=freq_labels) 446 dat$frequency_bins = cut(dat$percentage_mutations, breaks=c(-Inf, 0, 2,5,10,15,20, Inf), labels=freq_labels)