comparison new_imgt.r @ 57:cb779a45537b draft

Uploaded
author davidvanzessen
date Tue, 18 Jul 2017 04:28:11 -0400
parents 6cd12c71c3d3
children dc06e94bc1e3
comparison
equal deleted inserted replaced
56:ee807645b224 57:cb779a45537b
12 12
13 if("best_match" %in% names(merged)){ 13 if("best_match" %in% names(merged)){
14 merged = merged[!grepl("unmatched", merged$best_match),] 14 merged = merged[!grepl("unmatched", merged$best_match),]
15 } 15 }
16 16
17 nrow_dat = 0
18
17 for(f in list.files(imgt.dir, pattern="*.txt$")){ 19 for(f in list.files(imgt.dir, pattern="*.txt$")){
18 #print(paste("filtering", f)) 20 #print(paste("filtering", f))
19 path = file.path(imgt.dir, f) 21 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="") 22 dat = read.table(path, header=T, sep="\t", fill=T, quote="", stringsAsFactors=F, check.names=FALSE, comment.char="")
21 23
22 dat = dat[dat[,"Sequence ID"] %in% merged$Sequence.ID,] 24 dat = dat[dat[,"Sequence ID"] %in% merged$Sequence.ID,]
23 25
26 nrow_dat = nrow(dat)
27
24 if(nrow(dat) > 0 & grepl("^8_", f)){ #change the FR1 columns to 0 in the "8_..." file 28 if(nrow(dat) > 0 & grepl("^8_", f)){ #change the FR1 columns to 0 in the "8_..." file
25 dat[,grepl("^FR1", names(dat))] = 0 29 dat[,grepl("^FR1", names(dat))] = 0
26 } 30 }
27 31
28 write.table(dat, path, quote=F, sep="\t", row.names=F, col.names=T, na="") 32 write.table(dat, path, quote=F, sep="\t", row.names=F, col.names=T, na="")
29 } 33 }
34
35 print(paste("Creating new zip for ", gene, "with", nrow_dat, "sequences"))