comparison aa_histogram.r @ 29:80c4eebf7bc9 draft

Uploaded
author davidvanzessen
date Thu, 08 Dec 2016 04:51:09 -0500
parents 81453585dfc3
children a24f8c93583a
comparison
equal deleted inserted replaced
28:c0ecc31829bd 29:80c4eebf7bc9
14 mutations.by.id = read.table(mutations.by.id.file, sep="\t", fill=T, header=T, quote="") 14 mutations.by.id = read.table(mutations.by.id.file, sep="\t", fill=T, header=T, quote="")
15 absent.aa.by.id = read.table(absent.aa.by.id.file, sep="\t", fill=T, header=T, quote="") 15 absent.aa.by.id = read.table(absent.aa.by.id.file, sep="\t", fill=T, header=T, quote="")
16 16
17 for(gene in genes){ 17 for(gene in genes){
18 if(gene == ""){ 18 if(gene == ""){
19 mutations.by.id.gene = mutations.by.id[!grepl("unmatched", mutations.by.id$best_match),] 19 mutations.by.id.gene = mutations.by.id[!grepl("unmatched", mutations.by.id$best_match),]
20 absent.aa.by.id.gene = absent.aa.by.id[!grepl("unmatched", absent.aa.by.id$best_match),] 20 absent.aa.by.id.gene = absent.aa.by.id[!grepl("unmatched", absent.aa.by.id$best_match),]
21 } else { 21 } else {
22 mutations.by.id.gene = mutations.by.id[grepl(paste("^", gene, sep=""), mutations.by.id$best_match),] 22 mutations.by.id.gene = mutations.by.id[grepl(paste("^", gene, sep=""), mutations.by.id$best_match),]
23 absent.aa.by.id.gene = absent.aa.by.id[grepl(paste("^", gene, sep=""), absent.aa.by.id$best_match),] 23 absent.aa.by.id.gene = absent.aa.by.id[grepl(paste("^", gene, sep=""), absent.aa.by.id$best_match),]
24 } 24 }
25 print(paste("nrow", gene, nrow(absent.aa.by.id.gene))) 25 print(paste("nrow", gene, nrow(absent.aa.by.id.gene)))
26 if(nrow(mutations.by.id.gene) == 0){ 26 if(nrow(mutations.by.id.gene) == 0){
27 next 27 next
28 } 28 }
29 29
30 mutations.at.position = colSums(mutations.by.id.gene[,-c(1,2)]) 30 mutations.at.position = colSums(mutations.by.id.gene[,-c(1,2)])
31 aa.at.position = colSums(absent.aa.by.id.gene[,-c(1,2,3,4)]) 31 aa.at.position = colSums(absent.aa.by.id.gene[,-c(1,2,3,4)])
32 32