comparison imgt_loader.r @ 54:ba3220f921af draft

Uploaded
author davidvanzessen
date Tue, 30 May 2017 07:40:15 -0400
parents 64711f461c8e
children
comparison
equal deleted inserted replaced
53:3be28ac82909 54:ba3220f921af
66 names(out) = c('ID','VDJ Frame','Top V Gene','Top D Gene','Top J Gene','CDR1 Seq','CDR1 Length','CDR2 Seq','CDR2 Length','CDR3 Seq','CDR3 Length','CDR3 Seq DNA','CDR3 Length DNA','Strand','CDR3 Found How','Functionality','V-REGION identity %','V-REGION identity nt','D-REGION reading frame','AA JUNCTION','Functionality comment','Sequence','FR1-IMGT','FR2-IMGT','FR3-IMGT','CDR3-IMGT','JUNCTION','J-REGION','FR4-IMGT','P3V-nt nb','N-REGION-nt nb','N1-REGION-nt nb','P5D-nt nb','P3D-nt nb','N2-REGION-nt nb','P5J-nt nb','3V-REGION trimmed-nt nb','5D-REGION trimmed-nt nb','3D-REGION trimmed-nt nb','5J-REGION trimmed-nt nb','N-REGION','N1-REGION','N2-REGION', 'P5.D1.nt.nb', 'P3.D1.nt.nb', 'N2.REGION.nt.nb', 'P5.D2.nt.nb', 'P3.D2.nt.nb', 'N3.REGION.nt.nb', 'P5.D3.nt.nb', 'P3.D2.nt.nb', 'N4.REGION.nt.nb', 'X5.D1.REGION.trimmed.nt.nb', 'X3.D1.REGION.trimmed.nt.nb', 'X5.D2.REGION.trimmed.nt.nb', 'X3.D2.REGION.trimmed.nt.nb', 'X5.D3.REGION.trimmed.nt.nb', 'X3.D3.REGION.trimmed.nt.nb', 'D.REGION.nt.nb', 'D1.REGION.nt.nb', 'D2.REGION.nt.nb', 'D3.REGION.nt.nb') 66 names(out) = c('ID','VDJ Frame','Top V Gene','Top D Gene','Top J Gene','CDR1 Seq','CDR1 Length','CDR2 Seq','CDR2 Length','CDR3 Seq','CDR3 Length','CDR3 Seq DNA','CDR3 Length DNA','Strand','CDR3 Found How','Functionality','V-REGION identity %','V-REGION identity nt','D-REGION reading frame','AA JUNCTION','Functionality comment','Sequence','FR1-IMGT','FR2-IMGT','FR3-IMGT','CDR3-IMGT','JUNCTION','J-REGION','FR4-IMGT','P3V-nt nb','N-REGION-nt nb','N1-REGION-nt nb','P5D-nt nb','P3D-nt nb','N2-REGION-nt nb','P5J-nt nb','3V-REGION trimmed-nt nb','5D-REGION trimmed-nt nb','3D-REGION trimmed-nt nb','5J-REGION trimmed-nt nb','N-REGION','N1-REGION','N2-REGION', 'P5.D1.nt.nb', 'P3.D1.nt.nb', 'N2.REGION.nt.nb', 'P5.D2.nt.nb', 'P3.D2.nt.nb', 'N3.REGION.nt.nb', 'P5.D3.nt.nb', 'P3.D2.nt.nb', 'N4.REGION.nt.nb', 'X5.D1.REGION.trimmed.nt.nb', 'X3.D1.REGION.trimmed.nt.nb', 'X5.D2.REGION.trimmed.nt.nb', 'X3.D2.REGION.trimmed.nt.nb', 'X5.D3.REGION.trimmed.nt.nb', 'X3.D3.REGION.trimmed.nt.nb', 'D.REGION.nt.nb', 'D1.REGION.nt.nb', 'D2.REGION.nt.nb', 'D3.REGION.nt.nb')
67 67
68 out[,"VDJ Frame"] = as.character(out[,"VDJ Frame"]) 68 out[,"VDJ Frame"] = as.character(out[,"VDJ Frame"])
69 69
70 fltr = out[,"VDJ Frame"] == "in-frame" 70 fltr = out[,"VDJ Frame"] == "in-frame"
71 if(any(fltr)){ 71 if(any(fltr, na.rm = T)){
72 out[fltr, "VDJ Frame"] = "In-frame" 72 out[fltr, "VDJ Frame"] = "In-frame"
73 } 73 }
74 74
75 fltr = out[,"VDJ Frame"] == "null" 75 fltr = out[,"VDJ Frame"] == "null"
76 if(any(fltr)){ 76 if(any(fltr, na.rm = T)){
77 out[fltr, "VDJ Frame"] = "Out-of-frame" 77 out[fltr, "VDJ Frame"] = "Out-of-frame"
78 } 78 }
79 79
80 fltr = out[,"VDJ Frame"] == "out-of-frame" 80 fltr = out[,"VDJ Frame"] == "out-of-frame"
81 if(any(fltr)){ 81 if(any(fltr, na.rm = T)){
82 out[fltr, "VDJ Frame"] = "Out-of-frame" 82 out[fltr, "VDJ Frame"] = "Out-of-frame"
83 } 83 }
84 84
85 fltr = out[,"VDJ Frame"] == "" 85 fltr = out[,"VDJ Frame"] == ""
86 if(any(fltr)){ 86 if(any(fltr, na.rm = T)){
87 out[fltr, "VDJ Frame"] = "Out-of-frame" 87 out[fltr, "VDJ Frame"] = "Out-of-frame"
88 } 88 }
89 89
90 for(col in c('Top V Gene','Top D Gene','Top J Gene')){ 90 for(col in c('Top V Gene','Top D Gene','Top J Gene')){
91 out[,col] = as.character(out[,col]) 91 out[,col] = as.character(out[,col])
92 fltr = out[,col] == "" 92 fltr = out[,col] == ""
93 if(any(fltr)){ 93 if(any(fltr, na.rm = T)){
94 out[fltr,col] = "NA" 94 out[fltr,col] = "NA"
95 } 95 }
96 } 96 }
97 97
98 write.table(out, out.file, sep="\t", quote=F, row.names=F, col.names=T) 98 write.table(out, out.file, sep="\t", quote=F, row.names=F, col.names=T)