comparison new_imgt.r @ 55:6cd12c71c3d3 draft

Uploaded
author davidvanzessen
date Wed, 14 Jun 2017 11:14:00 -0400
parents fe44a905aee9
children cb779a45537b
comparison
equal deleted inserted replaced
54:ba3220f921af 55:6cd12c71c3d3
6 6
7 merged = read.table(merged.file, header=T, sep="\t", fill=T, stringsAsFactors=F, comment.char="") 7 merged = read.table(merged.file, header=T, sep="\t", fill=T, stringsAsFactors=F, comment.char="")
8 8
9 if(gene != "-"){ 9 if(gene != "-"){
10 merged = merged[grepl(paste("^", gene, sep=""), merged$best_match),] 10 merged = merged[grepl(paste("^", gene, sep=""), merged$best_match),]
11 } else { 11 }
12
13 if("best_match" %in% names(merged)){
12 merged = merged[!grepl("unmatched", merged$best_match),] 14 merged = merged[!grepl("unmatched", merged$best_match),]
13 } 15 }
14 16
15 merged = merged[!grepl("unmatched", merged$best_match),]
16
17 for(f in list.files(imgt.dir, pattern="*.txt$")){ 17 for(f in list.files(imgt.dir, pattern="*.txt$")){
18 #print(paste("filtering", f)) 18 #print(paste("filtering", f))
19 path = paste(imgt.dir, f, sep="") 19 path = file.path(imgt.dir, f)
20 dat = read.table(path, header=T, sep="\t", fill=T, quote="", stringsAsFactors=F, check.names=FALSE, comment.char="") 20 dat = read.table(path, header=T, sep="\t", fill=T, quote="", stringsAsFactors=F, check.names=FALSE, comment.char="")
21 21
22 dat = dat[dat[,"Sequence ID"] %in% merged$Sequence.ID,] 22 dat = dat[dat[,"Sequence ID"] %in% merged$Sequence.ID,]
23 23
24 if(nrow(dat) > 0 & grepl("^8_", f)){ #change the FR1 columns to 0 in the "8_..." file 24 if(nrow(dat) > 0 & grepl("^8_", f)){ #change the FR1 columns to 0 in the "8_..." file